Hi all!
Back in the 'ol Irrlich 1.6 days you could quite easily change the 4-texture limit to 16 textures.
With the 1.7 I can only use 8 textures, does anyone have a 'hack' for even more (I'd upgrade to a more
recent Irrlicht if that is needed)?
Thanks!
Valmond
16 textures
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: 16 textures
There was never the possibility to use 16 textures. Simply because this requires a different texture access and enabling scheme. And that was never used in Irrlicht so far. So it was always just the fixed pipeline texture max. Before 1.7 you usually got problems with texture matrices above 4 textures, though. This is now fixed.
-
- Posts: 22
- Joined: Mon Nov 15, 2010 9:18 pm
Re: 16 textures
One thing I notice OpenGL driver is that I needed to change how MaxSupportedTextures is set up in the COpenGLExtensionHandler() ctor. Currently its:
Actually GL_MAX_TEXTURE_UNITS will always return 4 according to the GL spec, to actually work out how many textures you can have in one shader you need to change this to:
Code: Select all
if (Version>102 || FeatureAvailable[IRR_ARB_multitexture])
{
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &num);
MaxSupportedTextures=static_cast<u8>(num);
}
Code: Select all
if (Version>102 || FeatureAvailable[IRR_ARB_multitexture])
{
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &num);
MaxSupportedTextures=static_cast<u8>(num);
}
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: 16 textures
Unless this was changed in a very recent change of the GL specs, the method will not always return four. It will return at least 1. And it will return the number of maximally supported texture units in the fixed function pipeline. This is usually 6-8, but some drivers chose to return only 4 even though they support much more for the shader pipeline. The full specs are:
You're of course right in that we'd need a check for the texture_image units as well, and provide some way to handle these textures. But this is not yet implemented, so you have to live with the fixed functions maximum for now.
Please note that this is a more recent OpenGL version, which has multi-texturing supported by default. Of course this means that you will get at least 2 supported textures.GL_MAX_TEXTURE_UNITS
params returns a single value indicating the number of conventional
texture units supported. Each conventional texture unit includes both a texture coordinate set
and a texture image unit. Conventional texture units may be used for fixed-function (non-shader)
rendering. The value must be at least 2. Additional texture coordinate sets and texture
image units may be accessed from vertex and fragment shaders.
See glActiveTexture and
glClientActiveTexture.
You're of course right in that we'd need a check for the texture_image units as well, and provide some way to handle these textures. But this is not yet implemented, so you have to live with the fixed functions maximum for now.