drawing trees

Started by
2 comments, last by kindfluffysteve 21 years, 5 months ago
I''ve spent the last few hours trying to draw a 32 bit texture. has anybody got any source code or instruction because i just dont know what im doing. I can do simple texture maps but dont know how to render a texture which has alpha values. hopefully somebody can help me? ---------------------------- http://www.digitalsentience.pwp.blueyonder.co.uk
Advertisement
What you want to do?
For using alpha testing, its recommended to load a TGA texture. TGA have a value for alpha.
And then you can set the alpha testing.


DUK engine

Troa Technologies.
(3d game development)
yup, ive got a tga texture. I was wondering however, how exactly to i make opengl use it.

----------------------------
http://www.digitalsentience.pwp.blueyonder.co.uk
The glTexImage2D function you''ll want to use is:

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image_width, image_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, image_data); 


(Replacing image_width, image_height, and image_data as appropriate.)

To render an object with the alpha-channeled texture bound, you first need to enable blending like so:

glEnable(GL_BLEND);glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 


Then you can render the object.

This topic is closed to new replies.

Advertisement