[SDL] strange context switch when changing Window-Size

Benjamin Grauer bensch at orxonox.ethz.ch
Fri Nov 18 03:36:19 PST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

ok, didn't know this
thanks for the info, i will go and try to fix this in my code, to once
again adapto to f** windos...


Brian Barrett wrote:

> AFAIK you shouldnt call SDL_FreeSurface on a surface created by
> SDL_SetVieoMode either...
>
> On 12/9/05, Benjamin Grauer <bensch at orxonox.ethz.ch> wrote:
>
>> Hi there
>>
>> we are coding a 3d action shooter for Linux/Windows/osX, and
>> since we ported to Windows via SDL we have a strange effect, when
>> changing the Screen size in windows:
>>
>> On loading everything works well, most models are stored in
>> glLists (at the moment) and all Textures are stored in
>> glTexture2D's...
>>
>> But, when the resolution gets changed, SDL sends a
>> WindowResizeEvent, that we catch, and handle with this code:
>>
>> int GraphicsEngine::setResolution(int width, int height, int bpp)
>> { this->resolutionX = width; this->resolutionY = height;
>> this->bitsPerPixel = bpp;
>>
>> if (this->screen != NULL) SDL_FreeSurface(screen);
>> if((this->screen = SDL_SetVideoMode(this->resolutionX,
>> this->resolutionY, this->bitsPerPixel, this->videoFlags |
>> this->fullscreenFlag)) == NULL) { PRINTF(1)("Could not
>> SDL_SetVideoMode(%d, %d, %d, %d): %s\n", this->resolutionX,
>> this->resolutionY, this->bitsPerPixel, this->videoFlags,
>> SDL_GetError()); // SDL_Quit(); // return -1; }
>> glMatrixMode(GL_PROJECTION_MATRIX); glLoadIdentity();
>> glViewport(0, 0, width, height); // Reset The
>> Current Viewport }
>>
>>
>> Then all Textures get removed from rendered Objects, and glLists
>> wont render anymore, but the objects rendered through glVertex,
>> are still visible.
>>
>> I suspect, that somehow an openGL context switch occurs, or gl
>> gets reinitialized...
>>
>> here is a precompiled binary, and source.
>> http://www.orxonox.net/files/snapshots/orxonox-src-latest.tar.bz2
>> http://www.orxonox.net/files/snapshots/orxonox-win32-latest.zip
>>
>>
>> any help is appreciated Benjamin
>>
>>
>> _______________________________________________ SDL mailing list
>> SDL at libsdl.org http://www.libsdl.org/mailman/listinfo/sdl
>>
>>
>>
>
> _______________________________________________ SDL mailing list
> SDL at libsdl.org http://www.libsdl.org/mailman/listinfo/sdl



- --
visit the worlds most furious open-source 3D-action game
http://www.orxonox.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iQIVAwUBQ328s63dUaw0Ln2OAQIKIBAAib1Rwjq1QF1K3skDBNhQgtXxpUfEjBmS
vpJ4hNIdaEKPLweCFTWTM4eTicfFQOTRZIQ5j1cyMD0LK8qrgigzefIOCs1ui107
kJtdqvrL3e/BX/ykXIrJjYPLS7TujPfOMV6VtCNZKbrzK3ri/2FGNHj13u5z9i3d
K1xSvDRCLTFGdxBS/7zZtjBc+hJqb0zlqsNTluUBOY6oLIDjHjGyRdYLGDFRcCJX
gUZ7t2FmXrISe4otByf20n9yg9g+6y4y8ImcZwSIesDDldT2dSfkLLSvCIO1p+x8
hVjbjHietgp8yYGCxeOf72JFOXNVY1FiyV5EOuXUMgjw6xCsjzxxvA24iKH0nIO1
U0uaQA+D0n3ELqGgXEYAox8pqUpp1IGOtR4sr/u0iuxUaQZuf+Hn17SN51B6TsFx
1+7MyAk/ltMg9HFdVPEWqPhkv/7p4i+n7aq/d5l0NG/sHbHmYf+g0EOukB5UlhzN
ZylWSb6+ULdoVqUUa5e1TV3OYuN9Iul9eINpEkamJvKuWl3ncCOGlLfubS+23Yg9
9nFNTHHSs3rdsx8pZP71USEXnuXzZK4tBf2MpZvyg1TCcm4Hx3OhbBE3ETtw9GON
mbmqCVnor1T9isgoL3nZwzm9ehtm0gNYWyEbEivmGA5NwfUDkV0NF6mZ+408BgDe
LKW2P31PXRY=
=tRio
-----END PGP SIGNATURE-----





More information about the SDL mailing list