Jump to content
  • Advertisement
Sign in to follow this  
JinJo

blending (help please)

This topic is 4202 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 am trying to do blending for a simple tile based game. First I draw the background which is just a huge texture, then an array of tiles for layer1 and an array for layer2. Each tile has an alpha value read in from file, 0 being transparent and 255 being opaque. However if i set the alpha value to anything other than 255 it is always completely transparent, I dont know what is wrong, ive tried hacking away at different blend functions and drawing orders etc but nothing works. The tiles are textured too. heres the rough code: bind background texture set colour(1,1,1); draw quad for each tile if tile alpha < 255 gl.glColor4i(255, 255, 255 , tile.alpha); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE); //note i have tried different params gl.glEnable(GL.GL_BLEND); gl.glDisable(GL.GL_DEPTH_TEST); else gl.glColor3f(1, 1, 1); bind tile texture move to correct position draw quad if tile alpha < 255 gl.glDisable(GL.GL_BLEND); gl.glEnable(GL.GL_DEPTH_TEST); repeat for layer 2. Everything draws ok except the tiles that are transparent, they are just completely transparent. what am i doin wrong? [Edited by - JinJo on November 24, 2006 12:12:38 PM]

Share this post


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