Sign in to follow this  
JinJo

blending (help please)

Recommended Posts

JinJo    100
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this