Archived

This topic is now archived and is closed to further replies.

drawing trees

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

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

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites