1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
Description: Fix SDL2 initialistion
SDL_GL_* should only be called after the window created.
Also, SDL_GL_MakeCurrent seems necessary.
Author: Tobias Frost <tobi@debian.org>
Forwarded: https://github.com/RobertBeckeba06/RBDOOM-3-BFG/issues/205
Forwarded: https://github.com/RobertBeckebans/RBDOOM-3-BFG/pull/251
Last-Update: 2014-12-06
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/neo/sys/sdl/sdl_glimp.cpp
+++ b/neo/sys/sdl/sdl_glimp.cpp
@@ -49,15 +49,7 @@
idCVar r_waylandcompat( "r_waylandcompat", "0", CVAR_SYSTEM | CVAR_NOCHEAT | CVAR_ARCHIVE, "wayland compatible framebuffer" );
// RB: only relevant if using SDL 2.0
-#if defined(__APPLE__)
-// only core profile is supported on OS X
-idCVar r_useOpenGL32( "r_useOpenGL32", "2", CVAR_INTEGER, "0 = OpenGL 3.x, 1 = OpenGL 3.2 compatibility profile, 2 = OpenGL 3.2 core profile", 0, 2 );
-#elif defined(__linux__)
-// Linux open source drivers suck
-idCVar r_useOpenGL32( "r_useOpenGL32", "0", CVAR_INTEGER, "0 = OpenGL 3.x, 1 = OpenGL 3.2 compatibility profile, 2 = OpenGL 3.2 core profile", 0, 2 );
-#else
-idCVar r_useOpenGL32( "r_useOpenGL32", "1", CVAR_INTEGER, "0 = OpenGL 3.x, 1 = OpenGL 3.2 compatibility profile, 2 = OpenGL 3.2 core profile", 0, 2 );
-#endif
+idCVar r_useOpenGL32( "r_useOpenGL32", "1", CVAR_INTEGER, "0 = OpenGL 2.0, 1 = OpenGL 3.2 compatibility profile, 2 = OpenGL 3.2 core profile", 0, 2 );
// RB end
static bool grabbed = false;
@@ -195,28 +187,6 @@
#if SDL_VERSION_ATLEAST(2, 0, 0)
- // RB begin
- if( r_useOpenGL32.GetInteger() > 0 )
- {
- glConfig.driverType = GLDRV_OPENGL32_COMPATIBILITY_PROFILE;
-
- SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
- SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 2 );
-
- if( r_debugContext.GetBool() )
- {
- SDL_GL_SetAttribute( SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG );
- }
- }
-
- if( r_useOpenGL32.GetInteger() > 1 )
- {
- glConfig.driverType = GLDRV_OPENGL32_CORE_PROFILE;
-
- SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );
- }
- // RB end
-
// DG: set display num for fullscreen
int windowPos = SDL_WINDOWPOS_UNDEFINED;
if( parms.fullScreen > 0 )
@@ -246,8 +216,6 @@
parms.width, parms.height, flags );
// DG end
- context = SDL_GL_CreateContext( window );
-
if( !window )
{
common->DPrintf( "Couldn't set GL mode %d/%d/%d: %s",
@@ -255,6 +223,31 @@
continue;
}
+ context = SDL_GL_CreateContext( window );
+ SDL_GL_MakeCurrent(window, context);
+
+ // RB begin
+ if( r_useOpenGL32.GetInteger() > 0 )
+ {
+ glConfig.driverType = GLDRV_OPENGL32_COMPATIBILITY_PROFILE;
+
+ SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
+ SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 2 );
+
+ if( r_debugContext.GetBool() )
+ {
+ SDL_GL_SetAttribute( SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG );
+ }
+ }
+
+ if( r_useOpenGL32.GetInteger() > 1 )
+ {
+ glConfig.driverType = GLDRV_OPENGL32_CORE_PROFILE;
+
+ SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );
+ }
+ // RB end
+
if( SDL_GL_SetSwapInterval( r_swapInterval.GetInteger() ) < 0 )
common->Warning( "SDL_GL_SWAP_CONTROL not supported" );
|