Now that we're all set up to use the SOIL library, let's go to our triangle code and make the necessary changes to load our shape and apply texture to it. Follow these steps:
- So, we'll first include the SOIL library into our code; for that, type in the following line at the start of your code:
Here, we have typed SOIL2/SOIL2.h because our library is inside the SOIL2 folder.
- The next thing we're going to do is enable the alpha support for images with extension such as PNG. To do that, type in the following lines of code after we have defined out glViewport() :
// enable alpha support glEnable( GL_BLEND ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
In the preceding lines of ...