I’m sure you could implement S3TC support very easily. It would be very useful for games with big textures. To generate a texture with S3TC compression using LWJGL you simply need to do like that :
glTexImage2D(GL_TEXTURE_2D, 0, EXTTextureCompressionS3TC.GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, textureBuffer);
Another useful feature would be to add support for anisotropic textures. Once again, a little sample of code showing how to use it :
// Due to LWJGL buffer check, you can't use smaller sized buffers (min_size = 16 for glGetFloat()).
final FloatBuffer max_a = BufferUtils.createFloatBuffer(16);
// Grab the maximum anisotropic filter.
// Set up the anisotropic filter.
glTexParameterf(GL_TEXTURE_2D, EXTTextureFilterAnisotropic.GL_TEXTURE_MAX_ANISOTROPY_EXT, max_a.get(0));
Why anisotropic filtering ? It makes textures look nicer, without any artifact or other crack...
Tell me what you think about adding these features to the jME :).
funny you mention aniso filtering as I had set that up locally yesterday! I haven’t checked it in yet though because I haven’t been able to see a big difference in quality. I’m looking to write a demo that would let you switch it on and off from inside the demo, so that should help illustrate it and verify the addition works before I check it in…
With S3TC, would that enabled use of a texture already compressed as S3TC (thus requiring a new loader type perhaps?) or would it compress the given texture as S3TC before sending it to the card?
If you want I can send you two small demos with (LWJGL) code by mail (which are on my website but I currently have some hosting troubles). One using S3TC (it doesn’t require compression method, all is done by the card when generating the texture), the other showing the difference between classical & anisotropic filter…
You can PM me or contact me via ICQ/MSN/Mail !
Ok, Anisotropic filtering is in and working. There’s also a test that shows it off called TestAnisotropic. Hit ‘f’ to apply or remove the anisotropic filtering (it uses the max available on your platform.)
Anisotropic filtering is applied on a per texture basis. When you create a new texture object, set the anisotroic level like so:
myTexture.setAnisoLevel([some float number]);
You can get the max value for the given platform by creating a texture state and calling:
float maxAniso = myTextureState.getMaxAnisotropic();
One thing I noticed was it doesn't seem to add much to your scene to use MM_LINEAR_LINEAR AND anisotropic filtering. All it does is bring down FPS. ymmv though.
Just for some fun (and not related to anisotropic filtering,) this demo also shows off tiling a texture on a quad... It tiles one texture 5 times across and 5 times down (totally 25 times.) This was done simply by calling:
(q is the Quad)
and then on the Texture, make sure you set it to wrap mode:
Wow many thanks !
The jME team works fast ! That’s great