Jump to content
  • Advertisement
Sign in to follow this  
rosicky2005

Problem on texture mapping quad drawing

This topic is 4274 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) {

    glBegin(GL_QUADS);
    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);
    glEnd();
}
[Edited by - rosicky2005 on November 16, 2006 3:08:09 AM]

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!