Texture disappears!

I load a HDR image as a texture and I wrote shaders to map the 2 texture to a sphere but texture disappears when I click on it or when I resize the window! Here is my code for display function:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
void Draw()
{
qobj = gluNewQuadric(); 
gluQuadricTexture(qobj,GL_TRUE); 

model->GetFaces();

glEnable(GL_CULL_FACE);

glFrontFace(GL_CW /* or GL_CCW */);	//default is GL_CCW
glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT);



glLoadIdentity();

glPushMatrix();
glTranslatef(tx,ty,0);
glRotatef(rotx,1,0,0);
glRotatef(roty,0,1,0);

LShader.bind();
glEnable(GL_TEXTURE_2D );
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D , texture);
gluSphere(qobj,1,30,30);
int texture_location = glGetUniformLocation(LShader.GetID(), "color_texture");
glUniform1i(texture_location, texture);



gluDeleteQuadric(qobj); 

glDisable(GL_TEXTURE_2D);


LShader.unbind();
glPopMatrix();
glutSwapBuffers();
};


Thanks in advance
Last edited on
Topic archived. No new replies allowed.