[SDL] Re: Getting the client size in SDL OpenGL Window

Glen RItchie glen.ritchie at jcu.edu.au
Mon Jan 17 19:54:16 PST 2005


Rainer Deyke <rainerd <at> eldwood.com> writes:

> 
> Glen RItchie wrote:
> > Well then, I am at a complete loss as to why the exact
> > code works perfectly under win32 when i pass the client
> > area to glViewport but fails under SDL and GLUT when i
> > pass the window size/width...
> 
> By this do you mean that you are combining GLUT and SDL in a single program?
> That seems like an odd combination, since there is a lot of overlap of
> functionality between GLUT and SDL.  Combining both libraries in one program
> may result in unexpected side effects.
Err. no. this isn't what i'm doing. I just wanted to say that you can't get the
client area in GLUT either. 

> GLUT aside, there's not much I can do.  The parameters passed to
> SDL_SetVideoMode are supposed to be the dimensions of the client area.  It
> works for me.  If it doesn't work for you, either there is a bug in your
> code, or you have discovered a bug in SDL.
I'm pretty sure it's not a bug in my program.
I'll explain what i'm trying to do and why i need the client area.

I've implemented a GUI interface into my prog and the main thing is dragging
windows around. Eg. click on the title bar and drag them. Now in fullscreen this
works perfectly when the mouse moves 1 pixel the window moves one unit in opengl
co-ords ( i set it to use ortho2d ). But i've noticed a certain lagging in
windowed mode, eg the mouse moves one pixel but the window moves less. This is
because i create a window at say 500, 500 and pass this to glortho. But the
actual client area is less than this and so opengl helpfully changes the ratio
because you can't fit the 500,500 into the smaller client area. This is why i've
noticed the lagging on the window behind the mouse in windowed modes but not
fullscreen. in fullscreen there is no title bar.

I originally found this bug when using Direct3D on Windows and fixed it by using
the client area as the ortho params. When i ported the same code to opengl i had
the original problem. Thus... i wish to find the client area.

I guess i'll just have to use X11 commands to get the current active window and
get the client area that way.

Glen Ritchie










More information about the SDL mailing list