how to use the glBlendColor at the right way ??

Hei!

im doing an JOGL CaveFlyer…

WebStart - Click to watch my demo.

my game will hold an caveship looming around on caves, ship is an “gl_quad”…

my current routines are below, what i am doing wrong, i dont seem to know how to use the “glBlendColor” at the right way to change my ships color and transparency values…

i also have the following problem…
if you change the frame size on my demo with PageUp / PageDown keys, why is blending setting my entire screen transparent when frame size is small ??
i have my glBlendFunc set only to gl.glBlendFunc ( GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA ); do i also need to set GL_DEST_ALPHA or GL_SRC/DEST_COLOR ??

thanks…



        gl.glBlendFunc ( GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA );  // is my glBlendFunc set correctly for an texture holding transparent color ??
        gl.glBlendColor ( 1f,0f,0f,0.5f );  // this should set my ship to red and half transparent, but, nothing happens ?? why ??
        
        cG.ctextalus.enable ();
        cG.ctextalus.bind ();                
        
        gl.glBegin(GL.GL_QUADS);  
            gl.glTexCoord2f((float)( coords.left() ), (float)( coords.top() ) );                        
            gl.glVertex3f(-0.0016f, +0.0016f, 0.0f);  // Top Left
            gl.glTexCoord2f((float)( coords.right() ), (float)( coords.top() ) );
            gl.glVertex3f(+0.0016f, +0.0016f, 0.0f);   // Top Right
            gl.glTexCoord2f((float)( coords.right() ), (float)( coords.bottom() ) );
            gl.glVertex3f(+0.0016f, -0.0016f, 0.0f);  // Bottom Right
            gl.glTexCoord2f((float)( coords.left() ), (float)( coords.bottom() ) );
            gl.glVertex3f(-0.0016f, -0.0016f, 0.0f); // Bottom Left
        gl.glEnd();
               
        cG.ctextalus.disable ();


JariTapio / Helsinki
www.EuroJari.net
JariTapio@EuroJari.net

I never used glBlendColor… glColor is what you need in this case.

BTW… your demo runs at 80fps, until the particle-engine is active, causng the framerate to drop to an unplayable 2-5fps

Hei!

i tryed to add glColor4f () just to my code before glBegin() and then i tryed to add it to glBegin() but there is no change on ship color or transparency ??

seems that i am missing something important from my code but i cant figure out what, need some help…

[edit] how i need to set my textures if i want to make my texture transparent and change textures color values ??

thanks…

( to Riven - my particeles are currently SMOOTH_POINTS will do them with GL_QUADS when i get this transparency and color problem fixed, anyway i get an “steady” 50 frames per second with GL_POINTS on full.heighted window !!


        gl.glBlendFunc ( GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA );
        gl.glColor4f ( 1f,0f,0f,0.5f );

        cG.ctextalus.enable ();
        cG.ctextalus.bind ();                        
        
        gl.glBegin(GL.GL_QUADS);               
            gl.glTexCoord2f((float)( coords.left() ), (float)( coords.top() ) );                        
            gl.glVertex3f(-0.0016f, +0.0016f, 0.0f);  // Top Left
            gl.glTexCoord2f((float)( coords.right() ), (float)( coords.top() ) );
            gl.glVertex3f(+0.0016f, +0.0016f, 0.0f);   // Top Right
            gl.glTexCoord2f((float)( coords.right() ), (float)( coords.bottom() ) );
            gl.glVertex3f(+0.0016f, -0.0016f, 0.0f);  // Bottom Right
            gl.glTexCoord2f((float)( coords.left() ), (float)( coords.bottom() ) );
            gl.glVertex3f(-0.0016f, -0.0016f, 0.0f); // Bottom Left
        gl.glEnd();
               
        cG.ctextalus.disable ();

JariTapio / Helsinki
www.EuroJari.net
JariTapio@EuroJari.net

Use glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE) to enable blending of the texture with the underlying polygon’s color. See the OpenGL “red book” chapter on texture mapping for more information on texture environment modes and texture parameters.

Hei!

— Use glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE) to enable blending of the texture with the underlying polygon’s color. See the OpenGL “red book” chapter on texture mapping for more information on texture environment modes and texture parameters.

heh, thanks Ken, i had my glTexEnvi set to “GL.GL_REPLACE”…now i will surely get my project finished !! thanks!! i will read that “red book” !! thanks !!

JariTapio / Helsinki