diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-07-12 16:58:23 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-07-12 16:58:23 +0000 |
commit | e02e467681726fbe5e7c32a0970ea6c4b8eb94fc (patch) | |
tree | 1ec886447fc2c4d620e47b52546cd57860df9a25 /Game/Code/Classes | |
parent | 06dd168485ab960930c907976e242b28c6a621ff (diff) | |
download | usdx-e02e467681726fbe5e7c32a0970ea6c4b8eb94fc.tar.gz usdx-e02e467681726fbe5e7c32a0970ea6c4b8eb94fc.tar.xz usdx-e02e467681726fbe5e7c32a0970ea6c4b8eb94fc.zip |
- cleanup/comments for TDisplay.Create
- fading works now, it was broken because RenderW/H was not defined when SwapBuffers() was called for the first time. This caused glOrtho() to set the OpenGL error state. When fading was initialized in UDisplay this error-state was checked to see if glGenTextures failed. Although it didn't the error state was set because of the older error in glOrtho (Note: errors aren't reset after a successful OpenGL call), so it was wrongly assumed that no texture could be allocated.
This problem was fixed by defining RenderW/H before the first call of SwapBuffers and resetting OpenGL's error state before calling an OpenGL function whose error state is to be checked.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1188 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | Game/Code/Classes/UGraphic.pas | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index ae145955..fdc7fca0 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -442,6 +442,8 @@ begin //Log.BenchmarkStart(2); Texture := TTextureUnit.Create; + // FIXME: this does not seem to be correct as Limit is the max. of either + // width or height. Texture.Limit := 1024*1024; //LoadTextures; @@ -573,29 +575,14 @@ begin W := StrToInt(Copy(S, 1, I-1)) * Screens; H := StrToInt(Copy(S, I+1, 1000)); - {if ParamStr(1) = '-fsblack' then begin - W := 800; - H := 600; - end; - if ParamStr(1) = '-320x240' then begin - W := 320; - H := 240; - end; } - - If (Params.Depth <> -1) then + if (Params.Depth <> -1) then Depth := Params.Depth else Depth := Ini.Depth; Log.LogStatus('SDL_SetVideoMode', 'Initialize3D'); - //SDL_SetRefreshrate(85); //SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); - {$IFDEF DARWIN} - // Todo : eddie: remove before realease - Ini.FullScreen := 0; - {$ENDIF} - if (Ini.FullScreen = 0) and (Not Params.FullScreen) then begin Log.LogStatus('SDL_SetVideoMode', 'Set Video Mode... Windowed'); @@ -607,7 +594,7 @@ begin screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN ); SDL_ShowCursor(0); end; - + if (screen = nil) then begin Log.LogError('SDL_SetVideoMode Failed', 'Initialize3D'); @@ -616,16 +603,17 @@ begin LoadOpenGLExtensions(); - // clear screen once window is being shown - glClearColor(1, 1, 1, 1); - glClear(GL_COLOR_BUFFER_BIT); - SwapBuffers; - - // zmienne + // define virtual (Render) and real (Screen) screen size RenderW := 800; RenderH := 600; ScreenW := W; ScreenH := H; + + // clear screen once window is being shown + // Note: SwapBuffers uses RenderW/H, so they must be defined before + glClearColor(1, 1, 1, 1); + glClear(GL_COLOR_BUFFER_BIT); + SwapBuffers; end; procedure LoadLoadingScreen; |