Question on Scene Node Texture

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
nighthawk
Posts: 16
Joined: Tue May 30, 2006 5:43 am

Question on Scene Node Texture

Post by nighthawk »

Hi gurus,

I'm new to Irrlicht but I like it very much.

My project requires drawing a cube with different textures set to each of the cube surfaces. I created a customized scene node by extending ISceneNode. But I am wondering how I can set different textures to each of the cube surfaces instead of using the same one for all surfaces. Can anybody give me some clues?

Thanks a lot! 8)
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You put each face into a separate mesh buffer. Next you can set different textures and materials to each mesh buffer.
nighthawk
Posts: 16
Joined: Tue May 30, 2006 5:43 am

Post by nighthawk »

Thank you for the reply.

Could you please post some code snippet for me of which I can start from? I'm really new to Irrlicht.

Regards.
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, I generally don't post code here. It either raises several new questions (due to lack of understanding) or just reduces your amount of work while increasing mine (but results would be the same). So in order to distribute the amount of work appropriately and to ensure some learning effect I'll just point you to some places where to find hints or code.
Create new SMeshBuffers where you store vertices and indices (the values are just as in the custom scene node example). Each mesh buffer can hold arbitrary triangle faces with the same material. When done with adding faces you add the mesh buffer to your mesh with addMeshBuffer().
Materials in Irrlicht are based on SMaterial, so read the API for that. You can access the Material of Mesh buffers directly via meshBuffer.Material.
If you need some real code examples read the mesh loader code for any of the supported formats. These use mesh buffers and different materials per mesh.
nighthawk
Posts: 16
Joined: Tue May 30, 2006 5:43 am

Post by nighthawk »

Thank you, hybrid. Your reply is much more valuable than several lines of code because it points to the direction that I should go and infomation that I should check. I'm going to get more than what I have expected by following your advice.

By the way, what is the best way to learn Irrlicht? I have gone through all the examples line by line. I also played with the demo code. What should I do next?

I have long time Java experience but mainly on Web app development. My C++ is OK. I had some expose to CAD.

I have tried Java Monkey Engine but I was not satisfied with its performance. Then I cam across with Irrlicht. Irrlicht has everything that I need. But what is the best way to grab its power? Is there any boook that I can refer to? Or should I learn through the forum?

Thanks.
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Hmm, good question. I've learned Irrlicht by slowly extending my own project with several features and thus learning how to use them. So basically playin around with new things until they work. And I've read many source files from apps based on Irrlicht (usually while fixing compile problems under Linux :wink: )
Lately I've written some mesh file loaders which introduced some Irrlicht core techniques to me (and that's why I'd suggest to look into mesh file loader code to understand mesh buffers and such things).
Baal Cadar
Posts: 377
Joined: Fri Oct 28, 2005 10:28 am
Contact:

Post by Baal Cadar »

Maybe start programming a small simple game. (simple as the pong/tetris class of games)

Learning by doing. When you have subtask to do, you know too little about, skim the forum or look it up in some source file or API docs.
No offense :)
Post Reply