Subject: | texture does not work on specific debian machine |
Date: | Tue, 28 Jul 2009 16:06:54 +0200 |
To: | bug-OpenGL [...] rt.cpan.org |
From: | Wim de Vries <wsvries [...] xs4all.nl> |
Hi,
I have a pogl script that works on one Debian machine, but not on
another Debian machine.
A targa file is loaded and should be displayed as texture, but it is not
displayed on one of the machines. (It is possible to write it back to
disk though).
Both machines are Intel 2 DuoCore.
The script works OK on a HP Compaq 6910p: Mesa DRI Intel(R) 965 4.1.3002
It does not work on a self-build box: Mesa DRI Intel(R) 945G 20061017.
Both machines have the same OpenGL/POGL/glut etc. libraries installed.
Other Opengl scripts (with binary loaded image data) do work fine on the
self-build machine.
Please see code below.
Could it be an error in the diver?
Thanks.
#!/usr/bin/perl -w
use strict;
use OpenGL::Image;
use OpenGL qw/ :all /;
my $image_file = "400x400map.tga";
my $inf = OpenGL::Image::GetEngines();
my %engine = %$inf;
print "Using POGL v$OpenGL::BUILD_VERSION\n";
foreach my $name (sort keys %engine) {
print "$name:";
my $val = $engine{$name};
my %engine_info = %$val;
foreach my $key (sort keys %engine_info)
{print "$key:";
print $engine_info{$key}."\n";
}
}
my @texName;
my $tex = new OpenGL::Image(source=>$image_file);
my($ifmt,$fmt,$type) = $tex->Get('gl_internalformat','gl_format','gl_type');
my($w,$h) = $tex->Get('width','height');
print "$w,$h\n";
my $size = 2 ** ($tex->GetPowerOf2());
print "size:$size\n";
glutInit();
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(400,400);
glutInitWindowPosition(0,0);
glutCreateWindow("image");
glutDisplayFunc(\&display);
glutReshapeFunc(\&reshape);
glutKeyboardFunc(\&keyboard);
myInit();
glutMainLoop();
sub myInit
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel(GL_FLAT);
glEnable(GL_DEPTH_TEST);
@texName = glGenTextures_p(1);#get a free name
my $textureName = $texName[0];
print "tn:".length(@texName)."\n";
glBindTexture(GL_TEXTURE_2D, $texName[0]); #instantiate and use
texture object
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D_c(GL_TEXTURE_2D, 0, $ifmt, $w, $h, 0, $fmt, $type,
$tex->Ptr()); #specify a two-dimensional texture image
}
sub display{
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBindTexture(GL_TEXTURE_2D, $texName[0]); #instantiate and use
texture object
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex3f(-1, -1, 0.0);
glTexCoord2f(0.0, 1.0); glVertex3f(-1, 1, 0.0);
glTexCoord2f(1.0, 1.0); glVertex3f(1, 1, 0.0);
glTexCoord2f(1.0, 0.0); glVertex3f(1, -1, 0.0);
glEnd();
glFlush();
glDisable(GL_TEXTURE_2D);
print "display\n";
}
sub reshape
{my ($w, $h) = @_;
print "reshape\n";
glViewport (0, 0, $w,$h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
}
sub keyboard
{my ($key, $x, $y) = @_;
print "key\n";
}
__END__
:endofperl