Skip to main content
gamedev.net
🔒 Locked

Problem With Basic OpenGL Setup

Started by AndyEsser 1 reply 800+ views
Original Post
AndyEsser
AndyEsser
I've been using OpenGL for a few years now, slowly but surely moving in the right direction. However, I've never really known the 'Dark Art' of OpenGL. That is, how it actually does it's stuff. So I decided that rather than copying and pasting the code examples from NeHe I rewrote all the code myself. At this point I'd just like to point out I'm using Visual Basic. Anyway, everything was going really well. Wasn't getting any error messages, then I finish writing all the basic initialise code and run the project. The window appears, the framerate counts properly, and no messages appear. However, the screen is filled with garbage. http://www.essersoft.com/images/oglProblem.JPG This is an idea of what happens. The strange thing is if I maximise the window, content is shown within the window that is from another older OpenGL program that I ran earlier. Obviously the data being displayed in the window is data still residing on the Graphics Card. Has anyone had a similar problem before? Could anyone point me in the right direction of where the problem might be eminating? Cheers, and thanks very much [Edit: Shortly after posting this I had a play around with the Pixel Format, thinking that's where the problem is most likely to be, anyway. The window now displays as black as it should, when windowed, however if I maximise the window it all goes wrong as it was doing so before.]
Mobby6
Mobby6
Have you try set glClearColor and glClear to clear the color buffer. I don't use visual basic so function name might be different.
AndyEsser
AndyEsser
lol, thanks that did it.

I had previously had this:

glClear GL_COLOR_BUFFER_BIT and GL_DEPTH_BUFFER_BIT

Which didn't through up any errors, but a simple change to:

glClear GL_COLOR_BUFFER_BIT
glClear GL_DEPTH_BUFFER_BIT

has sorted it.

Cheers, thanks very much for your help!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.