Browse Source

Solved issues when compiled for OpenGL 1.1

pull/1381/head
raysan5 4 years ago
parent
commit
0983d7b45c
1 changed files with 11 additions and 5 deletions
  1. +11
    -5
      src/rlgl.h

+ 11
- 5
src/rlgl.h View File

@ -1765,11 +1765,7 @@ void rlglInit(int width, int height)
glShadeModel(GL_SMOOTH); // Smooth shading between vertex (vertex colors interpolation) glShadeModel(GL_SMOOTH); // Smooth shading between vertex (vertex colors interpolation)
#endif #endif
// Init state: Color/Depth buffers clear
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Set clear color (black)
glClearDepth(1.0f); // Set clear depth value (default)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear color and depth buffers (depth buffer required for 3D)
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
// Store screen size into global variables // Store screen size into global variables
RLGL.State.framebufferWidth = width; RLGL.State.framebufferWidth = width;
RLGL.State.framebufferHeight = height; RLGL.State.framebufferHeight = height;
@ -1779,6 +1775,12 @@ void rlglInit(int width, int height)
RLGL.State.shapesTextureRec = (Rectangle){ 0.0f, 0.0f, 1.0f, 1.0f }; RLGL.State.shapesTextureRec = (Rectangle){ 0.0f, 0.0f, 1.0f, 1.0f };
TRACELOG(LOG_INFO, "RLGL: Default state initialized successfully"); TRACELOG(LOG_INFO, "RLGL: Default state initialized successfully");
#endif
// Init state: Color/Depth buffers clear
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Set clear color (black)
glClearDepth(1.0f); // Set clear depth value (default)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear color and depth buffers (depth buffer required for 3D)
} }
// Vertex Buffer Object deinitialization (memory free) // Vertex Buffer Object deinitialization (memory free)
@ -1880,9 +1882,11 @@ void rlSetDebugMarker(const char *text)
// Set blending mode factor and equation // Set blending mode factor and equation
void rlSetBlendMode(int glSrcFactor, int glDstFactor, int glEquation) void rlSetBlendMode(int glSrcFactor, int glDstFactor, int glEquation)
{ {
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
RLGL.State.glBlendSrcFactor = glSrcFactor; RLGL.State.glBlendSrcFactor = glSrcFactor;
RLGL.State.glBlendDstFactor = glDstFactor; RLGL.State.glBlendDstFactor = glDstFactor;
RLGL.State.glBlendEquation = glEquation; RLGL.State.glBlendEquation = glEquation;
#endif
} }
// Load OpenGL extensions // Load OpenGL extensions
@ -3604,6 +3608,7 @@ Texture2D GenTextureBRDF(Shader shader, int size)
// NOTE: Only 3 blending modes supported, default blend mode is alpha // NOTE: Only 3 blending modes supported, default blend mode is alpha
void BeginBlendMode(int mode) void BeginBlendMode(int mode)
{ {
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
if (RLGL.State.currentBlendMode != mode) if (RLGL.State.currentBlendMode != mode)
{ {
rlglDraw(); rlglDraw();
@ -3621,6 +3626,7 @@ void BeginBlendMode(int mode)
RLGL.State.currentBlendMode = mode; RLGL.State.currentBlendMode = mode;
} }
#endif
} }
// End blending mode (reset to default: alpha blending) // End blending mode (reset to default: alpha blending)

Loading…
Cancel
Save