   Removing reverse projection with projected texture
  Hi,I'm making a OpenGL ES 1.0 game (i.e fixed function, on iPhone) and am currently trying to implement a projected texture (for a spotlight). After a little bit of fiddling with the texture matrix, I managed to get it work quite nicely. However, this results in the known artifact of the texture also being projected in the opposite direction.The workaround for this is supposed to be a black/white texture in the 2nd tex unit (using multitexturing) to essentially mask the projection in one direction. Which makes sense to me.... except I'm at a complete loss as to how to actually code it! Should I upload the same manipulated matrix to the 2nd tex unit and do some additional calcs or something completely different..?Any tips..?Thanks   
  use texture environment combiners. (BTW have you managed to find a good work around for the R/Q perspective division "known issue" in the apple driver or is your scene not affected?)Anyway your combiner setup would be something like (ES 1.0, if you had ES 1.1 you would actually have some more decent combiner flexibility) glActiveTexture(GL_TEXTURE_0);glMatrixMode(GL_TEXTURE);glLoadMatrixf(shadowMatrix); glBindTexture(GL_TEXTURE_2D, projTex);glActiveTexture(GL_TEXTURE_1);glMatrixMode(GL_TEXTURE);glLoadMatrixf(shadowMatrix); glBindTexture(GL_TEXTURE_2D, fixTex); // 16x16 texture with black edges?glTexParameter(GL_TEXTURE_2D, GL_WRAP_MODE_S, GL_CLAMP_TO_EDGE);glTexParameter(GL_TEXTURE_2D, GL_WRAP_MODE_T, GL_CLAMP_TO_EDGE);glTexEnv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);   ;  You could also use user defined clipping planes  or oblique frustum clipping I don't know how to do this with multi texturing but i would be interested in finding out too...EDIT: seems silvermace posted a solution :D   ;  Thanks for your reply... Are you sure you're referring to the same problem as me though..? It seems that your fix is for avoiding the edges of the projection texture being drawn when rendering..? (I'm currently using a unmipmapped texture with a blank border, so I don't actually have that issue currently.)You can find the reverse-projection problem mentioned on the 6th page of this nvidia doc http://developer.nvidia.com/object/Projective_Texture_Mapping.htmlThe document also mentions a possible workaround with the line..."Typically applications use a 1D texture or other interpolated quantity to eliminate color contribution when the q coordinate of the projective texture becomes negative."...but this is the part which confuses me :)(Btw with regards to perspective Q/R division on iPhone: No workaround that I know of, I'm using an orthographic projection though!)   ;  I think i answered your question a little hastily, I appologise for that, my answer is almost non-sensical in this situation!The easiest way to mute negative texture coords is by figuring out the distance to the (projection) frustum's near plane. distance = px*nx + py*ny + pz*nz + DWe use this point-plane distance as an 's' coord to look up a texture which has black @ 0,0 and white @ 1,0. By enabling clamp-to-edge, any negative values (i.e. the point is behind the near plane) will return black and any 'positive distances' in front of the plane will return white.so for your 2nd texture unit, set the texture environment mode to COMBINE, bind your mask texture, set the wrap mode to CLAMP_TO_EDGE and use your texture matrix (mask matrix) to do the equation above:[px]   [nx, ny, nz,  D] [py] x [ 0,  0,  0,  0][pz]   [ 0,  0,  0,  0][pw]   [ 0,  0,  0,  1] where 'n' is the plane normal and 'D' is the plane distance and 'p' is the vertex multiplied by the projection matrix you're using (so you should be able to set your 2nd texture unit's matrix to Proj*Bias*Mask).Hope that makes it a bit clearer.   ;  Many thanks Silvermace, your explanation seems to make good sense to me (in theory anyway, I'm sure I'll end up fumbling with the implementation for a little bit!).Thanks again for the pointers.(Sorry for the late reply btw, went away for the weekend!)   