Can Irrlicht draw a piece of surface?

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
mybiandou
Posts: 32
Joined: Thu Sep 10, 2009 6:20 am

Can Irrlicht draw a piece of surface?

Post by mybiandou »

I am a beginner of Irrlicht.

I want to draw a piece of surface. For example, there are four corner points, P1,P2,P3,P4

Can I draw a surface according to the four points?

By now, I used driver->drawIndexedTriangleList() to draw 2 triangle plane,
P1-P2-P4 and P1-P4-P3.
But I only can see the surface on the top direction of the surface but can not see it on side direction( I know it is because the surface has not thickness).

Is there any method to make it visible ? (Of course, I can draw a thin block to do this, but it wasted too much)

Thank you for your kindly help.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Re: Can Irrlicht draw a piece of surface?

Post by vitek »

mybiandou wrote:I want to draw a piece of surface. For example, there are four corner points, P1,P2,P3,P4

Can I draw a surface according to the four points?
This is exactly what happens when you use drawIndexedTriangleList(). It draws the surface using the four points, rendering it as two triangles.
mybiandou wrote: By now, I used driver->drawIndexedTriangleList() to draw 2 triangle plane,
P1-P2-P4 and P1-P4-P3.
But I only can see the surface on the top direction of the surface but can not see it on side direction( I know it is because the surface has not thickness).
Yes. A plane has no thickness.
mybiandou wrote:Is there any method to make it visible ? (Of course, I can draw a thin block to do this, but it wasted too much)
If you want to be able to see the object as a rectangular hexahedron, you have no choice but to give it thickness. If you just want to be able to see the surface from both sides, but don't need it to have thickness, you could just disable backface culling when rendering the verticies, or you could render the triangles again in the order P1-P4-P2 and P1-P3-P4.

BTW, I have no idea what you mean when you say it wasted too much.

Travis
mybiandou
Posts: 32
Joined: Thu Sep 10, 2009 6:20 am

Re: Can Irrlicht draw a piece of surface?

Post by mybiandou »

Thank you for your kindly answer.

It seems that I have to draw the sheet on the top surface and bottom surface and the two side thickness surface.
Malgodur
Posts: 195
Joined: Sun Mar 15, 2009 8:22 pm

Post by Malgodur »

Maybe he wants to see both sides of his plane?

Disable backface and frontface culling in your material, eg

Code: Select all

						video::SMaterial m;
						m.BackfaceCulling=false;
						driver->setMaterial(m);
						driver->drawIndexedTriangleList
mybiandou
Posts: 32
Joined: Thu Sep 10, 2009 6:20 am

Post by mybiandou »

Yes, I need see both side.

I will try disabling BackfaceCulling later.

Now, I just draw the outer surface and inner surface and the four surface on thickness direction.

Thank you all very much
Post Reply