update extension usage..
nearly all of the previous required extensions are CORE in OpenGL 2.0 the remaining ones need to have fallback checks for ARB vs EXT vs APPLE variants..
This commit is contained in:
parent
27ae261d0e
commit
eacc143ea0
5 changed files with 76 additions and 37 deletions
src
63
src/main.cpp
63
src/main.cpp
|
@ -39,21 +39,11 @@
|
|||
|
||||
static const char *reqExt[] =
|
||||
{
|
||||
"GL_ARB_fragment_shader",
|
||||
"GL_ARB_shader_objects",
|
||||
"GL_ARB_vertex_shader",
|
||||
"GL_ARB_shading_language_100",
|
||||
"GL_ARB_texture_non_power_of_two",
|
||||
"GL_ARB_vertex_array_object",
|
||||
"GL_ARB_vertex_buffer_object",
|
||||
"GL_EXT_bgra",
|
||||
"GL_EXT_blend_func_separate",
|
||||
"GL_EXT_blend_subtract",
|
||||
"GL_EXT_framebuffer_object",
|
||||
"GL_EXT_framebuffer_blit",
|
||||
// Everything we are using is CORE in OpenGL 2.0 except FBOs and VAOs which we'll handle in a special function
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
rgssThreadError(RGSSThreadData *rtData, const std::string &msg)
|
||||
{
|
||||
|
@ -77,6 +67,50 @@ printGLInfo()
|
|||
Debug() << "GLSL Version :" << glGetStringInt(GL_SHADING_LANGUAGE_VERSION);
|
||||
}
|
||||
|
||||
static bool
|
||||
setupOptionalGLExtensions(RGSSThreadData* threadData)
|
||||
{
|
||||
if (!GLEW_ARB_framebuffer_object) {
|
||||
if (!GLEW_EXT_framebuffer_object && !GLEW_EXT_framebuffer_blit) {
|
||||
rgssThreadError(threadData, "GL extensions \"GL_ARB_framebuffer_object\" or compatible extensiosns GL_EXT_framebuffer_object and GL_EXT_framebuffer_blit are not present");
|
||||
return false;
|
||||
} else {
|
||||
// setup compat
|
||||
// From EXT_framebuffer_object
|
||||
glGenRenderbuffers = glGenRenderbuffersEXT;
|
||||
glDeleteRenderbuffers = glDeleteRenderbuffersEXT;
|
||||
glBindRenderbuffer = glBindRenderbufferEXT;
|
||||
glRenderbufferStorage = glRenderbufferStorageEXT;
|
||||
|
||||
glGenFramebuffers = glGenFramebuffersEXT;
|
||||
glDeleteFramebuffers = glDeleteFramebuffersEXT;
|
||||
glBindFramebuffer = glBindFramebufferEXT;
|
||||
glFramebufferTexture2D = glFramebufferTexture2DEXT;
|
||||
glFramebufferRenderbuffer = glFramebufferRenderbufferEXT;
|
||||
|
||||
// From EXT_framebuffer_blit
|
||||
glBlitFramebuffer = glBlitFramebufferEXT;
|
||||
}
|
||||
}
|
||||
if (!GLEW_ARB_timer_query && GLEW_EXT_timer_query) {
|
||||
glGetQueryObjecti64v = glGetQueryObjecti64vEXT;
|
||||
glGetQueryObjectui64v = glGetQueryObjectui64vEXT;
|
||||
}
|
||||
if (!GLEW_ARB_vertex_array_object ) {
|
||||
if (!GLEW_APPLE_vertex_array_object) {
|
||||
rgssThreadError(threadData, "GL extensions \"GL_ARB_vertex_array_object\" or compatible extensiosn GL_APPLE_vertex_array_object are not present");
|
||||
return false;
|
||||
} else {
|
||||
// setup compat
|
||||
glBindVertexArray = glBindVertexArrayAPPLE;
|
||||
// the cast is because apple's uses const GLuint* and ARB doesn't
|
||||
glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)glGenVertexArraysAPPLE;
|
||||
glDeleteVertexArrays = glDeleteVertexArraysAPPLE;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int rgssThreadFun(void *userdata)
|
||||
{
|
||||
RGSSThreadData *threadData = static_cast<RGSSThreadData*>(userdata);
|
||||
|
@ -132,6 +166,11 @@ int rgssThreadFun(void *userdata)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
/* Setup optional GL extensions */
|
||||
if (!setupOptionalGLExtensions(threadData)) {
|
||||
SDL_GL_DeleteContext(glCtx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDL_GL_SetSwapInterval(threadData->config.vsync ? 1 : 0);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue