View Full Version : Is it possible to render a texture on screen?

04-13-2011, 08:41 AM

I am learning openGL now. But I found that it is very complicated with the vertex value. I dont even know what values should I put in order to draw a simple cube. So, I plan to draw out a texture that I import from an image directly. Is it possible?

There are a lots of array in openGL. I am totally lost here. What kind of array should I use for texture?

04-13-2011, 10:09 AM

04-13-2011, 12:25 PM
A cube? Make it -1.0 to 1.0.

No, you can't draw a texture. You can only texturemap polygons.

What kind of array to use for a texture?
Assuming your image data is RGBA8, declare your array as
GLubyte *myarray = new GLubyte[w*h*4];

You might want to read the Red Book.
This is the online version of the first Red Book.

and click on
Chapter 9: Texture Mapping