Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Texture problem?

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2003
    Posts
    6

    Texture problem?

    I have two textures in my scene. Half for sky and half for ground. When I ran displaying
    these two textures in one code, they two
    appeared. However, when I copy the same
    code of displaying two textures in another
    code. the ground one disappeared. I checked
    that the texture for ground is loaded
    correctly because I display it as sky and it
    appears. What can be the problem? Thanks for
    help.

  2. #2
    Member Regular Contributor
    Join Date
    Jul 2000
    Location
    Arlon, Belgium
    Posts
    486

    Re: Texture problem?

    When you say that your texture disappear, you mean that it is blank ?

    Post your drawgl scene code pls

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2003
    Posts
    6

    Re: Texture problem?

    // texture1 is ground
    // texture2 is sky
    // I can see texture2 only
    // if I switch them, I can see ground as sky.
    // texture1 never appears. This piece od code
    // works in another code. Thank you for your
    // help

    glDisable(GL_BLEND);
    texture1->activate(); //texture is a class

    glColor4f( c1, c2, c3, 1.0f );

    glBegin(GL_QUADS);
    glTexCoord2i(0, 3);
    glVertex3f(-300,-15.5,-300);
    glTexCoord2i(3, 3);
    glVertex3f( 300,-15.5,-300);
    glTexCoord2i(3, 0);
    glVertex3f( 300,-15.5, 500);
    glTexCoord2i(0, 0);
    glVertex3f(-300,-15.5, 500);
    glEnd();

    float t = 1.0;
    texture2->activate();
    glBegin(GL_QUADS);
    glTexCoord2f(0-t,3);
    glVertex3f(-300,100,-300);
    glTexCoord2f(3-t,3);
    glVertex3f(300,100,-300);
    glTexCoord2f(3-t,0);
    glVertex3f(300,100,500);
    glTexCoord2f(0-t,0);
    glVertex3f(-300,100,500);
    glEnd();

    glBegin(GL_QUADS);
    glTexCoord2f(0-t,1);
    glVertex3f(-300,-15.5,-300);
    glTexCoord2f(3-t,1);
    glVertex3f(300,-15.5,-300);
    glTexCoord2f(3-t,0);
    glVertex3f(300,100,-300);
    glTexCoord2f(0-t,0);
    glVertex3f(-300,100,-300);
    glEnd();

    glBegin(GL_QUADS);
    glTexCoord2i(0,1);
    glVertex3f(-300,-15.5,500);
    glTexCoord2i(3,1);
    glVertex3f(300,-15.5,500);
    glTexCoord2i(3,0);
    glVertex3f(300,100,500);
    glTexCoord2i(0,0);
    glVertex3f(-300,100,500);
    glEnd();

    glBegin(GL_QUADS);
    glTexCoord2i(0,1);
    glVertex3f(300,-15.5,-300);
    glTexCoord2i(3,1);
    glVertex3f(300,-15.5,500);
    glTexCoord2i(3,0);
    glVertex3f(300,100,500);
    glTexCoord2i(0,0);
    glVertex3f(300,100,-300);
    glEnd();

    glBegin(GL_QUADS);
    glTexCoord2i(0,1);
    glVertex3f(-300,-15.5,-300);
    glTexCoord2i(3,1);
    glVertex3f(-300,-15.5,500);
    glTexCoord2i(3,0);
    glVertex3f(-300,100,500);
    glTexCoord2i(0,0);
    glVertex3f(-300,100,-300);
    glEnd();

    glEnable(GL_BLEND);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •