View Full Version : drawing texture part / zooming

05-11-2008, 05:27 PM
I'm trying to resize an image (using glTexCoord2f), and then enlarging it (using glVertex2f) except I'm having a problem.

If I were to enlarge the image without drawing a certain part, it would stretch out however far I want it. When I draw a certain part of an image I'll see the certain part I like to draw. When combining these two methods in one.. I don't really get far :(.

glTexCoord2f(pStartX / (float)fullwidth, pStartY/(float)fullheight);
glVertex2f(pX, pY);

glTexCoord2f((pStartX+pWidth)/(float)fullwidth, pStartY/(float)fullheight);
glVertex2f(pX + pWidth, pY);

glTexCoord2f(pStartX/(float)fullwidth, (pHeight + pStartY)/(float)fullheight);
glVertex2f(pX, pY + pHeight);

glTexCoord2f((pStartX+pWidth)/(float)fullwidth, ((pHeight + pStartY)/(float)fullheight));
glVertex2f(pX + pWidth, pY + pHeight);

05-12-2008, 03:38 AM
You explaination is not very clear. If you want to resize an image, you can use frame buffer objects to render to texture.
If you don't want to use this opengl extension, you can just draw the image in the framebuffer as a texture on a quad which size is the desired resized image size. then you can use the glCopyTexSubImage2D function to extract the interesting part of your framebuffer to a texture that you have bound before.

05-12-2008, 10:22 PM
Trying to draw a certain part of a texture, as well as be able to stretch that certain part I draw.