So in trying to make my own draw call for the scene, but I'm running into problems. When I look at the source for the drawAll function in the sceneManager I dont get where the culling comes in. I really dont mind doing my own culling though.
Also, I read that its faster for the video driver to draw objects with the same materials together so the shader data doesn't keep getting changed in between object renders, but does anyone know how to implement this? I know the driver material switch(driver->setMaterial) happens in the actual render call in meshSceneNodes but is there something special you have to do when setting the driver material to make sure you dont waste time by resetting the material everytime? Or does the setMaterial function check first before changing the data in the gpu shader?
And does anyone know exactly when the onSetConstants function for shaders gets called? I thought it was supposed to be every time the material was set to the video driver but I feel its being called more that once per frame.
And is there anything else I need to keep in mind?
Rendering the scene yourself
Re: Rendering the scene yourself
Culling happens in CSceneManager::isCulled. You can set the culling-type of your node with ISceneNode::setAutomaticCulling. You have to make sure the bounding-boxes of your node are correct.
The drivers care about not switching the material state unless materials are different, see for example COpenGLDriver::setRenderStates3DMode().
I don't know about shaders.
The drivers care about not switching the material state unless materials are different, see for example COpenGLDriver::setRenderStates3DMode().
I don't know about shaders.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Rendering the scene yourself
Thank you for the info. It really helps me out.
In case anyone is just curious, I've run a few tests in my program and have figured that the onSetConstants function gets called every time the material is "set" even if the driver is already set to that material. It still takes place even if there is no actual switch of materials.
In case anyone is just curious, I've run a few tests in my program and have figured that the onSetConstants function gets called every time the material is "set" even if the driver is already set to that material. It still takes place even if there is no actual switch of materials.
Re: Rendering the scene yourself
It may be to set uniforms per mesh/meshbuffer.