fixed OpenGL version checks and FBO support checks

This commit is contained in:
myT 2019-11-12 04:22:36 +01:00
parent 2dcddc87eb
commit cb0ef3aab8
3 changed files with 16 additions and 16 deletions

View file

@ -507,11 +507,8 @@ static qbool GL2_FBO_CreateMS( FrameBuffer& fb )
static qbool GL2_FBO_Init()
{
const int msaa = r_msaa->integer;
const qbool validOption = msaa >= 2 && msaa <= 16;
const qbool enable = validOption && GLEW_VERSION_3_0;
const qbool enable = msaa >= 2 && msaa <= 16;
frameBufferMultiSampling = enable;
if ( validOption && !enable )
ri.Printf( PRINT_WARNING, "MSAA requested but disabled because your OpenGL version doesn't support it\n" );
if ( !enable )
return GL2_FBO_CreateSS( frameBuffersPostProcess[0], qtrue ) &&
@ -1482,9 +1479,6 @@ static void InitGLInfo()
static void InitExtensions()
{
if ( !GLEW_VERSION_2_0 )
ri.Error( ERR_FATAL, "OpenGL 2.0 required!\n" );
GL2_Init();
}
@ -1550,6 +1544,10 @@ static qbool GAL_Init()
{
// the order of these calls can not be changed
Sys_V_Init( GAL_GL2 );
if ( !GLEW_VERSION_2_0 )
ri.Error( ERR_FATAL, "OpenGL 2.0 required!\n" );
if ( !GLEW_VERSION_3_0 && !GLEW_ARB_framebuffer_object )
ri.Error( ERR_FATAL, "Need at least OpenGL 3.0 or GL_ARB_framebuffer_object\n" );
InitGLConfig();
InitGLInfo();
InitExtensions();

View file

@ -1937,6 +1937,10 @@ static qbool GAL_Init()
{
// the order of these calls can not be changed
Sys_V_Init(GAL_GL3);
if(!GLEW_VERSION_3_2)
{
ri.Error(ERR_FATAL, "OpenGL 3.2 is required by the selected back-end!\n");
}
InitGLConfig();
InitGLInfo();
Init();
@ -1945,11 +1949,6 @@ static qbool GAL_Init()
r_swapInterval->modified = qtrue;
}
if(!GLEW_VERSION_3_2)
{
ri.Error(ERR_FATAL, "OpenGL 3.2 is required by the selected back-end!\n");
}
SetDefaultState();
const int err = glGetError();

View file

@ -296,10 +296,13 @@ static int GLW_MakeContext( PIXELFORMATDESCRIPTOR *pPFD )
}
ri.Printf( PRINT_DEVELOPER, "...GL context creation made current\n" );
PFNWGLCREATECONTEXTATTRIBSARBPROC const wglCreateContextAttribsARB =
(PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress( "wglCreateContextAttribsARB" );
if ( win_galId == GAL_GL3 && wglCreateContextAttribsARB )
if ( win_galId == GAL_GL3 )
{
PFNWGLCREATECONTEXTATTRIBSARBPROC const wglCreateContextAttribsARB =
(PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress( "wglCreateContextAttribsARB" );
if( wglCreateContextAttribsARB == NULL )
ri.Error( ERR_FATAL, "wglCreateContextAttribsARB not found: can't ask for core 3.2 context\n" );
const int attribs[] =
{
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
@ -309,7 +312,7 @@ static int GLW_MakeContext( PIXELFORMATDESCRIPTOR *pPFD )
0
};
const HGLRC hGLRC = wglCreateContextAttribsARB( glw_state.hDC, NULL, attribs );
const HGLRC hGLRC = (*wglCreateContextAttribsARB)( glw_state.hDC, NULL, attribs );
if ( hGLRC )
{
wglMakeCurrent( NULL, NULL );