How to draw a 2D image onto a 3d scene node??

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
mrwang2000
Posts: 7
Joined: Mon Jan 28, 2008 5:09 pm
Location: China

How to draw a 2D image onto a 3d scene node??

Post by mrwang2000 »

I create a 3d "wall" for "painting" in my game(for practice), I want it like this: when I click the "wall", an image would be "painted" on the target point of the "wall".

Is there any solution ??

thank you very much.
Virion
Competition winner
Posts: 2149
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

you can check out the collision tutorial. i think you can use that to determine the position where you should put your quad with the texture.
My company: https://kloena.com
My profile: https://zhieng.com
My co-working space: https://deskspace.info
My game engine: https://kemena3d.com
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

you could try to use a decal for this... ;)
it's the same if you "paint" a bullet hole or a picture to the wall... ;)

http://irrlicht.sourceforge.net/phpBB2/ ... hp?p=21113
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
mrwang2000
Posts: 7
Joined: Mon Jan 28, 2008 5:09 pm
Location: China

Post by mrwang2000 »

first, thank you for your fast reply.

I have got the interaction point and triangle on the "wall", but I do not know how to draw the "Image" just like pasting on the "wall"

Acki:
I compile your code but got a compiler error:
can not found ISceneNode::OnPreRender()... ...

and there is another question: when the interaction point is near by the "wall" and "ground", if the "wall" can only display part of the "image", I want that the rest part of the "image" can be painted on the ground. how to do that???

thanks again
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

well, it's not my code... ;)

ok, OnPreRender doesn't exist anymore, it was changed to OnRegisterSceneNode, so simply change the function name... ;)
but if you don't get it to work, you can also try my IrrExtensions, there I added a decal scene node similar to this one... ;)

for the ground thingy you'll have to do some math...
you need to know the height of the floor and the position of the front of the wall...
also the height/position and size of the "painting"...
than you can calculate how many of the painting on the wall is below the floor and put a second painting on the floor so it looks just the missing part out of the wall...

I hope you know what I mean... ;)
also there are probably other ways to do this...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
mrwang2000
Posts: 7
Joined: Mon Jan 28, 2008 5:09 pm
Location: China

Post by mrwang2000 »

thank you Acki.

after change code as you told me , I can successfully compile my application now.

but I can only draw a "white box" on my "wall" , the image and the transparency feature seems not work :( , could you give me some suggestion??
:wink:
mrwang2000
Posts: 7
Joined: Mon Jan 28, 2008 5:09 pm
Location: China

Post by mrwang2000 »

mrwang2000 wrote:thank you Acki.

after change code as you told me , I can successfully compile my application now.

but I can only draw a "white box" on my "wall" , the image and the transparency feature seems not work :( , could you give me some suggestion??
:wink:

OK, the images can display now :D , but the transparency ... ... :(
mrwang2000
Posts: 7
Joined: Mon Jan 28, 2008 5:09 pm
Location: China

Post by mrwang2000 »

mrwang2000 wrote:
mrwang2000 wrote:thank you Acki.

after change code as you told me , I can successfully compile my application now.

but I can only draw a "white box" on my "wall" , the image and the transparency feature seems not work :( , could you give me some suggestion??
:wink:

OK, the images can display now :D , but the transparency ... ... :(
OK,the transparency is work now too, :D :D :D

thank you all very much!!!!!!
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

As stated in most cases, please share your solutions with the community.

Its great you figured it out tell us what worked :)
Post Reply