mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-25 10:22:33 -05:00
REVIEWED: New Win32 platform backend to accomodate rlsw Software Renderer
This commit is contained in:
File diff suppressed because it is too large
Load Diff
33
src/rlgl.h
33
src/rlgl.h
@ -2329,6 +2329,16 @@ void rlglInit(int width, int height)
|
|||||||
RLGL.State.currentMatrix = &RLGL.State.modelview;
|
RLGL.State.currentMatrix = &RLGL.State.modelview;
|
||||||
#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2
|
#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2
|
||||||
|
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
|
// Initialize software renderer backend
|
||||||
|
int result = swInit(width, height);
|
||||||
|
if (result == 0)
|
||||||
|
{
|
||||||
|
TRACELOG(RL_LOG_ERROR, "RLSW: Software renderer initialization failed!");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Initialize OpenGL default states
|
// Initialize OpenGL default states
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
// Init state: Depth test
|
// Init state: Depth test
|
||||||
@ -2345,39 +2355,28 @@ void rlglInit(int width, int height)
|
|||||||
glFrontFace(GL_CCW); // Front face are defined counter clockwise (default)
|
glFrontFace(GL_CCW); // Front face are defined counter clockwise (default)
|
||||||
glEnable(GL_CULL_FACE); // Enable backface culling
|
glEnable(GL_CULL_FACE); // Enable backface culling
|
||||||
|
|
||||||
// Init state: Cubemap seamless
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_33)
|
|
||||||
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); // Seamless cubemaps (not supported on OpenGL ES 2.0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_11)
|
#if defined(GRAPHICS_API_OPENGL_11)
|
||||||
// Init state: Color hints (deprecated in OpenGL 3.0+)
|
// Init state: Color hints (deprecated in OpenGL 3.0+)
|
||||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Improve quality of color and texture coordinate interpolation
|
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Improve quality of color and texture coordinate interpolation
|
||||||
glShadeModel(GL_SMOOTH); // Smooth shading between vertex (vertex colors interpolation)
|
glShadeModel(GL_SMOOTH); // Smooth shading between vertex (vertex colors interpolation)
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_33)
|
||||||
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
// Init state: Cubemap seamless
|
||||||
int result = swInit(width, height); // Initialize software renderer backend
|
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); // Seamless cubemaps (not supported on OpenGL ES 2.0)
|
||||||
if (result == 0)
|
|
||||||
{
|
|
||||||
TRACELOG(RL_LOG_ERROR, "RLSW: Software renderer initialization failed!");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
#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;
|
||||||
|
|
||||||
TRACELOG(RL_LOG_INFO, "RLGL: Default OpenGL state initialized successfully");
|
|
||||||
//----------------------------------------------------------
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Init state: Color/Depth buffers clear
|
// Init state: Color/Depth buffers clear
|
||||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Set clear color (black)
|
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Set clear color (black)
|
||||||
glClearDepth(1.0f); // Set clear depth value (default)
|
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)
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear color and depth buffers (depth buffer required for 3D)
|
||||||
|
|
||||||
|
TRACELOG(RL_LOG_INFO, "RLGL: Default OpenGL state initialized successfully");
|
||||||
|
//----------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vertex Buffer Object deinitialization (memory free)
|
// Vertex Buffer Object deinitialization (memory free)
|
||||||
|
|||||||
Reference in New Issue
Block a user