Images

The following is the basic code that loads an image into a texture:

gl::Texture myTexture = gl::Texture( loadImage( loadAsset( "image.png" ) ) );

This texture then is drawn within the draw() function by using the following code:

gl::draw( myTexture, Rectf(100,100,540,380) );

The first parameter is the texture that contains the loaded image, and the second parameter is rectangle that is drawn within the texture.

To make this code example work, you have to import the following header files:

#include "cinder/gl/gl.h"
#include "cinder/ImageIo.h"
#include "cinder/gl/Texture.h"
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.85.221