From fac83ef010a00890019d65eaa11ac1f4c4060e03 Mon Sep 17 00:00:00 2001 From: iann Date: Wed, 24 Sep 2025 11:35:07 +0900 Subject: [PATCH] gate with OPENGL_11 prototype and definition for rlSetPointSize and rlGetPointSize --- src/rlgl.h | 16 ++++++++++++++++ src/rmodels.c | 16 ++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/rlgl.h b/src/rlgl.h index 7db05251d..f99716236 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -686,6 +686,10 @@ RLAPI void rlDisableScissorTest(void); // Disable scissor test RLAPI void rlScissor(int x, int y, int width, int height); // Scissor test RLAPI void rlEnablePointMode(void); // Enable point mode RLAPI void rlDisablePointMode(void); // Disable point mode +#if defined(GRAPHICS_API_OPENGL_11) +RLAPI void rlSetPointSize(float size); // Set the point drawing size +RLAPI float rlGetPointSize(void); // Get the point drawing size +#endif RLAPI void rlEnableWireMode(void); // Enable wire mode RLAPI void rlDisableWireMode(void); // Disable wire mode RLAPI void rlSetLineWidth(float width); // Set the line drawing width @@ -2016,6 +2020,18 @@ float rlGetLineWidth(void) return width; } +#if defined(GRAPHICS_API_OPENGL_11) +// Set the point drawing size +void rlSetPointSize(float size) { glPointSize(size); } + +// Get the point drawing size +float rlGetPointSize(void) +{ + float size = 0; + glGetFloatv(GL_POINT_SIZE, &size); + return size; +} +#endif // Enable line aliasing void rlEnableSmoothLines(void) { diff --git a/src/rmodels.c b/src/rmodels.c index 9aca37a24..b9feb4533 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -1436,7 +1436,7 @@ void DrawMesh(Mesh mesh, Material material, Matrix transform) if (mesh.animNormals) rlEnableStatePointer(GL_NORMAL_ARRAY, mesh.animNormals); else rlEnableStatePointer(GL_NORMAL_ARRAY, mesh.normals); - rlEnableStatePointer(GL_COLOR_ARRAY, mesh.colors); + if (mesh.colors) rlEnableStatePointer(GL_COLOR_ARRAY, mesh.colors); rlPushMatrix(); rlMultMatrixf(MatrixToFloat(transform)); @@ -1452,7 +1452,7 @@ void DrawMesh(Mesh mesh, Material material, Matrix transform) rlDisableStatePointer(GL_VERTEX_ARRAY); rlDisableStatePointer(GL_TEXTURE_COORD_ARRAY); rlDisableStatePointer(GL_NORMAL_ARRAY); - rlDisableStatePointer(GL_COLOR_ARRAY); + if (mesh.colors) rlDisableStatePointer(GL_COLOR_ARRAY); rlDisableTexture(); #endif @@ -4420,7 +4420,11 @@ static Model LoadOBJ(const char *fileName) model.meshes[i].vertices = (float *)MemAlloc(sizeof(float)*vertexCount*3); model.meshes[i].normals = (float *)MemAlloc(sizeof(float)*vertexCount*3); model.meshes[i].texcoords = (float *)MemAlloc(sizeof(float)*vertexCount*2); - model.meshes[i].colors = (unsigned char *)MemAlloc(sizeof(unsigned char)*vertexCount*4); + #if defined(GRAPHICS_API_OPENGL_11) + model.meshes[i].colors = NULL; + #else + model.meshes[i].colors = (unsigned char *)MemAlloc(sizeof(unsigned char)*vertexCount*4); + #endif } MemFree(localMeshVertexCounts); @@ -4487,9 +4491,9 @@ static Model LoadOBJ(const char *fileName) } model.meshes[meshIndex].texcoords[localMeshVertexCount*2 + 1] = 1.0f - model.meshes[meshIndex].texcoords[localMeshVertexCount*2 + 1]; - - for (int i = 0; i < 4; i++) model.meshes[meshIndex].colors[localMeshVertexCount*4 + i] = 255; - + #if !defined(GRAPHICS_API_OPENGL_11) + for (int i = 0; i < 4; i++) model.meshes[meshIndex].colors[localMeshVertexCount*4 + i] = 255; + #endif faceVertIndex++; localMeshVertexCount++; }