Corrected bugs on OpenGL 2.1
This commit is contained in:
parent
4df7a0f2f8
commit
9fdf4420d5
3 changed files with 15 additions and 10 deletions
11
src/rlgl.c
11
src/rlgl.c
|
@ -1214,14 +1214,17 @@ void rlglInitGraphics(int offsetX, int offsetY, int width, int height)
|
|||
// NOTE: External loader function could be passed as a pointer
|
||||
void rlglLoadExtensions(void *loader)
|
||||
{
|
||||
#if defined(GRAPHICS_API_OPENGL_33)
|
||||
// NOTE: glad is generated and contains only required OpenGL 3.3 Core extensions
|
||||
#if defined(GRAPHICS_API_OPENGL_21) || defined(GRAPHICS_API_OPENGL_33)
|
||||
// NOTE: glad is generated and contains only required OpenGL 3.3 Core extensions (and lower versions)
|
||||
if (!gladLoadGLLoader((GLADloadproc)loader)) TraceLog(WARNING, "GLAD: Cannot load OpenGL extensions");
|
||||
else TraceLog(INFO, "GLAD: OpenGL extensions loaded successfully");
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_21)
|
||||
if (GLAD_GL_VERSION_2_1) TraceLog(INFO, "OpenGL 2.1 profile supported");
|
||||
else if(GLAD_GL_VERSION_3_3) TraceLog(INFO, "OpenGL 3.3 Core profile supported");
|
||||
#elif defined(GRAPHICS_API_OPENGL_33)
|
||||
if(GLAD_GL_VERSION_3_3) TraceLog(INFO, "OpenGL 3.3 Core profile supported");
|
||||
else TraceLog(ERROR, "OpenGL 3.3 Core profile not supported");
|
||||
#endif
|
||||
|
||||
// With GLAD, we can check if an extension is supported using the GLAD_GL_xxx booleans
|
||||
//if (GLAD_GL_ARB_vertex_array_object) // Use GL_ARB_vertex_array_object
|
||||
|
@ -2597,6 +2600,8 @@ void EndOculusDrawing(void)
|
|||
|
||||
// Blit mirror texture to back buffer
|
||||
BlitOculusMirror(session, mirror);
|
||||
|
||||
rlDisableDepthTest();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ void DrawCircleV(Vector2 center, float radius, Color color)
|
|||
}
|
||||
rlEnd();
|
||||
}
|
||||
else if ((rlGetVersion() == OPENGL_33) || (rlGetVersion() == OPENGL_ES_20))
|
||||
else if ((rlGetVersion() == OPENGL_21) || (rlGetVersion() == OPENGL_33) || (rlGetVersion() == OPENGL_ES_20))
|
||||
{
|
||||
rlEnableTexture(GetDefaultTexture().id); // Default white texture
|
||||
|
||||
|
@ -218,7 +218,7 @@ void DrawRectangleV(Vector2 position, Vector2 size, Color color)
|
|||
rlVertex2i(position.x + size.x, position.y);
|
||||
rlEnd();
|
||||
}
|
||||
else if ((rlGetVersion() == OPENGL_33) || (rlGetVersion() == OPENGL_ES_20))
|
||||
else if ((rlGetVersion() == OPENGL_21) || (rlGetVersion() == OPENGL_33) || (rlGetVersion() == OPENGL_ES_20))
|
||||
{
|
||||
rlEnableTexture(GetDefaultTexture().id); // Default white texture
|
||||
|
||||
|
@ -264,7 +264,7 @@ void DrawRectangleLines(int posX, int posY, int width, int height, Color color)
|
|||
rlVertex2i(posX + 1, posY + 1);
|
||||
rlEnd();
|
||||
}
|
||||
else if ((rlGetVersion() == OPENGL_33) || (rlGetVersion() == OPENGL_ES_20))
|
||||
else if ((rlGetVersion() == OPENGL_21) || (rlGetVersion() == OPENGL_33) || (rlGetVersion() == OPENGL_ES_20))
|
||||
{
|
||||
DrawRectangle(posX, posY, width, 1, color);
|
||||
DrawRectangle(posX + width - 1, posY + 1, 1, height - 2, color);
|
||||
|
|
|
@ -166,9 +166,9 @@ static const char fStandardShaderStr[] =
|
|||
" else if(lights[i].type == 2) lighting += CalcSpotLight(lights[i], n, v, spec);\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
#if defined(GRAPHICS_API_OPENGL_33)
|
||||
" finalColor = vec4(texelColor.rgb*lighting*colDiffuse.rgb, texelColor.a*colDiffuse.a); \n"
|
||||
#elif defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_21)
|
||||
#if defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_21)
|
||||
" gl_FragColor = vec4(texelColor.rgb*lighting*colDiffuse.rgb, texelColor.a*colDiffuse.a); \n"
|
||||
#elif defined(GRAPHICS_API_OPENGL_33)
|
||||
" finalColor = vec4(texelColor.rgb*lighting*colDiffuse.rgb, texelColor.a*colDiffuse.a); \n"
|
||||
#endif
|
||||
"}\n";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue