Find out the max supported texture dimension for the underlying graphics card

I am sorry if I should know this but I have been trawling through the API documentation trying to find out how I get the max supported texture dimensions i.e. GL_MAX_TEXTURE_SIZE (I assume anyway) so that when generating a texture dynamically I can protect against using a texture which is too large for the underlying graphics card.

Is this exposed in JME or do I have to call into the underlying OpenGL to get that out? What is the optimum way of finding this out?

Most cards support 2048 and higher, I can’t imagine why you would need a texture larger than that.

Are you doing any GPU processing on the texture by any chance?

4048 is supportet by mostly all cards taht also support opengl2

However I would like to have such a command as well, for finding out how large texture atlas’s i can use on a system. (Cause a 4048^2 atlas is actually not that large at all)

I suppose this is possible, we already support retrieving of renderer caps through renderer.getCaps(). Perhaps we can have a similar method for renderer limits? Like renderer.getLimits().getMaxTextureSize() for example.

System.out.println("Max Texture size: " + GL11.glGetInteger(GL11.GL_MAX_TEXTURE_SIZE));

works in opengl thread. And seems to deliver reasonable values.

Max Texture size: 8192

on my ati 3750hd

You should however use dds images for such sizes! as uncompressed formats reach with that resolution 265 mb ram usage while a compressed is less than 50.

However for all D3D10 ready hardware the limit should be at least this, at it is one of the requirements to support 8k textures.

I will explain what I am doing. I am a developer doing a research project using the Open Wonderland platform. My specific research is using it for crime scene reconstruction / simulation. I am creating a Wonderland module which is used to create a ruler. In a crime scene, when photographs are being taken usually a ruler is put down next to items of evidence to provide scale. I am using texturing to create the notches on the ruler. Rather than this being a static image which is loaded separately I am using an AWT image and drawing into it then loading this image as a texture. The image can vary in size depending on the required ruler length and the units being used. For example if millimetres are used then the image is built up out of blocks with notches in representing each centimetre. The actual ruler uses different texture coordinates to cut out of the texture the blocks used to represent each centimetre. This is done so that the texture created uses the smallest power of two dimensions which can fit all the blocks of the ruler. The leftover areas are left blank. Due to the texture dimensions needed increasing as the texture gets bigger I want to put in place a safety check to make sure that the texture is not going to end up larger than the graphics card supports. In practice I would expect dimensions of 256 or more to be fine for a metre or yard stick / ruler. I could just repeat the texture if I weren’t being a perfectionist and also trying to write each unit i.e. 10, 20, 30 to the texture as well.