Jump to content
  • Advertisement
Sign in to follow this  

OpenGL 2Dgump summary

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

hi all! I'm converting a simple engine I wrote from D3D to OpenGL, but I noticed it wasn't quite straightforward with 2D stuff first of all, I must say that I've read the faq so I DO know how to display 2d stuff using "pixel coordinates", that's not my problem ;) also, my gump should support borders, so the source image (usually something below 15x15 pixels) is a sort of template that I subdivide in 9 rectangles (4 corners, 4 borders, center area) that are resized as needed in the final image, based on some parameters passed ot some other function what I did with D3D was something like this: 1) load an arbitrary sized bmp 2) render it to a texture resizing where needed 3) render other stuff to the texture (text, buttons, etc) 4) render the texture to the screen so, lots of "hidden" stuff now, trying to translate this in OpenGL I'm a bit puzzled since probably I'm missing part of those "hidden" things, anyway: 1) load an arbitrary sized bmp 1b) fill the missing bytes with 0 data at load time so that it matches the 2^n x 2^m form (then generate the texture) 1c) map the texture to a rectangle formed by 9 quads using texture pixel coordinates (it should be easy, knowing the original bmp size) 2) render the "background", resizing the appropriate rectangles, to a texture 3) render other stuff to the texture 3b) map the texture to a polygon appropriately resized 4) render the polygon to the screen using "2D pixel coordinates" now, I'm fairy ok with 1, 1b and maybe 1c but I'm quite clueless about 2 and 3: I've read something about pbuffers but I'v not found yet a comprehensive tutorial. is it the only way to solve this? I've also read of some pixel manipulation functions (copy, zoom etc), should they be better/worse in this case? do they allow me to jump the mapping to polygon thing (3b and/or 1c and/or 4) and to instantly go writing pixels around? :) is it slower/faster/trickier/basically the same? is there some other (better) way to do the whole thing or Im already on an acceptable path? thanks in advance :)

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!