glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f), glVertex3f(-1.0f, -1.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f), glVertex3f(1.0f, -1.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f), glVertex3f(1.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f), glVertex3f(-1.0f, 1.0f, 0.0f);
glEnd();
Little C++ opengl help please :)
Could i get a example of how to use this say i have a image drawn like so.
how would i grab say a 16x16 portion from 32x32 using glCopyTexSubImage2D()?
[Edited by - Solance on May 26, 2005 5:32:17 PM]
I have tried this
but all it draws is white... could i get a example of how you guys have used this?
glCopyTexSubImage2D( GL_TEXTURE_2D, 0, (x - CLIENTHBUF) * TILESIDE, (y - CLIENTVBUF) * TILESIDE, 0, 0, TILESIDE, TILESIDE );
but all it draws is white... could i get a example of how you guys have used this?
The simpler and faster method is to use different texture coordinates,
e.g.
HTH,
Pat
e.g.
// displays the upper left quarter of a given textureglBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 0.0f); glTexCoord2f(0.5f, 0.0f); glVertex3f(1.0f, -1.0f, 0.0f); glTexCoord2f(0.5f, 0.5f); glVertex3f(1.0f, 1.0f, 0.0f); glTexCoord2f(0.0f, 0.5f); glVertex3f(-1.0f, 1.0f, 0.0f);glEnd();
HTH,
Pat
Yes thanks for that but why does it, only draw white? could i get a example of the function in use?
Have you made sure the texure loading routine was successful, and that you have bound it before using glTexCoord with glBindTexture? You could also try disabling any lighting if that's enabled, just to make sure the lighting isn't the problem?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement