mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-27 21:48:31 +00:00
Corrected some issues on OpenGL 1.1
This commit is contained in:
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[5] = 0; // Vertex texcoords2 VBO
|
||||||
mesh->vboId[6] = 0; // Vertex indices VBO
|
mesh->vboId[6] = 0; // Vertex indices VBO
|
||||||
|
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
int drawHint = GL_STATIC_DRAW;
|
int drawHint = GL_STATIC_DRAW;
|
||||||
if (dynamic) drawHint = GL_DYNAMIC_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 vaoId = 0; // Vertex Array Objects (VAO)
|
||||||
GLuint vboId[7]; // Vertex Buffer Objects (VBOs)
|
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)
|
// Update vertex data on GPU (upload new data to one buffer)
|
||||||
void rlglUpdateMesh(Mesh mesh, int buffer, int numVertex)
|
void rlglUpdateMesh(Mesh mesh, int buffer, int numVertex)
|
||||||
{
|
{
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
// Activate mesh VAO
|
// Activate mesh VAO
|
||||||
if (vaoSupported) glBindVertexArray(mesh.vaoId);
|
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);
|
//mesh.vertices = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE);
|
||||||
// Now we can modify vertices
|
// Now we can modify vertices
|
||||||
//glUnmapBuffer(GL_ARRAY_BUFFER);
|
//glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a 3d mesh with material and transform
|
// 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
|
// Create a new light, initialize it and add to pool
|
||||||
Light CreateLight(int type, Vector3 position, Color diffuse)
|
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
|
// Allocate dynamic memory
|
||||||
Light light = (Light)malloc(sizeof(LightData));
|
light = (Light)malloc(sizeof(LightData));
|
||||||
|
|
||||||
// Initialize light values with generic values
|
// Initialize light values with generic values
|
||||||
light->id = lightsCount;
|
light->id = lightsCount;
|
||||||
@@ -2298,6 +2303,10 @@ Light CreateLight(int type, Vector3 position, Color diffuse)
|
|||||||
|
|
||||||
// Increase enabled lights count
|
// Increase enabled lights count
|
||||||
lightsCount++;
|
lightsCount++;
|
||||||
|
#else
|
||||||
|
// TODO: Support OpenGL 1.1 lighting system
|
||||||
|
TraceLog(WARNING, "Lighting currently not supported on OpenGL 1.1");
|
||||||
|
#endif
|
||||||
|
|
||||||
return light;
|
return light;
|
||||||
}
|
}
|
||||||
@@ -2305,6 +2314,7 @@ Light CreateLight(int type, Vector3 position, Color diffuse)
|
|||||||
// Destroy a light and take it out of the list
|
// Destroy a light and take it out of the list
|
||||||
void DestroyLight(Light light)
|
void DestroyLight(Light light)
|
||||||
{
|
{
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
// Free dynamic memory allocation
|
// Free dynamic memory allocation
|
||||||
free(lights[light->id]);
|
free(lights[light->id]);
|
||||||
|
|
||||||
@@ -2322,6 +2332,7 @@ void DestroyLight(Light light)
|
|||||||
|
|
||||||
// Decrease enabled physic objects count
|
// Decrease enabled physic objects count
|
||||||
lightsCount--;
|
lightsCount--;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@@ -1394,6 +1394,9 @@ void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, Co
|
|||||||
// NOTE: origin is relative to destination rectangle size
|
// NOTE: origin is relative to destination rectangle size
|
||||||
void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, Vector2 origin, float rotation, Color tint)
|
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.width < 0) sourceRec.x -= sourceRec.width;
|
||||||
if (sourceRec.height < 0) sourceRec.y -= sourceRec.height;
|
if (sourceRec.height < 0) sourceRec.y -= sourceRec.height;
|
||||||
|
|
||||||
@@ -1427,6 +1430,7 @@ void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, V
|
|||||||
rlPopMatrix();
|
rlPopMatrix();
|
||||||
|
|
||||||
rlDisableTexture();
|
rlDisableTexture();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user