Not really. Badly missing feature in Irrlicht so far. Irrlicht trunk allows at least to use more textures (up to 8) in SMaterial, but all other textures can only be accessed with some hacks.
Basically you have to work around Irrlicht and use OpenGL/Direct3D directly. And then bind textures to numbers above _IRR_MATERIAL_MAX_TEXTURES_.
Generally I try to avoid it and just set SMaterial textures.
edit: Some solution which we have in our project (one of DevSH's guys helped us there once).
Note, instead of hacking around accessing Irrlicht internals you can also look at the corresponding functions and just directly use OpenGL functions (cleaner code, this solution is not really the way to use a library usually).
Code: Select all
// Include source headers from Irrlicht engine
#include "../source/Irrlicht/COpenGLDriver.h"
#include "../source/Irrlicht/COpenGLCommon.h"
#include "../source/Irrlicht/COpenGLCoreTexture.h"
#include "../source/Irrlicht/COpenGLCacheHandler.h"
// Now you can directly cast to the COpenGLDriver from the IVideoDriver* (assuming you actually use opengl)
video::COpenGLDriver* gldriver = static_cast<video::COpenGLDriver*>(videoDriver);
// create some texture
irr::u32 GL_randomTexture = 0;
irr::u32 RAND_TEX_SZ = 64u;
GLubyte* pixels = new GLubyte[RAND_TEX_SZ * RAND_TEX_SZ]; // should be filled with some colors probably
gldriver->extGlCreateTextures(GL_TEXTURE_2D, 1, &GL_randomTexture);
gldriver->extGlTextureStorage2D(GL_randomTexture, GL_TEXTURE_2D, (GLsizei)(log2(RAND_TEX_SZ) + 1.5f), GL_R8, RAND_TEX_SZ, RAND_TEX_SZ);
gldriver->extGlTextureSubImage2D(GL_randomTexture, GL_TEXTURE_2D, 0, 0, 0, RAND_TEX_SZ, RAND_TEX_SZ, GL_RED, GL_UNSIGNED_BYTE, pixels);
gldriver->extGlTextureParameteri(GL_randomTexture, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
gldriver->extGlTextureParameteri(GL_randomTexture, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
gldriver->extGlTextureParameteri(GL_randomTexture, GL_TEXTURE_WRAP_S, GL_REPEAT);
gldriver->extGlTextureParameteri(GL_randomTexture, GL_TEXTURE_WRAP_T, GL_REPEAT);
if (gldriver->queryOpenGLFeature(irr::video::COpenGLExtensionHandler::IRR_EXT_texture_filter_anisotropic) || gldriver->Version >= 406)
gldriver->extGlTextureParameteri(GL_randomTexture, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16);
gldriver->extGlGenerateTextureMipmap(GL_randomTexture, GL_TEXTURE_2D);
delete[] pixels;
// bind it
GLenum randTexTarget = GL_TEXTURE_2D;
gldriver->extGlBindTextures(_IRR_MATERIAL_MAX_TEXTURES_ + 1, 1, &GL_randomTexture, &randTexTarget);
// delete it
if (GL_randomTexture)
{
glDeleteTextures(1, &GL_randomTexture);
GL_randomTexture = 0;
}