   Bind two texture...
  Hello.. Can you help me what I must do for bind two textures into one texture? I'm using OpenGL, but I don't know how to create it. I want to use this for shadow mapping with two light.   
hey ^^,hmmm i think there are 2 ways to do it:1) by Multitexturing them using glMultiTexture*() commands.2) or u do Multitexturing by ur self in CPU or GPU(shader).take care.   ;  Are you asking for multitexturing?nvidia has demoes that use it.search for multitexturehttp://http.download.nvidia.com/developer/SDK/Individual_Samples/3dgraphics_samples.htmlor use google to find other pages   ;  OK2.. so I must use multitexture... Maybe you can give me some example or step by step to bind it.I don't know what is must do start?? Am I must create using GL_TEXTURE2D or how??Maybe you can give some reference... Thanx ;)   ;Quote:Am I must create using GL_TEXTURE2D or how??It works with GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, GL_TEXTURE_CUBE_MAP, GL_TEXTURE_RECTANGLE_ARBI can give you a section of codeglActiveTexture(GL_TEXTURE0);glBindTexture(GL_TEXTURE_2D, TextureID1);glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);glActiveTexture(GL_TEXTURE1);glBindTexture(GL_TEXTURE_2D, TextureID2);glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);RenderSomething();So that will modulate the primary color with the texture of unit 0, then modulate the result with texture of unit 1.   ;  OK thanx for the code, but I want to know where the example code must be located?Is after I store the depth map from each light? Or before it?And after both texture bind, where is the result to be saved? Is in GL_Texture2D or where? And if I want to call the result again..what is maust to do?Btw, thanx for the example code.   ;  You need to be more specific as to what the problem is.   ;  OK2..I want to bind two texture for my shadow mapping project with two light. I create the program refers to example program in www.paulsprojects.net/tutorials/smt/smt.html.In my first process, I render from light for each light and save it on depth map for each result.After that, must to combine or bind both result into one texture. The result from bind process will be used in comparing process. This my code for light render and create depth map://Create Depth mapglGenTextures(1,&DepthMapTexture_1);glBindTexture(GL_TEXTURE_2D, DepthMapTexture_1);DrawingObject();glBindTexture(GL_TEXTURE_2D, DepthMapTexture_1);glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, DepthMapSize, DepthMapSize);And this is my code in comparing process://Bind & enable shadow map textureglBindTexture(GL_TEXTURE_2D, DepthMapTexture_1);glEnable(GL_TEXTURE_2D);//Enable shadow comparisonglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE);//Shadow comparison should be true (ie not in shadow) if r<=textureglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);//Shadow comparison should generate an INTENSITY resultglTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE_ARB, GL_INTENSITY);//Set alpha test to discard false comparisonsglAlphaFunc(GL_GEQUAL, 0.99f);glEnable(GL_ALPHA_TEST);I'm using GLEE for comparing. Maybe this can make you more clearly about my problem... I confuse where the example code that you give to me must be located..;  Sounds like you need to study multitexturing by itself to get a grasp of what it means, before doing shadow mapping.But here you go.glTexParameteri are part of the texture object. No need to call it during rendering.glTexEnvi is part of the texture unit, so that, you may need to call during rendering.//Create the texturesglGenTextures(1,&DepthMapTexture_1);glBindTexture(GL_TEXTURE_2D, DepthMapTexture_1);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE_ARB, GL_INTENSITY);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);DrawingObject();glBindTexture(GL_TEXTURE_2D, DepthMapTexture_1);glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, DepthMapSize, DepthMapSize);glGenTextures(1,&DepthMapTexture_2);glBindTexture(GL_TEXTURE_2D, DepthMapTexture_2);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE_ARB, GL_INTENSITY);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);DrawingObject();glBindTexture(GL_TEXTURE_2D, DepthMapTexture_1);glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, DepthMapSize, DepthMapSize);//Bind & enable shadow map textureglActiveTexture(GL_TEXTURE0);glBindTexture(GL_TEXTURE_2D, DepthMapTexture_1);glEnable(GL_TEXTURE_2D);glActiveTexture(GL_TEXTURE1);glBindTexture(GL_TEXTURE_2D, DepthMapTexture_2);glEnable(GL_TEXTURE_2D);DrawScene();