Skip to content
This repository was archived by the owner on Mar 19, 2025. It is now read-only.

Commit bf8b184

Browse files
committed
commit to using Mipmap
1 parent aa27259 commit bf8b184

1 file changed

Lines changed: 13 additions & 28 deletions

File tree

test.pl

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
};
5555

5656
# Some global variables.
57-
my $useMipMap = 1;
5857
my $hasFBO = 0;
5958
my $hasVBO = 0;
6059
my $hasFragProg = 0;
@@ -498,32 +497,18 @@ sub ourBuildTextures
498497
glBindTexture(GL_TEXTURE_2D, $TextureID_image);
499498

500499
# Use MipMap
501-
if ($useMipMap)
500+
print "Using Mipmap\n";
501+
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
502+
GL_NEAREST_MIPMAP_LINEAR);
503+
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
504+
GL_NEAREST_MIPMAP_LINEAR);
505+
# The GLU library helps us build MipMaps for our texture.
506+
if (($gluerr = gluBuild2DMipmaps_c(GL_TEXTURE_2D, $Tex_Type,
507+
$Tex_Width, $Tex_Height, $Tex_Format, $Tex_Size,
508+
$Tex_Pixels->ptr())))
502509
{
503-
print "Using Mipmap\n";
504-
505-
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
506-
GL_NEAREST_MIPMAP_LINEAR);
507-
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
508-
GL_NEAREST_MIPMAP_LINEAR);
509-
510-
# The GLU library helps us build MipMaps for our texture.
511-
if (($gluerr = gluBuild2DMipmaps_c(GL_TEXTURE_2D, $Tex_Type,
512-
$Tex_Width, $Tex_Height, $Tex_Format, $Tex_Size,
513-
$Tex_Pixels->ptr())))
514-
{
515-
printf STDERR "GLULib%s\n", gluErrorString($gluerr);
516-
exit(-1);
517-
}
518-
}
519-
# Use normal texture - Note: dimensions must be power of 2
520-
else
521-
{
522-
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
523-
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
524-
525-
glTexImage2D_c(GL_TEXTURE_2D, 0, $Tex_Type, $Tex_Width, $Tex_Height,
526-
0, $Tex_Format, $Tex_Size, $Tex_Pixels->ptr());
510+
printf STDERR "GLULib%s\n", gluErrorString($gluerr);
511+
exit(-1);
527512
}
528513

529514
# Benchmarks for Image Loading
@@ -635,7 +620,7 @@ sub ourInitShaders
635620

636621
# NOP Vertex shader
637622
my $VertexProg = qq
638-
{!!ARBvp1.0
623+
{!!ARBvp1.0
639624
PARAM center = program.local[0];
640625
PARAM xform[4] = {program.local[1..4]};
641626
TEMP vertexClip;
@@ -686,7 +671,7 @@ sub ourInitShaders
686671

687672
# Lazy Metalic Fragment shader
688673
my $FragProg = qq
689-
{!!ARBfp1.0
674+
{!!ARBfp1.0
690675
PARAM surfacecolor = program.local[5];
691676
TEMP color;
692677
MUL color, fragment.texcoord[0].y, 2.0;

0 commit comments

Comments
 (0)