graphics fixes

* zooming without real FBOs kinda works, but with lower quality
* hardware detection for glGenerateMipmaps
* possibility to disable bilinear filtering, mipmaps, framebuffers, and realtime mipmap generation in g_graphics
* otclient works well using 3D acceleration in VirtualBox again
* many fixes regarding FBOs fallback implementation
This commit is contained in:
Eduardo Bart
2012-03-21 09:41:43 -03:00
parent 01d5fad315
commit c7469e4454
11 changed files with 98 additions and 42 deletions

View File

@@ -30,22 +30,35 @@ Graphics g_graphics;
void Graphics::init()
{
logInfo("GPU ", glGetString(GL_RENDERER));
logInfo("OpenGL ", glGetString(GL_VERSION));
#ifndef OPENGL_ES2
// init GL extensions
GLenum err = glewInit();
if(err != GLEW_OK)
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_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.");
m_useFBO = GLEW_ARB_framebuffer_object;
m_useBilinearFiltering = true;
m_generateMipmaps = true;
m_generateHardwareMipmaps = m_useFBO; // glGenerateMipmap is supported when FBO is
m_generateRealtimeMipmaps = m_generateHardwareMipmaps;
#else
m_useFBO = true; // FBOs is always supported by mobile devices
m_useBilinearFiltering = true;
m_generateMipmaps = true;
m_generateHardwareMipmaps = true;
m_realtimeMipmapGeneration = false; // realtime mipmaps can be slow on mobile devices
#endif
glEnable(GL_BLEND);
logInfo("GPU ", glGetString(GL_RENDERER));
logInfo("OpenGL ", glGetString(GL_VERSION));
m_emptyTexture = TexturePtr(new Texture);
g_painter.init();
@@ -58,15 +71,6 @@ void Graphics::terminate()
m_emptyTexture.reset();
}
bool Graphics::hasFBO()
{
#ifndef OPENGL_ES2
return GLEW_ARB_framebuffer_object;
#else
return true;
#endif
}
void Graphics::resize(const Size& size)
{
setViewportSize(size);