Jump to content
  • Advertisement
Sign in to follow this  
Stompy9999

SDL and OpenGL

This topic is 4981 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well, I've been trying to get OpenGL working outside of windows. I first tried AllegroGL which didn't work. I am currently working with SDL to interface with OpenGL. It's working so far, but I can't find any good tutorials that explain how to correctly initialize SDL with OpenGL. Does anybody know of any good tutorials on this subject?

Share this post


Link to post
Share on other sites
Advertisement
I ran my first SDL and OpenGL program. Does anyone know why the window that is produced is seethrough? Meaning, you can see the window frame but the inside of the window is seethrough.

Share this post


Link to post
Share on other sites
Probably because the buffer contains whatever pixel data was in it before the window was created and the context initialized. Call glClear(GL_COLOR_BUFFER_BIT) to clear this random junk out.

EDIT: And if you create it with a double buffer, don't forget to call SDL_GL_SwapBuffers() after glClear(), to swap the back buffer to the front...

Share this post


Link to post
Share on other sites
Quote:
Original post by Stompy9999
Well, I found the answer through the game programming wiki. In case anyone is interested, here is where I found the answer:

Answer

I question that author's use of SDL_SWSURFACE without any explanation.

Share this post


Link to post
Share on other sites
I did clear the buffer but I didn't swap buffers so that's probably the problem. I also found out that I should download the latest SDL devpak so I could have the SDL and OpenGL template.

Share this post


Link to post
Share on other sites
heh, I guess its too late since you figured out, but I just added a link to my tutorial about it to my sig.

Oh well at least I get to test it [smile]

Share this post


Link to post
Share on other sites
The wierdest thing happened. I put in the swap buffer code and compiled it again. When it ran, it showed a repeating image of a city in the window. This isn't my wallpaper though. I tried to get screenshots but my print screen key isn't working. What is it?![wow]

Share this post


Link to post
Share on other sites
How can I make a screenshot so I can show you guys what is going on? This is really weird...

My print screen key isn't allowing to copy the screenshot to MS paint.

Share this post


Link to post
Share on other sites
Quote:
Original post by Stompy9999
How can I make a screenshot so I can show you guys what is going on? This is really weird...

My print screen key isn't allowing to copy the screenshot to MS paint.


Because you need to program that functionality. Try taking a screen shot of Media Player playing a video and you'll get the same thing. The video is in your video card's memory. PrintScreen's default functionality will just copy the overlay - like a blue screen (but probably pink).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!