PDA

View Full Version : OpenGL Screensaver Hardships



vindy
08-06-2012, 08:51 AM
Hi guys. I know I'm not supposed to do this, post questions that belong in a different section of the forum, but I thought maybe some of you would know a thing or two about OpenGL programming with Windows and could shed some light on the matter. I've been struggling to get an OpenGL screensaver I wrote working with the preview window for a while now. I've solved some major problems with my program but there are still a few apparently. Before trying to get a miniature version of my screensaver running in the preview window I thought I'd see if I can just get that little window to turn white by putting an all white texture on it. Sadly, it didn't work. The preview window remains black when I select my screensaver. However, I've noticed that when I change to a different screensaver for about a split second from when I select the other screensaver to when it actually changes over to it the preview window does turn white. I suspect I need to do something similar to a glutPostRedisplay, but InvalidateRect isn't doing the trick. Any ideas as to what I should do to solve the problem? Thanks in advance.

BionicBytes
08-06-2012, 09:52 AM
Do you actually have a handle for the preview window? Does that Window have a GL Context?
Instead of rendering a white texture as a proof of concept (there are many ways to get a white window instead of the correct texture displayed) - try rendering a solid red colour - as this avoids the need for textures/sharing across contexts/uninitialised textures.

vindy
08-06-2012, 10:42 AM
Hi BionicBytes. Thanks for responding. Yes, I do have a handle to the preview window. I checked it and its valid. I'm also getting a valid rendering context. I checked that too. I tried putting a solid red color on the window using glClearColor but its the same deal. When I select my screensaver the preview window remains black. Then for a split second when I change the selection the preview window turns red right before switching over to the new screensaver. I'm at a loss as to what the problem is.

vindy
08-06-2012, 04:04 PM
Hi BionicBytes. I think I might know what the problem is. When I create my window do I have to register it with a whole new WndProc function? I'm new to windows programming as well as OpenGL so please be patient with me when answering this question.

vindy
08-06-2012, 04:23 PM
To clarify, when I create the child window for preview mode does it have to have its own WndProc function?

vindy
08-06-2012, 07:33 PM
Well, I tried making a WndProc function for the child window and it still doesn't work. The same thing is happening. I'm about at my whits end here guys. Any ideas as to where I might be going wrong? Should I post my code? Its kinda long, which is why I haven't posted it yet.