Hi,

Sorry that I am still not understand it clearly, let’s begin with follow 
example:

If I have a vertex array as bellow:

GLint vert[4 * 3]    = {
        -1,  1, 0,
        -1, -1, 0,
        1,  1, 0,
        1, -1, 0 };

And a rectangle will be drawn by:

glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FIXED, 0, vert);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

And if I want to bind a texture to this object without rotation, so how to 
decide the coordinator of the texture ?

Thanks,
Song

From: interest-bounces+song.7.liu=nokia....@qt-project.org 
[mailto:interest-bounces+song.7.liu=nokia....@qt-project.org] On Behalf Of ext 
Till Oliver Knoll
Sent: Saturday, December 29, 2012 10:09 PM
To: Qt Project
Subject: Re: [Interest] About the coordinator between the texture and vertex in 
opengl



Am 29.12.2012 um 12:52 schrieb 
<song.7....@nokia.com<mailto:song.7....@nokia.com>>:
...
The problem is about binding a texture to an object, but i am quite not 
understanding how is the texture coordinator decided according to the vertex 
coordinator ?

Your question is indeed a little bit off-topic, but your assumption about 
OpenGL experts here on this list is probably true (disclaimer: it's been quite 
some while I did some OpenGL code, and that was back when OpenGL 1.4 was 
current, so "expert" doesn't necessarily include me ;)).

If you haven't done already study this example:

  http://doc.qt.digia.com/qt/opengl-textures.html


specifically


http://doc.qt.digia.com/qt/opengl-textures-glwidget-cpp.html


In GLWidget::makeObject you'll see how for every vertex (world coordinates are 
usually denoted as X, Y, Z) a corresponding texture coordinate (usually denoted 
U, V) is specified. That data is then passed on to OpenGL as array with 
glTexCoordPointer (the "non-OpenGL ES 2 code path") or as array attribute to 
the GL shader program.


Cheers,
  Oliver




_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to