Tutorial 03.Custom SceneNode Index order [SOLVED]

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
strale
Posts: 119
Joined: Wed Nov 23, 2005 1:58 pm
Location: Lambrugo Italy
Contact:

Tutorial 03.Custom SceneNode Index order [SOLVED]

Post by strale »

Hello

I was traying to get through the mesh buffer vertex and index
I noticed that in the example 03.Custom SceneNode

if i modify
u16 indices[] = { 0,2,3,....
into
u16 indices[] = { 0,3,2,.......

a face of the shape dissapear
i use openGL c)option with Linux

is this correct?
May be i have misunderstand the index functionality?
could it be an error of my openGL?

Thank you

Code: Select all

virtual void render()
	{
               //OK  u16 indices[] = {	0,2,3, 2,1,3, 1,0,3, 2,0,1	}; 
		u16 indices[] = {	0,3,2, 2,1,3, 1,0,3, 2,0,1	};

		video::IVideoDriver* driver = SceneManager->getVideoDriver();
		driver->setMaterial(Material);
		driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
		driver->drawIndexedTriangleList(&Vertices[0], 4, &indices[0], 4);
	}
Last edited by strale on Wed Oct 07, 2009 6:56 am, edited 1 time in total.
Eigen
Competition winner
Posts: 375
Joined: Fri Jan 27, 2006 2:01 pm
Location: Estonia
Contact:

Post by Eigen »

If you reverse the index order, you're basically flipping the triangle, so the normal points down instead. Try disabling back face culling and you should be able to see it again.
strale
Posts: 119
Joined: Wed Nov 23, 2005 1:58 pm
Location: Lambrugo Italy
Contact:

Post by strale »

It works!

SolidNode->setMaterialFlag(video::EMF_BACK_FACE_CULLING, false);

Thankyou :D
Eigen
Competition winner
Posts: 375
Joined: Fri Jan 27, 2006 2:01 pm
Location: Estonia
Contact:

Post by Eigen »

Bare in mind that disabling back face culling can lower your performance, depending on many triangles there are. So it's better to face all triangles the right way and enable back face culling.
strale
Posts: 119
Joined: Wed Nov 23, 2005 1:58 pm
Location: Lambrugo Italy
Contact:

Post by strale »

now that' s becoming clearer
Thanks
Post Reply