|
|
|
|
|
|
|
|
static GLboolean NearestFilter = GL_TRUE; |
|
|
static GLboolean NearestFilter = GL_TRUE; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
|
InitValues(void) |
|
|
|
|
|
{ |
|
|
|
|
|
BaseLevel = 0; |
|
|
|
|
|
MaxLevel = 8; |
|
|
|
|
|
MinLod = -1; |
|
|
|
|
|
MaxLod = 9; |
|
|
|
|
|
LodBias = 0.0; |
|
|
|
|
|
NearestFilter = GL_TRUE; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void MakeImage(int level, int width, int height, const GLubyte color[4]) |
|
|
static void MakeImage(int level, int width, int height, const GLubyte color[4]) |
|
|
{ |
|
|
{ |
|
|
const int makeStripes = 0; |
|
|
const int makeStripes = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void myinit(void) |
|
|
static void myinit(void) |
|
|
{ |
|
|
{ |
|
|
|
|
|
InitValues(); |
|
|
|
|
|
|
|
|
glEnable(GL_DEPTH_TEST); |
|
|
glEnable(GL_DEPTH_TEST); |
|
|
glDepthFunc(GL_LESS); |
|
|
glDepthFunc(GL_LESS); |
|
|
glShadeModel(GL_FLAT); |
|
|
glShadeModel(GL_FLAT); |
|
|
|
|
|
|
|
|
static void display(void) |
|
|
static void display(void) |
|
|
{ |
|
|
{ |
|
|
GLfloat tcm = 4.0; |
|
|
GLfloat tcm = 4.0; |
|
|
printf("BASE_LEVEL = %d MAX_LEVEL = %d MIN_LOD = %f MAX_LOD = %f Bias = %.2g filter = %s\n", |
|
|
|
|
|
|
|
|
printf("BASE_LEVEL=%d MAX_LEVEL=%d MIN_LOD=%.2g MAX_LOD=%.2g Bias=%.2g Filter=%s\n", |
|
|
BaseLevel, MaxLevel, MinLod, MaxLod, LodBias, |
|
|
BaseLevel, MaxLevel, MinLod, MaxLod, LodBias, |
|
|
NearestFilter ? "NEAREST" : "LINEAR"); |
|
|
NearestFilter ? "NEAREST" : "LINEAR"); |
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel); |
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel); |
|
|
|
|
|
|
|
|
case 'f': |
|
|
case 'f': |
|
|
NearestFilter = !NearestFilter; |
|
|
NearestFilter = !NearestFilter; |
|
|
break; |
|
|
break; |
|
|
|
|
|
case ' ': |
|
|
|
|
|
InitValues(); |
|
|
|
|
|
break; |
|
|
case 27: /* Escape */ |
|
|
case 27: /* Escape */ |
|
|
exit(0); |
|
|
exit(0); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
static void usage(void) |
|
|
static void usage(void) |
|
|
{ |
|
|
{ |
|
|
printf("usage:\n"); |
|
|
printf("usage:\n"); |
|
|
printf(" b/B decrease/increase GL_TEXTURE_BASE_LEVEL\n"); |
|
|
|
|
|
printf(" m/M decrease/increase GL_TEXTURE_MAX_LEVEL\n"); |
|
|
|
|
|
printf(" n/N decrease/increase GL_TEXTURE_MIN_LOD\n"); |
|
|
|
|
|
printf(" x/X decrease/increase GL_TEXTURE_MAX_LOD\n"); |
|
|
|
|
|
printf(" l/L decrease/increase GL_TEXTURE_LOD_BIAS\n"); |
|
|
|
|
|
printf(" f toggle nearest/linear filtering\n"); |
|
|
|
|
|
|
|
|
printf(" b/B decrease/increase GL_TEXTURE_BASE_LEVEL\n"); |
|
|
|
|
|
printf(" m/M decrease/increase GL_TEXTURE_MAX_LEVEL\n"); |
|
|
|
|
|
printf(" n/N decrease/increase GL_TEXTURE_MIN_LOD\n"); |
|
|
|
|
|
printf(" x/X decrease/increase GL_TEXTURE_MAX_LOD\n"); |
|
|
|
|
|
printf(" l/L decrease/increase GL_TEXTURE_LOD_BIAS\n"); |
|
|
|
|
|
printf(" f toggle nearest/linear filtering\n"); |
|
|
|
|
|
printf(" SPACE reset values\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|