Jump to content
  • Advertisement
Sign in to follow this  
annoyer101

OpenGL Blitting in OpenGL

This topic is 4273 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

Hello. A Few Weeks Ago I Finally Finished A Text-Based Game. I Like The Plot To The Game, But, Being A Far-From-Original-Text-Based Game, It Is Pretty Boring. So, I Decided To Do Something I Never Thought I Could Possibly Do In My Whole Life... Learn OpenGL (Which Actually Is Proving To Be Not Nearly As Bad As I Thought). Since I've Made More Progress In This Library Then Ones I Have Tried Before, I've Finally Decided That I Will Use C and OpenGL. So What I Would Like To Do With My Game Is Have A Picture For Every Time Someone Presses A Key. The Picture Will Be A Single 2d Picture And Will Instantly Switch To Another Picture When The Player Presses A Key. Then It Will Sort Of Be Like A Text Based Game, But With Images I Make In MSPaint! There Is Only One Problem With This: [help] I Have Know Idea How To Blit Images In OpenGL! [help] How Is This Done? I Always Have Problems When I Try To Blit An Image In Graphics Libraries! So I Really, Really Need Help! I'm Not Having A Problem With Opengl Blitting (Yet...), I Just Haven't Have The First Clue On How To. So Help Is Very Greatly Appreciated. Thank You So, So Much To Anyone Who Helps Me. Sincerely, Annoyer

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Your best bet would be to load the image as an OpenGL texture and create a new quad to render to the screen. Then use the texture on the quad.

Blitting directly to the screen in OpenGL is generally not recommended. I've wanted to do the same thing in the past, but a lot of people claim that blitting directly to the buffer causes the application to run slower for some reason.

Share this post


Link to post
Share on other sites
Thank You Very Much For Your Reply! However, I Am Curious On How To Directly Blit, But Don't Waste Your Time Telling Me If You Don't Feel Like It.

Sincerely,
Annoyer

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
First, you need to use glRasterPos to set the position on the screne. Then you use the command glDrawPixels and pass a pointer that points to the pixels data in the memory to the function. You can find a lot of the functions and descriptions for what they do here:

http://windowssdk.msdn.microsoft.com/en-us/library/ms537062.aspx

You can even go a bit farther and zoom and possibly rotate the image as well.

I'd highly recommend getting the OpenGL reference book, or downloading the PDF from opengl.org.

Also, I think it would be a good idea to use SDL because then you can use it to control the window that OpenGL renders to and also load your images into video memory and still pass it to glDrawPixels.

Hope this helps :)

Share this post


Link to post
Share on other sites
Thank You! That Was Very Helpful Of You! I Greatly Appreciate It! Hmmm...
Okay, That's The Best Thank You Message I Could Think Of So... Thanks!

Sinccerely,
Annoyer

Share this post


Link to post
Share on other sites
OMG :lol: I never think I never in my life have seen someone using capital letters in every single word, and no mistakes, geez. :)

Share this post


Link to post
Share on other sites
I mean, I must admit that I use capitals at the beginning of all my user messages in software I write. But it's kinda 'annoy'ing to read on a forum post.

Hope you've got everything sorted though? I'm also quite interested in bitmap blitting so this post was helpful to me. :P

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!