Hi, I have a weird problem. I moved my code over from an existing VC++ project I had going and tidied up the code.
I have 2 windows in the program, the OpenGL rendering window, and a message window (both using the same wndproc but with seperate window handles and device contexts), if I create the message window first, the OpenGL window is centred, but if I create the OpenGL window first, the image is too far to the left (same code), if I resize the window, the image recentres itself. Can anyone tell me why this happens?
Also, the main problem:
I’ve not messed around with the rendering code (which is in a seperate file), but I have changed parts to make the drawing loop check for any event messages rather than having winMain do it (so the checks are done outside of the winMain function).
I’ve stepped through the program, and after pressing space (I have added a few areas that detect the space bar to progress through an algorithm), the main loop is entered, with the message handler being called 3 times before going into the rendering function, at which point, it draws the image required (only if the message window is created first. However, glReadPixels writes an empty array rather than the pixels in the window, so what’s wrong? Does it have anything to do with the fact that i have 2 windows? I’ve tried without the message window but it’s still writing nothing into the array (this function was working in the previous program, which has not had anything too major added apart from the extra window, and the changing of the loop structure).
I’ve been staring at this for several days now and there’s absolutely nothing that I can see that could cause this!