PDA

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



SagoO
04-13-2011, 07:41 AM
Hi,

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?

ZbuffeR
04-13-2011, 09:09 AM
http://www.arcsynthesis.org/gltut/

V-man
04-13-2011, 11:25 AM
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.
http://fly.cc.fer.hr/~unreal/theredbook/

and click on
Chapter 9: Texture Mapping