aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-05-02 12:37:17 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-05-02 12:37:17 +0000
commit97b5f227669651bc71328296e95df386a31ddf7b (patch)
treee3807571db7468ff3ac716fbad6cf74d974292d4 /Game/Code/Classes
parentff5d59edfcccefe52285091937d1a3337fb38694 (diff)
downloadusdx-97b5f227669651bc71328296e95df386a31ddf7b.tar.gz
usdx-97b5f227669651bc71328296e95df386a31ddf7b.tar.xz
usdx-97b5f227669651bc71328296e95df386a31ddf7b.zip
Replaced OpenGL12 with SDL's gl/glu/glext units because OpenGL12 was removed from SDL (several years ago? Last update was done in 2004). In addition OpenGL12 was very buggy (see last commit). The new units support OpenGL up to version 2.0 (extensions must be loaded first, see UGraphic.LoadOpenGLExtensions). At the moment, only 1.2 extensions are loaded. Some constants, that were introduced in OpenGL 1.2 and above (like GL_BGR or GL_CLAMP_TO_EDGE) are in glext.pas, so check this file first for missing constants.
The MacOS build depends on OpenGL12.pas but has its own file in the MacOSX/Wrapper folder instead of using the JEDI-SDL one. Sorry, that I broke MacOSX build for now but it should be no problem to get this working again. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1052 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--Game/Code/Classes/TextGL.pas2
-rw-r--r--Game/Code/Classes/UCovers.pas2
-rw-r--r--Game/Code/Classes/UDraw.pas2
-rw-r--r--Game/Code/Classes/UGraphic.pas28
-rw-r--r--Game/Code/Classes/UGraphicClasses.pas2
-rw-r--r--Game/Code/Classes/ULyrics.pas10
-rw-r--r--Game/Code/Classes/ULyrics_bak.pas2
-rw-r--r--Game/Code/Classes/UMain.pas3
-rw-r--r--Game/Code/Classes/USingScores.pas2
-rw-r--r--Game/Code/Classes/UTextClasses.pas13
-rw-r--r--Game/Code/Classes/UTexture.pas21
-rw-r--r--Game/Code/Classes/UVideo.pas2
-rw-r--r--Game/Code/Classes/UVisualizer.pas2
13 files changed, 56 insertions, 35 deletions
diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas
index 5b37228e..5b114669 100644
--- a/Game/Code/Classes/TextGL.pas
+++ b/Game/Code/Classes/TextGL.pas
@@ -13,7 +13,7 @@ interface
{$ENDIF}
uses
- OpenGL12,
+ gl,
SDL,
UTexture,
Classes,
diff --git a/Game/Code/Classes/UCovers.pas b/Game/Code/Classes/UCovers.pas
index 0e9ad689..478264b9 100644
--- a/Game/Code/Classes/UCovers.pas
+++ b/Game/Code/Classes/UCovers.pas
@@ -8,7 +8,7 @@ interface
{$I switches.inc}
-uses OpenGL12,
+uses gl,
{$IFDEF win32}
windows,
{$ENDIF}
diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas
index 679c6df1..53508baf 100644
--- a/Game/Code/Classes/UDraw.pas
+++ b/Game/Code/Classes/UDraw.pas
@@ -60,7 +60,7 @@ const
implementation
uses
- OpenGL12,
+ gl,
UGraphic,
SysUtils,
UMusic,
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);
diff --git a/Game/Code/Classes/UGraphicClasses.pas b/Game/Code/Classes/UGraphicClasses.pas
index 629a92e5..b7792cc1 100644
--- a/Game/Code/Classes/UGraphicClasses.pas
+++ b/Game/Code/Classes/UGraphicClasses.pas
@@ -89,7 +89,7 @@ var GoldenRec : TEffectManager;
implementation
uses sysutils,
- OpenGl12,
+ gl,
UIni,
UMain,
UThemes,
diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas
index b11b39e2..38bc1e7a 100644
--- a/Game/Code/Classes/ULyrics.pas
+++ b/Game/Code/Classes/ULyrics.pas
@@ -8,10 +8,12 @@ interface
{$I switches.inc}
-uses OpenGL12,
- UTexture,
- UThemes,
- UMusic;
+uses
+ gl,
+ glext,
+ UTexture,
+ UThemes,
+ UMusic;
type
TLyricWord = record
diff --git a/Game/Code/Classes/ULyrics_bak.pas b/Game/Code/Classes/ULyrics_bak.pas
index c4ce0e1b..c99b846f 100644
--- a/Game/Code/Classes/ULyrics_bak.pas
+++ b/Game/Code/Classes/ULyrics_bak.pas
@@ -9,7 +9,7 @@ interface
{$I switches.inc}
uses SysUtils,
- OpenGL12,
+ gl,
UMusic,
UTexture;
diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas
index c9eacfdd..52f78ae9 100644
--- a/Game/Code/Classes/UMain.pas
+++ b/Game/Code/Classes/UMain.pas
@@ -21,7 +21,7 @@ uses
ULyrics,
UScreenSing,
USong,
- OpenGL12,
+ gl,
UThemes;
type
@@ -352,7 +352,6 @@ begin
// call an uninitialize routine for every initialize step
// or at least use the corresponding Free-Methods
- UnloadOpenGL;
//TTF_quit();
SDL_Quit();
diff --git a/Game/Code/Classes/USingScores.pas b/Game/Code/Classes/USingScores.pas
index 56d2cd69..07ef2e40 100644
--- a/Game/Code/Classes/USingScores.pas
+++ b/Game/Code/Classes/USingScores.pas
@@ -9,7 +9,7 @@ interface
{$I switches.inc}
uses UThemes,
- OpenGl12,
+ gl,
UTexture;
//////////////////////////////////////////////////////////////
diff --git a/Game/Code/Classes/UTextClasses.pas b/Game/Code/Classes/UTextClasses.pas
index 42c206a9..9dce207e 100644
--- a/Game/Code/Classes/UTextClasses.pas
+++ b/Game/Code/Classes/UTextClasses.pas
@@ -4,12 +4,13 @@ interface
{$I switches.inc}
-uses OpenGL12,
- SDL,
- UTexture,
- Classes,
- SDL_ttf,
- ULog;
+uses
+ gl,
+ SDL,
+ UTexture,
+ Classes,
+ SDL_ttf,
+ ULog;
{
// okay i just outline what should be here, so we can create a nice and clean implementation of sdl_ttf
diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas
index b88300d4..148d5514 100644
--- a/Game/Code/Classes/UTexture.pas
+++ b/Game/Code/Classes/UTexture.pas
@@ -10,15 +10,18 @@ interface
{$I switches.inc}
-uses OpenGL12,
- Math,
- Classes,
- SysUtils,
- UCommon,
- UImage,
- SDL,
- sdlutils,
- SDL_Image;
+uses
+ gl,
+ glu,
+ glext,
+ Math,
+ Classes,
+ SysUtils,
+ UCommon,
+ UImage,
+ SDL,
+ sdlutils,
+ SDL_Image;
type
TTexture = record
diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas
index 55f710f1..f0f710a2 100644
--- a/Game/Code/Classes/UVideo.pas
+++ b/Game/Code/Classes/UVideo.pas
@@ -41,7 +41,7 @@ uses SDL,
swscale,
{$ENDIF}
math,
- OpenGL12,
+ gl,
SysUtils,
{$ifdef DebugDisplay}
{$ifdef win32}
diff --git a/Game/Code/Classes/UVisualizer.pas b/Game/Code/Classes/UVisualizer.pas
index 906ade65..de117f20 100644
--- a/Game/Code/Classes/UVisualizer.pas
+++ b/Game/Code/Classes/UVisualizer.pas
@@ -21,7 +21,7 @@ uses
UGraphicClasses,
textgl,
math,
- OpenGL12,
+ gl,
SysUtils,
UIni,
projectM,