Corrected some issues on OpenGL 1.1
This commit is contained in:
parent
8f91ed81c5
commit
897179a06c
2 changed files with 46 additions and 31 deletions
15
src/rlgl.c
15
src/rlgl.c
|
@ -1545,10 +1545,10 @@ void rlglLoadMesh(Mesh *mesh, bool dynamic)
|
|||
mesh->vboId[5] = 0; // Vertex texcoords2 VBO
|
||||
mesh->vboId[6] = 0; // Vertex indices VBO
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
int drawHint = GL_STATIC_DRAW;
|
||||
if (dynamic) drawHint = GL_DYNAMIC_DRAW;
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
GLuint vaoId = 0; // Vertex Array Objects (VAO)
|
||||
GLuint vboId[7]; // Vertex Buffer Objects (VBOs)
|
||||
|
||||
|
@ -1674,6 +1674,7 @@ void rlglLoadMesh(Mesh *mesh, bool dynamic)
|
|||
// Update vertex data on GPU (upload new data to one buffer)
|
||||
void rlglUpdateMesh(Mesh mesh, int buffer, int numVertex)
|
||||
{
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
// Activate mesh VAO
|
||||
if (vaoSupported) glBindVertexArray(mesh.vaoId);
|
||||
|
||||
|
@ -1729,6 +1730,7 @@ void rlglUpdateMesh(Mesh mesh, int buffer, int numVertex)
|
|||
//mesh.vertices = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE);
|
||||
// Now we can modify vertices
|
||||
//glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Draw a 3d mesh with material and transform
|
||||
|
@ -2280,8 +2282,11 @@ void EndBlendMode(void)
|
|||
// Create a new light, initialize it and add to pool
|
||||
Light CreateLight(int type, Vector3 position, Color diffuse)
|
||||
{
|
||||
Light light = NULL;
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
// Allocate dynamic memory
|
||||
Light light = (Light)malloc(sizeof(LightData));
|
||||
light = (Light)malloc(sizeof(LightData));
|
||||
|
||||
// Initialize light values with generic values
|
||||
light->id = lightsCount;
|
||||
|
@ -2298,6 +2303,10 @@ Light CreateLight(int type, Vector3 position, Color diffuse)
|
|||
|
||||
// Increase enabled lights count
|
||||
lightsCount++;
|
||||
#else
|
||||
// TODO: Support OpenGL 1.1 lighting system
|
||||
TraceLog(WARNING, "Lighting currently not supported on OpenGL 1.1");
|
||||
#endif
|
||||
|
||||
return light;
|
||||
}
|
||||
|
@ -2305,6 +2314,7 @@ Light CreateLight(int type, Vector3 position, Color diffuse)
|
|||
// Destroy a light and take it out of the list
|
||||
void DestroyLight(Light light)
|
||||
{
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
// Free dynamic memory allocation
|
||||
free(lights[light->id]);
|
||||
|
||||
|
@ -2322,6 +2332,7 @@ void DestroyLight(Light light)
|
|||
|
||||
// Decrease enabled physic objects count
|
||||
lightsCount--;
|
||||
#endif
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
@ -1393,6 +1393,9 @@ void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, Co
|
|||
// Draw a part of a texture (defined by a rectangle) with 'pro' parameters
|
||||
// NOTE: origin is relative to destination rectangle size
|
||||
void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, Vector2 origin, float rotation, Color tint)
|
||||
{
|
||||
// Check if texture is valid
|
||||
if (texture.id != 0)
|
||||
{
|
||||
if (sourceRec.width < 0) sourceRec.x -= sourceRec.width;
|
||||
if (sourceRec.height < 0) sourceRec.y -= sourceRec.height;
|
||||
|
@ -1428,6 +1431,7 @@ void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, V
|
|||
|
||||
rlDisableTexture();
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module specific Functions Definition
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue