Organization: Loki Entertainment Software
Newsgroups: loki.open-source.sdl
I wrote some window resizeing code on the MacOS and would like to commit
it to the SDL comunity. ( Sam ? )
But I had some problems:
- My Voodoo 3 doesn’t accelerate OpenGL usign the toolbox, no idea why,
because Fullscreen with DSp works quite great ( But that did never work
)
I have a fix for this. There is an error in the AGL attributes setup. See
code snippet below.
- When resizing the window, the SDLGears that I use for testing has to
resize the window, too. This causes the window to
always be centered in the middle of the screen. All right up to now. But
then I do not see anything rendered.
If a window (OpenGL) is resized, you have to reattach the drawable
(AGL_SetDrawable) and also make it current (SDL_GL_MakeCurrent() ). Then do
a buffer swap (SDL_GL_SwapBuffers()). I’m not sure, is the buffer swap up to
the application or do we do that?
The alternative to resize the window and to not post a resizeEvent onto
theSDL event queue causes the viewport to be wrong (as expected).
We should post a resize event, so the app can make the necessary adjustments
to the viewport and/or viewing projection.
Here is my fix for Mac_GL_Init(). You should rip out the existing attributes
code and put this in.
AGLPixelFormat format;
GLboolean noerr;
GLint attributes [ 24 ]; /* 24 is max attributes possible in this setup
*/
int i = 0;
attributes[i++] = AGL_RGBA;
if ( this->gl_config.double_buffer )
attributes[i++] = AGL_DOUBLEBUFFER;
if ( this->gl_config.depth_size != 0 ) {
attributes[i++] = AGL_DEPTH_SIZE;
attributes[i++] = this->gl_config.depth_size;
}
attributes[i++] = AGL_RED_SIZE;
attributes[i++] = this->gl_config.red_size;
attributes[i++] = AGL_GREEN_SIZE;
attributes[i++] = this->gl_config.green_size;
attributes[i++] = AGL_BLUE_SIZE;
attributes[i++] = this->gl_config.blue_size;
attributes[i++] = AGL_ALPHA_SIZE;
attributes[i++] = this->gl_config.alpha_size;
if ( this->gl_config.stencil_size != 0 ) {
attributes[i++] = AGL_STENCIL_SIZE;
attributes[i++] = this->gl_config.stencil_size;
}
if ( this->gl_config.accum_red_size != 0 &&
this->gl_config.accum_blue_size != 0 &&
this->gl_config.accum_green_size != 0 ) {
attributes[i++] = AGL_ACCUM_RED_SIZE;
attributes[i++] = this->gl_config.accum_red_size;
attributes[i++] = AGL_ACCUM_GREEN_SIZE;
attributes[i++] = this->gl_config.accum_green_size;
attributes[i++] = AGL_ACCUM_BLUE_SIZE;
attributes[i++] = this->gl_config.accum_blue_size;
attributes[i++] = AGL_ACCUM_ALPHA_SIZE;
attributes[i++] = this->gl_config.accum_alpha_size;
}
attributes[i++] = AGL_ALL_RENDERERS;
attributes[i] = AGL_NONE;
format = aglChoosePixelFormat(NULL, 0, attributes);
if ( format == NULL ) {
SDL_SetError("Couldn't match OpenGL desired format");
return(-1);
}> From: Sven Schaefer <sschafer at rbg.informatik.tu-darmstadt.de>
Reply-To: sdl at lokigames.com
Date: Wed, 20 Sep 2000 02:20:20 +0200
To: sdl at lokigames.com
Subject: [SDL] Resizeable windows on the MacOS