Transparent quad

I’m working on my first jogl game (an asteroids remake), and I have run into a couple problems. The first problem is that I can’t seem to figure out how to make a quad transparent, I am texturing quads to create my sprites for the game, but the quad always has a background color, how do I make it transparent?

The other problem is with webstart, its telling me that it can’t launch the application because the resources in the jnlp are not all signed by the same certificate. I did however sign every jar except jogl.jar because it wouldn’t let me ( all with the same certificate…). I have jogl.jar as a regular jar resource and jarred jogl.dll and jogl_CG.dll in the windows native section of my jnlp, what could I be doing wrong? I will post the jnlp if that would help. Here is the webstart link: http://www.cyntaks.com/projects/asteroids/webstart/asteroids.php

thanks.

For your quads, you can load an image with a transparency value (png file for example) the you have to set some popreties to openGL to enable transparency…

gl.glEnable ( GL.GL_LINE_SMOOTH );
gl.glEnable ( GL.GL_BLEND );
gl.glBlendFunc ( GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA );

Thanks! I finally made my textures transparent! Now I have one question: will I have performance problems if I call


gl.glEnable ( GL.GL_TEXTURE_2D );
gl.glEnable ( GL.GL_LINE_SMOOTH );
gl.glEnable ( GL.GL_BLEND ); 

in the initialization? Or should I keep enabling and disabling things as then get needed?

I’m not sure this is the problem, I am using:

gl.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_DECAL);

and I can see the color of the quad, so the transparency of my png is working. I need a way to make the actual quad transparent. I realize I may be doing this wrong so maybe I need to be using

gl.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE);

and then use your code when loading the texture. I’m not exactly sure at what point in my code I need to use this:

gl.glEnable ( GL.GL_LINE_SMOOTH );
gl.glEnable ( GL.GL_BLEND );
gl.glBlendFunc ( GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA );

Ok, thanks for the tip, its working now. I used your code when loading the texture and used GL_REPLACE instead of GL_DECAL.