![]() ![]() Our texture image will be located in the resources folder and can be accessed as a CLASSPATH resource and passed as an input stream to the PNGDecoder class. ![]() Now we will create a new Texture class that will perform all the necessary steps to load a texture. Since we are using GLSL shaders it is not required anymore. This is true if you are using the fixed-function pipepline. One thing that you may see in some web pages is that the first thing we must do is enable the textures in our OpenGL context by calling glEnable(GL_TEXTURE_2D). So the associated coordinates array will be like this: float positions = new float Īnd define the version of the library to use. In order to draw a cube we just need to define eight vertices. With the code base we have created, in order to draw a cube we just need to correctly define the coordinates of a cube and it should be drawn correctly. ![]() In order to show all the concepts related to textures we will transform the quad that we have been using in previous chapters into a 3D cube. In this chapter we will learn how to load textures and use them in the rendering process.
0 Comments
Leave a Reply. |