aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UGraphic.pas
diff options
context:
space:
mode:
Diffstat (limited to 'Game/Code/Classes/UGraphic.pas')
-rw-r--r--Game/Code/Classes/UGraphic.pas28
1 files changed, 22 insertions, 6 deletions
diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas
index cc34b18d..0be862c7 100644
--- a/Game/Code/Classes/UGraphic.pas
+++ b/Game/Code/Classes/UGraphic.pas
@@ -10,7 +10,8 @@ interface
uses
SDL,
- OpenGL12,
+ gl,
+ glext,
UTexture,
TextGL,
ULog,
@@ -397,15 +398,26 @@ begin
Log.LogStatus('Loading Textures - Done', 'LoadTextures');
end;
+(*
+ * Load OpenGL extensions. Must be called after SDL_SetVideoMode() and each
+ * time the pixel-format or render-context (RC) changes.
+ *)
+procedure LoadOpenGLExtensions;
+begin
+ // Load OpenGL 1.2 extensions for OpenGL 1.2 compatibility
+ if (not Load_GL_version_1_2()) then
+ begin
+ Log.LogCritical('Failed loading OpenGL 1.2', 'UGraphic.Initialize3D');
+ end;
+
+ // Other extensions e.g. OpenGL 1.3-2.0 or Framebuffer-Object might be loaded here
+ // ...
+end;
+
procedure Initialize3D (Title: string);
var
Icon: PSDL_Surface;
begin
- Log.LogStatus('LoadOpenGL', 'UGraphic.Initialize3D');
- //Log.BenchmarkStart(2);
-
- LoadOpenGL;
-
Log.LogStatus('SDL_Init', 'UGraphic.Initialize3D');
if ( SDL_InitSubSystem(SDL_INIT_VIDEO) = -1 ) then
begin
@@ -420,6 +432,8 @@ begin
SDL_WM_SetCaption(PChar(Title), nil);
+ //Log.BenchmarkStart(2);
+
InitializeScreen;
//Log.BenchmarkEnd(2);
@@ -592,6 +606,8 @@ begin
exit;
end;
+ LoadOpenGLExtensions();
+
// clear screen once window is being shown
glClearColor(1, 1, 1, 1);
glClear(GL_COLOR_BUFFER_BIT);