2 sides of a card

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
Varn1807
Posts: 7
Joined: Tue Jun 07, 2011 12:23 pm

2 sides of a card

Post by Varn1807 »

Hello i'm new to irrlicht so please don't jump on me if I say something wrong :P.
Using tutorial 3 i created the 2 nodes representing the 2 sides sides of a game card. On one I put a texture(the front of the card) and on the other the back of the card.

Now i need to create a node in which to add the other 2 nodes as child, and of course the distance between the 2 to be minimum so I can see them.
I have no ideea how to add child ( besides the simple function parent->addChild(child)).

Thanks in advance
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

It's not a good idea to create 2 different nodes to represent 1 card, it gets harder to manage and causes overhead since you need to do 2 draw calls for each card

Why not create a rather flat 2-sided card mesh which you can texture accordingly? You can then just manage this mesh with 1 scene node
Varn1807
Posts: 7
Joined: Tue Jun 07, 2011 12:23 pm

Post by Varn1807 »

the bad part is that i have to do it like this... don't get me wrong i'm not trying to make my homework or something like this. :))
Unfortunetly this is how i have to do it, i made the 2 nodes now i have to make a third node in witch to put the other 2 as children and i have no ideea how to do that
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

Varn1807 wrote:the bad part is that i have to do it like this... don't get me wrong i'm not trying to make my homework or something like this. :))
Unfortunetly this is how i have to do it, i made the 2 nodes now i have to make a third node in witch to put the other 2 as children and i have no ideea how to do that
And why exactly do you have to do it this way?

If you really have to, you could create an empty scene node and add both sides as children with the addChild() method, be sure to align their positions and rotations correctly
If you are using planes to represent the sides of the card you'll probably get z-fighting issues when you put them back to back though, so that's another reason for not using this approach
Varn1807
Posts: 7
Joined: Tue Jun 07, 2011 12:23 pm

Post by Varn1807 »

thanks for the answer, it's going to be hard/weird but thanks :D
ChaiRuiPeng
Posts: 363
Joined: Thu Dec 16, 2010 8:50 pm
Location: Somewhere in the clouds.. drinking pink lemonade and sunshine..

Post by ChaiRuiPeng »

Radikalizm wrote:
Varn1807 wrote:the bad part is that i have to do it like this... don't get me wrong i'm not trying to make my homework or something like this. :))
Unfortunetly this is how i have to do it, i made the 2 nodes now i have to make a third node in witch to put the other 2 as children and i have no ideea how to do that
And why exactly do you have to do it this way?

If you really have to, you could create an empty scene node and add both sides as children with the addChild() method, be sure to align their positions and rotations correctly
If you are using planes to represent the sides of the card you'll probably get z-fighting issues when you put them back to back though, so that's another reason for not using this approach

wouldn't z fighting only happen if their vertex normals arefacing the same direction? if from my understanding of authors post, those two planes would be invisible (their normals are opposite directions)
ent1ty wrote: success is a matter of concentration and desire
Butler Lampson wrote: all problems in Computer Science can be solved by another level of indirection
at a cost measure in computer resources ;)
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

Yes you are right, I wasn't thinking about the possibility of backface culling

Still, the one node per side approach really isn't ideal, and I'd be very interested to know why it has to be done like this exactly
grumpymonkey
Posts: 222
Joined: Mon Jan 19, 2009 10:03 pm
Location: Miami, Florida
Contact:

Post by grumpymonkey »

don't be so judgemental he's a beginner :lol:
Image
Post Reply