mirror of
https://github.com/edubart/otclient.git
synced 2025-12-14 12:49:47 +01:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user