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!
I got a simple question: How is it possible to use more than 4 textures? I worry that a couple of modifications to the engine are necessary, or? Perhaps there is already a patch?
Last edited by Delight on Fri Jun 08, 2007 11:14 am, edited 1 time in total.
If you need more than four textures in one material you have to change the const MATERIAL_MAX_TEXTURES in SMaterial and recompile. You have to redefine your materials, though, to take an advantage of it - shaders should be able to use them right away.
Mainly memory, but also no need for more. We have no advanced materials, yet, so we can restrict to 4 materials. Also there are no card which support more than 8 materials, many even only have 6. 4 is pretty safe.
I already changed the MATERIAL_MAX_TEXTURE constant, but when I use the new dll and assign a texture via setMaterialTexture( int, texture ), i got an unhandled exception during runtime in
Maybe the d3d driver does not check for the maximal textures available in hardware. I doubt this, but might be true. In OpenGL I added this some month ago.
Well I got a working example in Direct3D without Irrlicht, where 5 textures are set and all of them are displayed. OpenGl doesn't work for me neither...
Btw.: Beside setting the MATERIAL_MAX_TEXTURE constant I haven't to do anything?
From my experience, most OpenGL drivers only support 4 textures. I've had 8 textures working in DX, but never more than 4 working in OpenGL, not sure why.
So you got it working by setting the Max texture constant to 8? What could be the matter, that it's not working for me. The hardware shouldn't be the problem. As I already told I got a directX example with more than 4 textures working...
No, I'm sorry I didn't clarify. I maintain a different version of Irrlicht( IrrSpintz ). I used to support up to 8 textures, but stopped and dropped it to 4, because I couldn't get more than 4 to ever work in OpenGL.
I made some further tests. Setting the constant down works perfectly, but setting it to 5 crashes the application every time - even when I set the only first or second texture stage. The SetMaterialTexture(int, texture) doesn't seem to be the problem. The scene.DrawAll() is the problem. When I comment the line out, it's working perfectly...
A direct3d9 example with 5 textures works perfectly and shows all of them - so it cannot be a problem with my graphic card.
And finally I got it on my own: Beside the max texture constant i had to extend the E_TRANSFORMATION_STATE by one element (ETS_TEXTURE_4).
Now its working and my texture splatting fog of war and lighted terrain looks finally... veeeery nice