Hello!
I downloaded a demo program from : http://www.codesampler.com/oglsrc.htm in the “Point Sprites” demo. code: http://www.codesampler.com/source/ogl_point_sprites.zip
I ported to JOGL, and I don’t see blending with texture.
I modified the particle texture file with alpha chanell, but nothing happened.
My code:
int[] particlePic = new int[0];
particlePic[0] = loadTGAImage(“d:\particle.tga”, false);
…
gl.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
gl.glBindTexture( GL.GL_TEXTURE_2D, particlePic[0] );
gl.glEnable( GL.GL_TEXTURE_2D );
gl.glEnable( GL.GL_BLEND );
gl.glBlendFunc( GL.GL_SRC_ALPHA, GL.GL_ONE );
float[] maxSize = new float[1];
gl.glGetFloatv( GL.GL_POINT_SIZE_MAX_ARB, maxSize );
if( maxSize[0] > particleSize )
maxSize[0] = particleSize;
gl.glPointSize( maxSize[0] );
gl.glPointParameterfARB( GL.GL_POINT_FADE_THRESHOLD_SIZE_ARB, 60.0f );
gl.glPointParameterfARB( GL.GL_POINT_SIZE_MIN_ARB, 0 );
gl.glPointParameterfARB( GL.GL_POINT_SIZE_MAX_ARB, maxSize[0] );
gl.glTexEnvf( GL.GL_POINT_SPRITE_ARB, GL.GL_COORD_REPLACE_ARB, GL.GL_TRUE );
gl.glEnable( GL.GL_POINT_SPRITE_ARB );
gl.glBegin( GL.GL_POINTS );
for( Particle p : particles ) {
gl.glColor4f( p.color.r, p.color.g, p.color.b, 1.0f );
gl.glVertex3f( p.absolutePos.x, p.absolutePos.y, p.absolutePos.z );
}
gl.glEnd();
gl.glDisable( GL.GL_POINT_SPRITE_ARB );
gl.glDisable( GL.GL_BLEND );
gl.glDisable( GL.GL_TEXTURE_2D );
…
The code is quite is the same as in the downloaded demo.
(except the difference of the programming alnguages and Opengl environment…)
What did I wrong?
Thanks!
screenshot: http://delfin.klte.hu/~fazekaim/sprite.jpg
quads and no blending