我试图用* .bmp图像纹理树,我做错了...请帮帮我...我有一个错误:未声明的标识符GL_TEXTURE_3D
void myinit(void);
void CALLBACK display(void);
void CALLBACK myReshape(GLsizei w, GLsizei h);
void load_texture(const char* s);
float baseRadius = 0.10;
float topRadius = 0.10;
float height = 1.0;
int slices=50, stacks=50;
float pi = 3.14159265358979323846;
GLuint IDtextura;
void load_texture(const char* s)
{
AUX_RGBImageRec *pImagineTextura = auxDIBImageLoad(s);
if(pImagineTextura != NULL )
{
glGenTextures( 1, &IDtextura );
glBindTexture(GL_TEXTURE_3D, IDtextura);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);
glTexImage3D(GL_TEXTURE_3D, 0, 3, pImagineTextura->sizeX, pImagineTextura->sizeY,pImagineTextura->sizeZ,
0, GL_RGB, GL_UNSIGNED_BYTE, pImagineTextura->data);
}
if(pImagineTextura)
{
if(pImagineTextura->data )
free(pImagineTextura->data );
free(pImagineTextura);
}
}
void myinit (void)
{
glClearColor(1.0, 1.0, 1.0, 1.0);
glEnable(GL_TEXTURE_3D);
glShadeModel(GL_FLAT);
}
void CALLBACK display(void)
{
GLUquadricObj* cilindru;
cilindru = gluNewQuadric();
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glTranslatef (0.0, 0.0, -5.0);
const char* sir;
GLuint ID1;
glClearColor(1.0, 1.0, 1.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
sir=".\\mm.bmp";
load_texture(sir);
ID1=IDtextura;
glBindTexture( GL_TEXTURE_3D, ID1);
//glBegin(GL_QUADS);
//????
glEnd();
glPushMatrix ();
glRotated (0.0, 1.0, 0.0, 0.0);
glTranslated (0.0, 0.0, 1.5);
glDisable (GL_LIGHTING);
glEnable (GL_LIGHTING);
glPopMatrix ();
//tree
glPushMatrix();
glRotatef(90, 1, 0, 0);
gluQuadricDrawStyle(cilindru, GLU_FILL);
gluCylinder(cilindru, baseRadius, topRadius, height, slices,stacks);
glPopMatrix();
..........