support for OpenGL 2.0

* use OpenGL 2.0 auxiliary buffers when FBO is not supported, thus this means that OpenGL 3 is not a requirement anymore, so otclient might work in older video cards
* map zooming will never work well with Opengl 2.0 because of glCopyTexSubImage2D limitation
This commit is contained in:
Eduardo Bart
2012-03-20 19:26:07 -03:00
parent 5c35938a92
commit 01d5fad315
5 changed files with 78 additions and 26 deletions

View File

@@ -37,9 +37,8 @@ void Graphics::init()
logFatal("Unable to init GLEW: ", glewGetErrorString(err));
if(!GLEW_ARB_vertex_program || !GLEW_ARB_vertex_shader ||
!GLEW_ARB_fragment_program || !GLEW_ARB_fragment_shader ||
!GLEW_ARB_framebuffer_object ||
!GLEW_ARB_multitexture)
logFatal("Your video driver is not supported");
!GLEW_ARB_texture_non_power_of_two || !GLEW_ARB_multitexture)
logFatal("Some OpenGL 2.0 extensions is not supported by your system graphics, please try updating your video drivers or buy a new hardware.");
#endif
glEnable(GL_BLEND);
@@ -59,11 +58,13 @@ void Graphics::terminate()
m_emptyTexture.reset();
}
bool Graphics::isExtensionSupported(const char *extension)
bool Graphics::hasFBO()
{
std::string extensionsString = (const char*)glGetString(GL_EXTENSIONS);
auto extensions = Fw::split(extensionsString);
return std::find(extensions.begin(), extensions.end(), extension) != extensions.end();
#ifndef OPENGL_ES2
return GLEW_ARB_framebuffer_object;
#else
return true;
#endif
}
void Graphics::resize(const Size& size)