Original Post
Hi, Im having some problems implemeting shadow maps. Im using quake3 map for my levels. I have shadow map working for simple escenes, rendering without glTexPointer and glDrawElements, so i supose that mi problem is passing the texture coords with this procs. Here is the code from the fixed pipeline. gl_sl_generate_shadow_map(); //proc generate shadow map glUniform1iARB(glGetUniformLocationARB(glsl_get_program(), "texture1"), 1); //initializing pointers glVertexPointer(3, GL_FLOAT, sizeof(tBSPVertex), &(BSPVertex[0].vPosition)); //vertex coords glClientActiveTextureARB(GL_TEXTURE0_ARB); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(2, GL_FLOAT, sizeof(tBSPVertex), &(BSPVertex[0].vLightmapCoord)); //lightmpap coord it be overwritten by shader glClientActiveTextureARB(GL_TEXTURE1_ARB); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(2, GL_FLOAT, sizeof(tBSPVertex), &(BSPVertex[0].vTextureCoord)); //texture coords glEnableClientState( GL_VERTEX_ARRAY ); //here the code to seaching and optimizin area for bsp maps . . . //rendering actual face glActiveTextureARB(GL_TEXTURE1_ARB); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, all_textures[pFace->textureID]); glActiveTextureARB(GL_TEXTURE0_ARB); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, gl_sl_get_shadow_map()); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL); glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE_ARB, GL_INTENSITY); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glTranslatef(0.5, 0.5, 0.5); glScalef(0.5, 0.5, 0.5); gluPerspective(70.0f, conf_get_scr(SCR_WD)/conf_get_scr(SCR_HG), 10.0f, 250.0f); gluLookAt( 30, 0, 80, 30.0f, 0.0, 0.0f, 0.0f, 1.0f, 0.0f); glMatrixMode(GL_MODELVIEW); glDrawArrays(GL_TRIANGLE_FAN, pFace->vertexIndex, pFace->numOfVerts); //disble all states . . . // Here is the code from the shaders //vert varying vec4 ProjShadow; void main(void) { ProjShadow = gl_TextureMatrix[0] * gl_Vertex; gl_TexCoord[1] = gl_MultiTexCoord1; gl_Position = ftransform(); } //frag uniform sampler2DShadow ShadowMap; varying vec4 ProjShadow; uniform sampler2D texture0; uniform sampler2D texture1; void main (void) { gl_FragColor = texture2D(texture1, vec2(gl_TexCoord[1])) * shadow2DProj(ShadowMap, ProjShadow).r; } screenshot. http://img118.imageshack.us/img118/9771/cubwinci4.jpg I seems that problems is on the shadow map coords but i have no idea what im doing wrong. Any ideas? Thanks in advance.