Textures turning white...

Started by
1 comment, last by cannonicus 17 years, 6 months ago
Hello Im working om my first project using opengl. Basicly what im doing is im rendering 6 textured quads with different textures. I generate the textures using glGenTextures(6). When rendering, I set the textures using glBindTexture outside the glBegin(GL_QUAD) and glEnd calls. The problem is that the textures sometimes turn white. They usually show correctly the first couple of frames, before they turn white. It seems to somehow be connected to the workload the application undergoes: if i enter a sleep(10) command in the rendering loop most textures stay correct, but some dont. The textures are 128*128. Is this just plain strange, or could there be something i have neglected to consider <- big chance since this is my first opengl app ;) I should also mention that im programming this from drScheme, not c++. Many thanks ;Emil
Emil Jonssonvild
Advertisement
hum... source?
sure :)

//texture initialization//textures = (glGenTextures 6)//loop this from i = 0 to i = 5//image = data from bitmap(glBindTexture GL_TEXTURE_2D (gl-uint-vector-ref textures i))         (glTexImage2D GL_TEXTURE_2D 0 3 (texture-width image) (texture-height image) 0 GL_RGB GL_UNSIGNED_BYTE (texture-data image))(glTexParameteri GL_TEXTURE_2D GL_TEXTURE_MIN_FILTER GL_LINEAR)(glTexParameteri GL_TEXTURE_2D GL_TEXTURE_MAG_FILTER GL_LINEAR)//End loop


//rendering//south-tex = (gl-uint-vector-ref textures 0)//north-tex = (gl-uint-vector-ref textures 1)//...(glLoadIdentity)(glClear (+ GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT))(glTranslatef (vect3d-x pos) (vect3d-y pos) (vect3d-z pos))             (glScalef (vect3d-x size) (vect3d-y size) (vect3d-z size))       (glBindTexture GL_TEXTURE_2D south-tex)       (glBegin GL_QUADS); south(glNormal3f 0 0 -1)(glTexCoord2f 1 1)  (glVertex3f -1 -1 1)(glTexCoord2f 0 1)(glVertex3f 1 -1 1)(glTexCoord2f 0 0)(glVertex3f 1 1 1)(glTexCoord2f 1 0)(glVertex3f -1 1 1)       (glEnd)      (glBindTexture GL_TEXTURE_2D north-tex)(glBegin GL_QUADS); north(glNormal3f 0 0 1)(glTexCoord2f 0 1)  (glVertex3f -1 -1 -1)(glTexCoord2f 1 1)(glVertex3f 1 -1 -1)(glTexCoord2f 1 0)(glVertex3f 1 1 -1)(glTexCoord2f 0 0)(glVertex3f -1 1 -1)       (glEnd)//and so on...(glFlush)(send glcanvas swap-gl-buffers)


Thats most of the opengl related code. If you think more would help please say so.

;Emil
Emil Jonssonvild

This topic is closed to new replies.

Advertisement