Don't use gl functions that are not available in core context.

Fixes some driver warnings.
This commit is contained in:
Deve 2017-09-12 23:49:35 +02:00
parent be4d0e7208
commit e615ff67d6
3 changed files with 13 additions and 5 deletions

View File

@ -809,7 +809,7 @@ bool COpenGLDriver::genericDriverInit()
u32 i; u32 i;
CurrentTexture.clear(); CurrentTexture.clear();
// load extensions // load extensions
initExtensions(Params.Stencilbuffer); initExtensions(Params.Stencilbuffer, useCoreContext);
if (queryFeature(EVDF_ARB_GLSL)) if (queryFeature(EVDF_ARB_GLSL))
{ {
char buf[32]; char buf[32];
@ -872,9 +872,11 @@ bool COpenGLDriver::genericDriverInit()
glClearDepth(1.0); glClearDepth(1.0);
if (!useCoreContext) if (!useCoreContext)
{
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glHint(GL_POINT_SMOOTH_HINT, GL_FASTEST); glHint(GL_POINT_SMOOTH_HINT, GL_FASTEST);
}
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glDepthFunc(GL_LEQUAL); glDepthFunc(GL_LEQUAL);
glFrontFace(GL_CW); glFrontFace(GL_CW);
// adjust flat coloring scheme to DirectX version // adjust flat coloring scheme to DirectX version

View File

@ -327,7 +327,7 @@ void COpenGLExtensionHandler::dumpFramebufferFormats() const
} }
void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) void COpenGLExtensionHandler::initExtensions(bool stencilBuffer, bool useCoreContext)
{ {
const f32 ogl_ver = core::fast_atof(reinterpret_cast<const c8*>(glGetString(GL_VERSION))); const f32 ogl_ver = core::fast_atof(reinterpret_cast<const c8*>(glGetString(GL_VERSION)));
Version = static_cast<u16>(core::floor32(ogl_ver)*100+core::round32(core::fract(ogl_ver)*10.0f)); Version = static_cast<u16>(core::floor32(ogl_ver)*100+core::round32(core::fract(ogl_ver)*10.0f));
@ -337,9 +337,15 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
os::Printer::log("OpenGL driver version is not 1.2 or better.", ELL_WARNING); os::Printer::log("OpenGL driver version is not 1.2 or better.", ELL_WARNING);
{ {
const char* t = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)); const char* t = NULL;
size_t len = 0; size_t len = 0;
c8 *str = 0; c8 *str = 0;
if (!useCoreContext)
{
t = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
}
if (t) if (t)
{ {
len = strlen(t); len = strlen(t);

View File

@ -924,7 +924,7 @@ class COpenGLExtensionHandler
COpenGLExtensionHandler(); COpenGLExtensionHandler();
// deferred initialization // deferred initialization
void initExtensions(bool stencilBuffer); void initExtensions(bool stencilBuffer, bool useCoreContext);
//! queries the features of the driver, returns true if feature is available //! queries the features of the driver, returns true if feature is available
bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const; bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const;