Skip to main content
GameDev.net gamedev.net
🔒 Locked

Transparency problem

Started by immuner May 16, 2006 at 12:04 AM 4 replies 450+ views
Original Post
immuner
immuner
Hello, i am trying to make my waves transparent.....problem is i cant make it work right...i can blend the colors etc but transparent....nope! thing to note (dont know if it makes a difference) is that im using a lightmap, but i use normal light for my other objects. //glDisable(GL_LIGHTING); glActiveTextureARB(GL_TEXTURE0_ARB); Bind(); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE); glEnableClientState(GL_COLOR_ARRAY); glColorPointer(4, GL_UNSIGNED_BYTE, 0, light); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(3, GL_FLOAT, 0, vertex); glLockArraysEXT(0, index); glDrawElements(GL_TRIANGLE_STRIP,index,GL_UNSIGNED_INT,&index[0]); glUnlockArraysEXT(); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_COLOR_ARRAY); glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); glBindTexture(GL_TEXTURE_2D, 0); glActiveTextureARB(GL_TEXTURE0_ARB); //glEnable(GL_LIGHTING); any ideas?
Keyboard not found. Press F1 to Continue.
Disgruntled Gamer
Disgruntled Gamer
What is the alpha value for your water texture? The closer to zero the alpha value, the more transparent the water will be. I also use this blend function: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);.
immuner
immuner
never mind that wasnt it....i hadnt order my objects so that transparent will go last....its fine now
Keyboard not found. Press F1 to Continue.
immuner
immuner
ok as i said fixed that problem but id like some help with the next one....i am trying to render my wave mesh using triangle strips....problem is that i am calculating something extra as you can see here http://img319.imageshack.us/img319/7131/wave0as.jpg.

my code is quite simple:

for (int z= -2500; z < 2500; z+=250)
{
for (int x= -2500; x < 2500; x+=250)
{
// vertices
watervertex[index][0] = (float)x;
watervertex[index][2] = (float)z;
watervertex[index + 1][0] = (float)x;
watervertex[index + 1][2] = (float)(z + step);

// indices
waterindex[index] = index;
waterindex[index + 1] = index + 1;
index += 2;
}
}

any ideas?
thank you
Keyboard not found. Press F1 to Continue.
immuner
immuner
anyone?
Keyboard not found. Press F1 to Continue.
Disgruntled Gamer
Disgruntled Gamer
Bueller...

Anywho, if your talking about those lines crossing over the top of your terrain, then my guess would be that your connecting triangle strips at the end of one row to the strips that begin in the next row. So the terrain is essentially connected in a big loop. Check the way you loop through the triangle strips and make sure you don't have an extra count in your loop somewhere.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.