I´ve just started using Irrlicht and its really good and fast, but I can´t figure how to do two things, if any one could help clarify how:-
1. how do I map different jpg images to the sides of a cube or rectangular cube node (what´s a rect cube called?)
2. how to play video onto one side of a cube.
I would really appreciate it if anyone has any ideas!!!
Thanks
Mapping video and static images to cubes
if you have all the required images inside one texture then you can just use the texture coordinates to do this (assuming there are enough verts in the cube to allow it this).
or if they're all seperate textures you could have each side of the cube with a different material and set them via the mesh buffers. I would suggest not using the cube scene node from irrlicht but model a cube specifically for the task in a modelling app like blender or milkshape so that you can put the textures on yourself easily.
for the video it would be a similar approach as the video stream will come into your app as textures for each frame so you just stick the texture on as necessary.
or if they're all seperate textures you could have each side of the cube with a different material and set them via the mesh buffers. I would suggest not using the cube scene node from irrlicht but model a cube specifically for the task in a modelling app like blender or milkshape so that you can put the textures on yourself easily.
for the video it would be a similar approach as the video stream will come into your app as textures for each frame so you just stick the texture on as necessary.
thanks, its really good to know that there´s no problem to do this.
i have maybe a lot of reading to do so that i can understand what calls to make. the structure of the engine seems fantastic experimenting with the samples, and very efficient, but i need to understand the overall structure.
In my c++ app, i have 3D object info in an array that are updated by a database, the app then converts the db table´s text codes to one of numerous image files, which then have to change on the objects´surfaces.
so i have to map images to the object´s sides dynamically, deleting the old, or hiding it, and selecting the new. there may be 200 objects with different images on all sides, so i need to find the best way to set this up.
as a test i did this with a modified Movement sample like this, but it maps to the whole cube of course:-
if ( bChange )
n->setMaterialTexture(0, driver->getTexture("c:\image1.jpg"));
else
n->setMaterialTexture(0, driver->getTexture("c:\image2.jpg"));
I hope the old texture gets unloaded?
Is there anything you could recommend to read to understand the structure of the engine and the processes, as for now I can´t figure what calls to make to do what you suggest?
Thanks alot!
i have maybe a lot of reading to do so that i can understand what calls to make. the structure of the engine seems fantastic experimenting with the samples, and very efficient, but i need to understand the overall structure.
In my c++ app, i have 3D object info in an array that are updated by a database, the app then converts the db table´s text codes to one of numerous image files, which then have to change on the objects´surfaces.
so i have to map images to the object´s sides dynamically, deleting the old, or hiding it, and selecting the new. there may be 200 objects with different images on all sides, so i need to find the best way to set this up.
as a test i did this with a modified Movement sample like this, but it maps to the whole cube of course:-
if ( bChange )
n->setMaterialTexture(0, driver->getTexture("c:\image1.jpg"));
else
n->setMaterialTexture(0, driver->getTexture("c:\image2.jpg"));
I hope the old texture gets unloaded?
Is there anything you could recommend to read to understand the structure of the engine and the processes, as for now I can´t figure what calls to make to do what you suggest?
Thanks alot!
xyzzy
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Once you have a cube with multiple materials you simply access the meshbuffer of that side and change the texture there.
The texture handling is too inefficient, though. You should think about reuse of textures, texture grouping (texture atlas) and other things. As a start: Irrlicht has a texture cache, which avoids duplicated loading of textures. however, it also stores the textures (on the GPU) even if they are not used. So once you're done forever with a texture you should remove the texture from the texture cache. Instead of adding the textures again and again you can also lock the texture and write new content into it. This avoids the many textures on the GPU without manually deleting them. You need to tweak this handling to your actual needs.
The texture handling is too inefficient, though. You should think about reuse of textures, texture grouping (texture atlas) and other things. As a start: Irrlicht has a texture cache, which avoids duplicated loading of textures. however, it also stores the textures (on the GPU) even if they are not used. So once you're done forever with a texture you should remove the texture from the texture cache. Instead of adding the textures again and again you can also lock the texture and write new content into it. This avoids the many textures on the GPU without manually deleting them. You need to tweak this handling to your actual needs.
thanks, sounds very interesting.
the atlas i guess is like a cache for textures(images), so it can be preloaded it with say 200 small (320 x 240 px 24bbp) jpegs, and then the app can select the images into any object surface on each frame redraw.
i really need to understand the structure of the engine to do this right, is there any good documentation with structure diagrams of the engine?
I also have to manage object flight paths for all 200 objects, so probably someones already added functions for a range of flight paths, with curve fitting, velocity, etc?
I´ve seen the flystraight and circle calls, but probably there are more sophisticated procedures for flight calculation?
thanks, I appreciate the help
the atlas i guess is like a cache for textures(images), so it can be preloaded it with say 200 small (320 x 240 px 24bbp) jpegs, and then the app can select the images into any object surface on each frame redraw.
i really need to understand the structure of the engine to do this right, is there any good documentation with structure diagrams of the engine?
I also have to manage object flight paths for all 200 objects, so probably someones already added functions for a range of flight paths, with curve fitting, velocity, etc?
I´ve seen the flystraight and circle calls, but probably there are more sophisticated procedures for flight calculation?
thanks, I appreciate the help
xyzzy
there's also a follow spline animator which can be seen in action in the Demo example which uses the animator to animate the camera along a predetermined path of points.
in the SDk folder there's a doc folder and in there is a great .CHM help file which will be invaluable to you, it's also in HTML on the irrlicht webpage.
in the SDk folder there's a doc folder and in there is a great .CHM help file which will be invaluable to you, it's also in HTML on the irrlicht webpage.
Acki posted a fixed version here, or you can download from svn and build it yourself using the batch file in the scripts dir
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Then just use the online version http://irrlicht.sourceforge.net/docu/index.html