Jump to content
  • Advertisement
Sign in to follow this  
Access

OpenGL little help

This topic is 4876 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, 1.) I have gotten the hang of using glRasterPos() + glBitmap() to draw bitmaps in OpenGL. I am having trouble using it in 3d mode. No matter where i set the coordinates in glRasterPos() for the image to be drawn, it ends up in the bottom left corner of the screen. It is possible in 3d isnt it? 2.) Does anyone know if the book "openGL game programming Dave Astle, Kevin Hawkins" covers transparency in sprites? It has drawing bitmaps and using textures but i cant find how to make it so the background of a sprite is not drawn but just the sprite character. Thanks //the reason i want to know how to do glRasterPos() in 3d even if i would be //making a 2d game is so that i can draw things on different depths into //the screen at any time. for example, in 2d ortho mode i would need // to draw things further into the screen first, then those closer next so // that those closer are put on top but with 3d i can draw things in any order // and as long as i specify the right Z coordinate, it will end up at the // right depth.

Share this post


Link to post
Share on other sites
Advertisement
Have you thought about using textured quads? As far as I know glBitmap() is not supported by hardware acceleration, so your program will probably run faster using textured quads than if you used glRasterPos() and glBitmap().

Share this post


Link to post
Share on other sites


if i use textured quads, will i still be able to show just the xter in a sprite and not its background?

i dont know if you know what i mean. For example if i plan to make breakout and i draw a ball in paint, but its in a square area (as most paint drawings are), with textured quads, would it be possible to show just the ball and not the other area of the bmp outside the circle?

Id prefer this question answered rather than my first two by the way.
Thanks a lot

Share this post


Link to post
Share on other sites
Here is a link to a post in this forum that should help you out. Pay special attention to the AP's post:
http://www.gamedev.net/community/forums/topic.asp?topic_id=150076

Share this post


Link to post
Share on other sites



Ive read it. Its the technique where you have a mask for evrything you draw and then pass both.
Sounds good but is this the best way? i can imagine that having to render two versions of every sprite (the actual sprite and the mask of the sprite) would make things slow.
Is there no faster or simpler way perhaps without the use of masks?

Sorry for my persistence, i just want to be sure.
thank you

Share this post


Link to post
Share on other sites
dont use a mask, use a texture with an alpha channel, and enable alpha test.
faster than both methods (lots faster than glBitMap)

Share this post


Link to post
Share on other sites



Zed: wont that just cause the whole sprite to become transparent/lucent?
as opposed to just the background and not the intended sprite drawing?!

Share this post


Link to post
Share on other sites
Yes, this would enable transparency on the entire textured quad, which is not the effect that you want. As far as I know the best method is to use a mask, which is still probably faster than glBitmap() because of graphics acceleration.

Share this post


Link to post
Share on other sites
Quote:
Original post by Sure Shot
Yes, this would enable transparency on the entire textured quad, which is not the effect that you want. As far as I know the best method is to use a mask, which is still probably faster than glBitmap() because of graphics acceleration.


It wouldn't if you have the background's alpha values set to zero, with all other alpha values 1 (or just != 0) and then setting the alpha function to pass when alpha is greater than 0.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!