Download presentation
Presentation is loading. Please wait.
Published byPaul French Modified over 9 years ago
1
ADDITIONAL TIPS Multi-texture Slides
2
Here is a link Workflow: /**************In texture parameter set up******/ call glActiveTextureARB(/*pick texture Ex. GL_TEXTURE1_ARB*/); //set up texture as you normally would /**************Drawing in Display *************/ call glMultiTexCoord2dvARB(/* texture you picked*/, /*texture coordinates for it*/) glNormal glTexCoord glVertex
3
Texture Setup ////////////////////// texture 0 ////////////////////////// glActiveTextureARB (GL_TEXTURE0_ARB); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texture[0]); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); ////////////////////// texture 1 ////////////////////////// glActiveTextureARB (GL_TEXTURE1_ARB); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texture[1]); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); // Make sure the mipmap initialization is completed glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); //Note: you need to load texture[0] and texture[1] with some image data with either some library Ex. SOIL_load_OGL_texture. or glTexImage2D or gluBuild2DMipmaps
4
Display Drawing glMultiTexCoord2dvARB (GL_TEXTURE0_ARB, /*a vector of texture coordinates*/); glNormal // glMultiTexCoord2dvARB (GL_TEXTURE1_ARB, /*a vector of texture coordinates*/) this can be omitted if texture coordinates are generated automatically glVertex //Since sphere map auto generate texture coordinates, you can use the glTexCoord will be the sphere maps coordinates.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.