little help

Started by
7 comments, last by Kalidor 19 years, 2 months ago
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.
______________________________Yes I think the rev pad sucks/so does 50 and the DS. I like action and am not ashamed. I prefer brunettes but hate chocolate. Yes,I have opinions!!! Rate as you will.
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().


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
______________________________Yes I think the rev pad sucks/so does 50 and the DS. I like action and am not ashamed. I prefer brunettes but hate chocolate. Yes,I have opinions!!! Rate as you will.
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



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
______________________________Yes I think the rev pad sucks/so does 50 and the DS. I like action and am not ashamed. I prefer brunettes but hate chocolate. Yes,I have opinions!!! Rate as you will.
dont use a mask, use a texture with an alpha channel, and enable alpha test.
faster than both methods (lots faster than glBitMap)



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

______________________________Yes I think the rev pad sucks/so does 50 and the DS. I like action and am not ashamed. I prefer brunettes but hate chocolate. Yes,I have opinions!!! Rate as you will.
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.
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.

This topic is closed to new replies.

Advertisement