More than 4 texture layers, working.

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
andres
Competition winner
Posts: 78
Joined: Tue Jul 08, 2008 5:18 pm
Location: Guarapuava/Brazil
Contact:

More than 4 texture layers, working.

Post by andres »

Hi guys, i've modified the COpenGLDriver.cpp and SMaterial.h files to work with more than 4 texture layers, here the engine still running very well (video card is Geforce 9500M GS with 16 texture units), this change in the engine can cause problems to my games (when running in other video cards)?

When i change the MATERIAL_MAX_TEXTURES to 8 just 4 layers work, the glGetIntegerv(GL_MAX_TEXTURE_UNITS, &num) in COpenGLDriver.cpp does not return the correct value, is that a bug?

ps: my game will not support older video cards, just 2.0+ pixel/vertex shaders.
Prof. Andres Jessé Porfirio
Federal Technological University of Parana (UTFPR)
www.andresjesse.com
http://irrrpgbuilder.sourceforge.net

Image
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The number is the limit for fixed function pipeline. Irrlicht does not support pixel shader only pipelines and hence does not set up the texture limits in that way. We will add support for the other limit in another version of Irrlicht, though. Until then you have to add those features on your own.
devsh
Competition winner
Posts: 2049
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

in the openGL Extension handler class make clone the MaxTextureUnits variable (i.e. MTU2) and set it to 8. Then just make a new function in the openGL driver, basically a clone of setActiveTexture() (i.e. setActiveTextureShader() ) and make it use MTU2 instead of MaxTextureUnits so the limit is 8. Then in OpenGL GLSL renderer in the function that sets the active textures of a material (i think it is in OnSetMaterial() ) just swap the function from setActiveTexture() to setActiveTextureShader(). And then do a happy recompile!!! Do not set the texture limit above 16 or there will be tears.
andres
Competition winner
Posts: 78
Joined: Tue Jul 08, 2008 5:18 pm
Location: Guarapuava/Brazil
Contact:

Post by andres »

works fine now, i've setted MaxTextureUnits to 8.
thanks for response.
Prof. Andres Jessé Porfirio
Federal Technological University of Parana (UTFPR)
www.andresjesse.com
http://irrrpgbuilder.sourceforge.net

Image
Post Reply