blending (help please)

Started by
0 comments, last by karx11erx 17 years, 4 months ago
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]
Advertisement
Did you try glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)?
_________karx11erxVisit my Descent site or see my case mod.

This topic is closed to new replies.

Advertisement