# OpenGL help: problem resizing GLX window

## Recommended Posts

I just ported my 3D engine from OpenGL on Windows to OpenGL on Linux. But now that I have the core running, I have a couple problems I do not understand. Here is one of them. When I grab the boundary of the graphics window with the mouse and resize it to a larger size, the area inside the window that is cleared each frame does not change size from the original size. The rest of the area inside the frame is not cleared or drawn. The objects in the window get larger as the window is made larger and larger, so the viewport and the projection matrices are being altered correctly (it seems). Then when I resize the window smaller again, some of the window along the top is not being drawn - as if the viewport is offset downward (but not rightward). I do not understand in any significant way what the distinction between the XWindow and GLXWindow are. When my code creates a window, it first calls XCreateWindow() to create an XWindow, then calls glXCreateWindow() to create (and associate) a corresponding GLXWindow. That's what the GLX sample code that I found seems to want. Not sure whether perhaps the XWindow is being resized but not the GLXWindow - but I do not see any GLX resize functions. Furthermore, when I try to resize the GLXWindow with xlib functions, my applications blows up (and XWindows prints a nasty error message). So that doesn't seem to be how this should be handled. Any ideas? video card = nvidia 8600GT + 512MB. The nvidia drivers are up to date.

##### Share on other sites
sorry no idea, if u used SDL u wouldnt have this problem ( sorry not helpful ), though what u can do is check out the source code of SDL included with the development download + see how it handles window resizing

##### Share on other sites
What I do in OpenTK is this:
- glXChooseVisual
- XCreateColormap (from the visual above)
- XCreateWindow (make sure you request to be informed about size/move events)
- glXCreateContext
- glXMakeCurrent

Works perfectly, as long as you call glViewport inside the resize event handler.

I don't know what glXCreateWindow does, and I've never seen it used either. :)

Check the glxgears source code (scroll to the end of the file, and check main() and make_window()). You can also take a look at the source of GLFW (zlib licensed, check lib/x11/x11_window.c) and the source of SDL (LGPL licensed, careful!)

##### Share on other sites
Thanks for the information, fiddler.

I had the same problem with the GLX 1.2 functions you list in your message. After having so much trouble finding the cause of this problem, I decided to switch to the newer GLX 1.3 functions out of desparation!

I did finally solve the problem. To my surprise, the bug was in XWindows, not my code! I did not expect that!

Specifically, the problem was caused (by coincidence - or pure bad luck) by my decision to capture the width and height of the resized window in the XWindows ResizeRequest event. I found that the mere fact of selecting to receive that event (when calling the XCreateWindow() function) was sufficient to cause this problem. No kidding!

I moved my code that captures the resized width and height of the window into the ConfigureNotify event, and simply returned from function when the event was a ResizeRequest --- but the problem persisted, even though my code was doing nothing whatsoever in response to the ResizeRequest event. However, if I simply cleared the bit in the "event_mask" in the XSetWindowAttributes structure argument to XCreateWindow() --- poof --- problem gone. Yikes!

I bet you a dime if you simply set this one bit into your code that you encounter the identical problem --- even though you do not handle the event!

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
627711
• Total Posts
2978753
• ### Similar Content

• I want to make professional java 3d game with server program and database,packet handling for multiplayer and client-server communicating,maps rendering,models,and stuffs Which aspect of java can I learn and where can I learn java Lwjgl OpenGL rendering Like minecraft and world of tanks

• A friend of mine and I are making a 2D game engine as a learning experience and to hopefully build upon the experience in the long run.

-What I'm using:
C++;. Since im learning this language while in college and its one of the popular language to make games with why not.     Visual Studios; Im using a windows so yea.     SDL or GLFW; was thinking about SDL since i do some research on it where it is catching my interest but i hear SDL is a huge package compared to GLFW, so i may do GLFW to start with as learning since i may get overwhelmed with SDL.
-Questions
Knowing what we want in the engine what should our main focus be in terms of learning. File managements, with headers, functions ect. How can i properly manage files with out confusing myself and my friend when sharing code. Alternative to Visual studios: My friend has a mac and cant properly use Vis studios, is there another alternative to it?

• Both functions are available since 3.0, and I'm currently using glMapBuffer(), which works fine.
But, I was wondering if anyone has experienced advantage in using glMapBufferRange(), which allows to specify the range of the mapped buffer. Could this be only a safety measure or does it improve performance?
Note: I'm not asking about glBufferSubData()/glBufferData. Those two are irrelevant in this case.
• By xhcao
Before using void glBindImageTexture(    GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), does need to make sure that texture is completeness.
• By cebugdev
hi guys,
are there any books, link online or any other resources that discusses on how to build special effects such as magic, lightning, etc. in OpenGL? i mean, yeah most of them are using particles but im looking for resources specifically on how to manipulate the particles to look like an effect that can be use for games,. i did fire particle before, and I want to learn how to do the other 'magic' as well.
Like are there one book or link(cant find in google) that atleast featured how to make different particle effects in OpenGL (or DirectX)? If there is no one stop shop for it, maybe ill just look for some tips on how to make a particle engine that is flexible enough to enable me to design different effects/magic
let me know if you guys have recommendations.