Click here to get back home

One Perl/OpenGL texture

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
One Perl/OpenGL texture weer1 11-24-2006
Posted by weer1 on November 24, 2006, 6:36 am
Please log in for more thread options


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();



Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap