Why is my mesh not drawing if i do drawPrimitiveList after?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
shekarman
Posts: 1
Joined: Tue Aug 04, 2015 10:09 pm

Why is my mesh not drawing if i do drawPrimitiveList after?

Post by shekarman »

Hi,

Very new to Irrlicht. I have a program that draws a mesh of triangles. In the device->run() loop, I added another draw command (to draw a primitive list of vertices) and that is now inhibiting the draw of the mesh. Here is the run loop:

Code: Select all

 
    while (device->run()) {
        driver->beginScene(true, true, video::SColor(0, 100, 100, 100));
        manager->drawAll();
        driver->drawVertexPrimitiveList(axes, 6, indices, 3, video::EVT_STANDARD, scene::EPT_LINES, EIT_16BIT);
        driver->endScene();
    }
 
If I comment out the drawVertexPrimitveList, I get the mesh to display but otherwise I only see the lines being displayed. What am I doing wrong?

Thanks.
chronologicaldot
Competition winner
Posts: 688
Joined: Mon Sep 10, 2012 8:51 am

Re: Why is my mesh not drawing if i do drawPrimitiveList aft

Post by chronologicaldot »

Without seeing the rest of your code, it's hard to tell what you're doing wrong.
Generally speaking, though, you should create a scene node that draws the vertex primitive list for you. Then everything is streamed through the scene manager.
You can create a scene node that does your drawing by creating a class that inherits ISceneNode and implements OnRegisterSceneNode() and render().

Code: Select all

 
void MyClass::OnRegisterSceneNode()
{
SceneManager->registerNodeForRendering(this);
}
 
void MyClass::render()
{
SMaterial material;
material.Lighting = false; // This ensures it will show up even when the lights are gone
SceneManager->getVideoDriver()->setMaterial( material );
SceneManager->getVideoDriver()->drawVertexPrimitiveList( axes, 6, indices, 3, video::EVT_STANDARD, scene::EPT_LINES, EIT_16BIT );
}
 
Post Reply