• Advertisement
Sign in to follow this  

Problem on texture mapping quad drawing

This topic is 4155 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In the following code, w and h stand for width and height, the code specification said that this function aim to find the maximum value of an array of w*h by computing the local maximum of each 2x2 group of elements in one kernel. But I can't understand how this is done by the code below. Can anyone please help me?
void drawQuad(int w, int h) {

    glMultiTexCoord2f(GL_TEXTURE0, -0.5, -0.5);
    glMultiTexCoord2f(GL_TEXTURE1,  0.5, -0.5);
    glMultiTexCoord2f(GL_TEXTURE2, -0.5,  0.5);
    glMultiTexCoord2f(GL_TEXTURE3,  0.5,  0.5);
    glVertex2f(0.0, 0.0);

    glMultiTexCoord2f(GL_TEXTURE0, 2*w-0.5, -0.5);
    glMultiTexCoord2f(GL_TEXTURE1, 2*w+0.5, -0.5);
    glMultiTexCoord2f(GL_TEXTURE2, 2*w-0.5,  0.5);
    glMultiTexCoord2f(GL_TEXTURE3, 2*w+0.5,  0.5);
    glVertex2f(w, 0.0);

    glMultiTexCoord2f(GL_TEXTURE0, 2*w-0.5, 2*h-0.5);
    glMultiTexCoord2f(GL_TEXTURE1, 2*w+0.5, 2*h-0.5);
    glMultiTexCoord2f(GL_TEXTURE2, 2*w-0.5, 2*h+0.5);
    glMultiTexCoord2f(GL_TEXTURE3, 2*w+0.5, 2*h+0.5);
    glVertex2f(w, h);

    glMultiTexCoord2f(GL_TEXTURE0, -0.5, 2*h-0.5);
    glMultiTexCoord2f(GL_TEXTURE1,  0.5, 2*h-0.5);
    glMultiTexCoord2f(GL_TEXTURE2, -0.5, 2*h+0.5);
    glMultiTexCoord2f(GL_TEXTURE3,  0.5, 2*h+0.5);
    glVertex2f(0.0, h);
[Edited by - rosicky2005 on November 16, 2006 3:08:09 AM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement