jME currently renders particles using either triangles or points, but it’s possible to render point particles that look identical to normal particles using a new OpenGL 2.0 extension called ARBPointSprite and an older extension called ARBPointParameters.
To try this out, add this code to the end of simpleInitGame in TestPointParticles:
// point sprites are useless without a texture
TextureState ts = display.getRenderer().createTextureState();
// enable point sprite mode, generate special texture coordinates for points
GL11.glTexEnvi(ARBPointSprite.GL_POINT_SPRITE_ARB, ARBPointSprite.GL_COORD_REPLACE_ARB, 1);
// set up the distance attenuation
FloatBuffer ceoff = BufferUtils.createFloatBuffer(0.0f, 0.00001f, 0.0f, 0.0f);
Beautiful! This is why I read the forums. I want this feature, and didn't know how there was a OpenGL feature to do it. I am doing the distance fadeoff for particles by myself right now. I'd love to move that out of my code's responsibility.
Plus this gives me a better formula to do the fadeoff if this isn't implemented.
How does performance compare? Do you feel this is something that could be setup (for performance gains) as part of the particle system as an auto-enable on supporting platforms?
I didn't do any specific benchmarks or anything like that, I don't even understand how point rendering works..
I assume that a lot less data needs to be sent to the GPU, which saves bandwidth and memory on the video card.