   Multitexturing killing my Skydome
  I'm tearing my hair out. I'm fairly new to OpenGL. And I'm hoping someone has run into this problem before. I'm using the SkyDome code from the More OpenGL book. I've added it to a project I've been working on that include MD2 models, a player, very good mouse / keyboard interface (user friendly like Warcraft!), etc...The terrain generation code is from the Frustum Culling code from the same book. Basically, I want to implement the multitexturing code from Chapter 10, that uses texture units and blends terrains based on height.What I'm getting is a blended texture (good), My mobs and my player are rendering (good), but my frickin skydome is taking the color of the texture unit 0 from the terrain draw. The skydome is created from a color array, no textures.I've tried moving the skydome code below the terrain, mobs and player, and everywhere in-between, and still get this result. Anyone run into this? I'm trying it with two tex units to start. And if I comment out unit 1, the skydome is fine.    
  The problem is, your pulling too much code from too many places, and you don't _completely_ understand what your program is doing.I'd suggest reading, and re-reading the code over again to get a better understanding of all the little things. Either that, or start again riting the code yourself.But anyway, this is a common problem when first adding Multitexturing, it's a bit hard without seing code, but check your implementation again.IIRC, texture unit 0 should be kept 'empty', ie, used to reset back to non multitexturing. Dunno if that makes sense, don't reall know how to explain it any better.   ;  It may be that you're not telling OpenGL that you don't want to be using any textures when you draw the skydome.  Make sure you call glDisable(GL_TEXTURE_2D) before you draw the dome, and reenable it with glEnable(GL_TEXTURE_2D) after you draw.  I think the problem is you aren't turning texturing off and it's using the last bound texture unit to map a texture to the skydome.  However, unless you are specifying texture coordinates for the skydome, it shouldn't texture at all.Hope that helps.   ;  Like Morpheus011 said most likely you aren't shutting down your texture units correctly and the last texture unit is still active. Post your rendering code that would help us help you.   ;  The skydome uses texturing for the sun element, but its enabling/disabling correctly.What is confusing, is that if I just lay the terrain using unit 0, no unit 1, the sky is fine. Uncomment the lines for unit 1, the sky is a shade of the unit 0 texture. So.. how do you 'turn on' multitexturing? Is it simply the ref to a subsequent unit?any good web tuts or books on multitexturing, particularly using combines, modulates etc..?thanks again.[Edited by - jtravers888 on June 21, 2006 7:17:26 AM];  using a simpler example, a multitextured cube, no arrays.If I change all references of GL_TEXTURE0_ARB to GL_TEXTURE1_ARB,and change GL_TEXTURE1_ARB to GL_TEXTURE2_ARBI get a black screen. I did add glActiveTextureARB(GL_TEXTURE2_ARB); before the glBegin(GL_QUADS);how do I tell even this smallest of programs to use units 1 and 2 to draw the cube?   ;  After calling glActiveTextureARB() you have to bind the texture you want using glBindTexture(..) as you did without multitexturing, and then, while drawing your vertices, you have to specify Texture coordinates for each unit using glMultiTexCoord2f(ARB_UNIT,s,t).And ARB_unit specifies the unit where you loaded you texture.Hope that helps   ;  I'd suggest getting glIntercept v0.5, reading through how to use it and then set the ini file for a single, one frame only output when pressing the keys of your choice.You can then look through or post the important bits of the output to determine where the mistake in your code is. It depends on your code, but if you have appropraite parts from all over the place I think this might be the quickest method to pin down what the error is and roughly where it is happening. You can then go into your code and fix the problem.glIntercept is an application that hooks the opengl calls that your project makes to opengl. It intercepts them and logs the information to a file (xml) before passing on the calls to opengl itself. It will impact on performance depnding on the settings in the ini file, but for debugging it can be highly useful.   ;  I went down to B Daltons and read books for about 2 hours, and wound up coming home with the latest version of the Red Book.Anyway, I now realize that glEnable is not at the app level, except for texunit 0. It is used at the unit level for the most part. That should make a big difference in my success.Edit (later): APP FIXED!!! Blue skies, nothing but blue skies.... yada deedaaaa.I DO HAVE one question. What is the advantage of using all these gl commands with the ARB extension, vs without?ALSO, another question... partaketh on this code...glActiveTexture(GL_TEXTURE0);glDisable(GL_TEXTURE_2D);glActiveTexture(GL_TEXTURE1);glEnable(GL_TEXTURE_2D);   glTexEnvi commands, etc...glActiveTexture(GL_TEXTURE2);glEnable(GL_TEXTURE_2D);   glTexEnvi commands, etc...glDisable(GL_TEXTURE_2D);The last glDisable. Is it disabling texunit 0? or 2? or what? Shouldn't the unit to be disabled be specified?Thanks for all the help.[Edited by - jtravers888 on June 21, 2006 12:05:48 PM];Quote:Original post by jtravers888...The last glDisable. Is it disabling texunit 0? or 2? or what? Shouldn't the unit to be disabled be specified?...Calling glDisable(GL_TEXTURE_2D) disables texturing on the currently active texture unit.  If you don't set a different texture unit to active (via glActiveTexture) after you set texture unit 2 as active, then it will disable texturing on texture unit 2.  You must remember that OpenGL is a state machine; any state you change will stay set that way until you change it again (or if some library, other function, etc you're using changes it - ie: wglUseFontOutlines).[Edited by - Kalidor on June 21, 2006 12:16:19 PM]