One texture Perl / OpenGL

Discussion in 'Perl Misc' started by weer1@gmx.net, Nov 24, 2006.

  1. Guest

    Hi,

    I want to do a texture on a polygon but I think I am missing something
    here.
    Nowhere in the code I see a connection with my polygon but the polygon
    turns flickering black and green when I do enable the texture. I have
    the code below now.

    Any ideas?

    MD
    ---------
    ...
    glBegin(GL_POLYGON);
    glVertex3f(0, 0, 1);
    glVertex3f(0, 0.5, 1);
    glVertex3f(1, 0, 1);
    glEnd();

    # make texture
    my $img = new Imager;
    $img->open(file=>'check.png', type=>'png'); # initializes
    from file
    my $texid = glGenTextures_p(1);
    glBindTexture(GL_TEXTURE_2D, $texid);
    glTexImage2D_c(GL_TEXTURE_2D, 0, 3, 32, 32, 0, GL_RGB, GL_BYTE,

    $img); # not sure its _c
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
    GL_LINEAR);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
    GL_LINEAR);
    glEnable(GL_TEXTURE_2D);
    # glClearColor(0, 0.3, 0.6, 1);
    #end texture

    glPopMatrix();
    glutSwapBuffers();
    , Nov 24, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    5,393
    Andrew Thompson
    Sep 2, 2005
  2. Xpyder
    Replies:
    3
    Views:
    378
    Victor Bazarov
    Mar 5, 2005
  3. stacey

    Problem with texture of UI

    stacey, Jan 21, 2007, in forum: Java
    Replies:
    3
    Views:
    347
    Larry Barowski
    Jan 23, 2007
  4. Replies:
    2
    Views:
    101
  5. Replies:
    2
    Views:
    157
Loading...

Share This Page