Little C++ opengl help please :)

Started by
15 comments, last by Solance 18 years, 10 months ago
Could i get a example of how to use this say i have a image drawn like so.

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();



how would i grab say a 16x16 portion from 32x32 using glCopyTexSubImage2D()? [Edited by - Solance on May 26, 2005 5:32:17 PM]
Advertisement
hum.. ne one?
I have tried 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?
Please anyone i really badly need some help with this.
The simpler and faster method is to use different texture coordinates,
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?
did you enable texture mapping?

glEnable(GL_TEXTURE_2D);
Yes its enabled? any other options.
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?
yes i can draw the texture to the screen fine, but when i draw it the copy just gets white, using x=0 y=0 still just white everything is just white.

This topic is closed to new replies.

Advertisement