O'Reilly logo

Irrlicht 1.7 Realtime 3D Engine by Aung Sithu Kyaw, Johannes Stein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - drawing a 2D image

Let's use the template application from Chapter 2, Creating a Basic Template Application as a base for this exercise. We'll load an image from Irrlicht's media folder and draw it:

  1. After the line IVideoDriver* driver = device->getVideoDriver(); add ITexture* image = driver->getTexture("../../media/irrlichtlogo2.png");.

    Tip

    You can use another image from the media folder or any other image of your choice. Just make sure the filename and path are correctly passed to the getTexture() method.

  2. In the "game loop" between the beginScene() and endScene() methods add driver->draw2DImage(image, position2d<s32>(50, 50), rect<s32>(0, 0, 128, 128), 0, SColor(255, 255, 255, 255), true);.

    Your full source code should look like ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required