[…]
Although I am not sure of the difference between SDL_HWSURFACE and
SDL_SWSURFACE. If it is SDL_SWSURFACE, then it is only in memory and
not visible?
Well, sort of; if it’s a s/w surface, it’s in system RAM, and a s/w or
DMA blit into VRAM is required to make it visible.
If you ask for a h/w surface, you may get a surface with it’s pixels
array allocated in VRAM, texture space or whatever applies to the
backend in use.
A h/w display surface is (normally) an actual display page, meaning
that no blit at all is required to make it visible; just a switch of
hardware pointers. (Done via SDL_Flip(), retrace sync’ed where
possible.)
In my DLL, I reset screen using:
screen = SDL_CreateRGBSurface(SDL_HWSURFACE, 1024, 768, 16,
screen->rmask…etc
(using masks from previous screen)
…with SDL_OPENGL added? Or are you bypassing SDL and creating the
OpenGL context some other way?
[…]
Are you by any chance using glSDL for the 2D rendering? That would
probably screw up your OpenGL state whenever someone calls
SDL_Flip()…
no SDL gl functions are used by fenix. only software access to the
surface data.
Well, glSDL is not OpenGL. It’s an implementanion of the SDL 2D API
over OpenGL. Two implementations, actually;
glSDL/wrapper (old, deprecated):
If Fenix is using this, it means it’s compiled with a wrapper that
redefines some SDL calls, pointing them to alternative, compiled-in
implementations. The only difference in the source would be that
glSDL.h is included instead of SDL.h, and there’s a flag SDL_GLSDL
passed to (the wrapped) SDL_SetVideoMode() to enable OpenGL
acceleration.
glSDL/backend:
If you were using an SDL lib with glSDL compiled in (not yet in
official SDL releases), it wouldn’t even affect the Fenix binary. You
could tell SDL to activate the glSDL backend by means of an
environment variable without Fenix even being aware of it, and Fenix
would happily (hopefully) use OpenGL like any other SDL backend.
Anyway, the problem is that you’re not really supposed to use the SDL
2D API (whether it’s wired to glSDL, or any other backend) when
you’re using OpenGL. I know that glSDL will mess with the OpenGL
state (I created it :-), but I suspect that other 2D backends may do
weird stuff as well, when you, or in this case, Fenix, calls
functions that are not supposed to use in “OpenGL mode”.
I’m actually surprized SDL doesn’t plain crash. (It used to do that
when using SDL_BlitSurface() to an OpenGL display and the like.)
I’m not sure it’s at all possible to handle an application calling SDL
2D calls while some DLL “cheats” SDL into switching to an OpenGL
display. I’m afraid you’ll have to find some way to keep Fenix away
from the display surface, meaning no calls to SDL_UpdateRect(s)(),
SDL_Flip() and maybe some other calls I’m forgetting. Or maybe modify
SDL to deal with it somehow; forward the offending calls to your DLL
or something…
//David Olofson - Programmer, Composer, Open Source Advocate
.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
— http://olofson.net — http://www.reologica.se —On Monday 21 March 2005 10.38, Daniel wrote: