Lets start! | -||||||
-
-
-
- In the beginning, everything as usual. Include the needed headers, - ask the user for the rendering driver, create the Irrlicht Device: -
Now, we load an animated mesh to be displayed. As in most examples,
- we'll take the fairy md2 model. The difference here: We set the shininess
To make specular highlights appear on the model, we need a dynamic - light in the scene. We add one directly in vicinity of the model. - In addition, to make the model not that dark, we set the ambient light - to gray. -
The next is just some standard stuff: Add a user controlled camera - to the scene, disable mouse cursor, and add a test cube and let it - rotate to make the scene more interesting. -
To test out the render to texture feature, we need a render target - texture. These are not like standard textures, but need to be created - first. To create one, we call IVideoDriver::createRenderTargetTexture() - and specify the size of the texture. Please don't use sizes bigger - than the frame buffer for this, because the render target shares the - zbuffer with the frame buffer. And because we want to render the scene - not from the user camera into the texture, we add another, fixed camera - to the scene. But before we do all this, we check if the current running - driver is able to render to textures. If it is not, we simply display - a warning text. -
Nearly finished. Now we need to draw everything. Every frame, we
- draw the scene twice. Once from the fixed camera into the render target
- texture and once as usual. When rendering into the render target,
- we need to disable the visibilty of the test cube, because it has
- the render target texture applied to it.
|
-
- - + + +
Lets start! | +||||||
+
+
+
+ In the beginning, everything as usual. Include the needed headers, + ask the user for the rendering driver, create the Irrlicht Device: +
Now, we load an animated mesh to be displayed. As in most examples,
+ we'll take the fairy md2 model. The difference here: We set the shininess
To make specular highlights appear on the model, we need a dynamic + light in the scene. We add one directly in vicinity of the model. + In addition, to make the model not that dark, we set the ambient light + to gray. +
The next is just some standard stuff: Add a user controlled camera + to the scene, disable mouse cursor, and add a test cube and let it + rotate to make the scene more interesting. +
To test out the render to texture feature, we need a render target + texture. These are not like standard textures, but need to be created + first. To create one, we call IVideoDriver::createRenderTargetTexture() + and specify the size of the texture. Please don't use sizes bigger + than the frame buffer for this, because the render target shares the + zbuffer with the frame buffer. And because we want to render the scene + not from the user camera into the texture, we add another, fixed camera + to the scene. But before we do all this, we check if the current running + driver is able to render to textures. If it is not, we simply display + a warning text. +
Nearly finished. Now we need to draw everything. Every frame, we
+ draw the scene twice. Once from the fixed camera into the render target
+ texture and once as usual. When rendering into the render target,
+ we need to disable the visibilty of the test cube, because it has
+ the render target texture applied to it.
|
+
+ + -- cgit v1.1