texture mapping

Im not sure if you have a no homework help policy or not. If so i appologize.

But yea this is my homework. We got a framework and were supposed to make cubes, rotating spheres. moving camera and textures. Right now i only have the textures left, and im not sure how to do it. And was hoping you guys could give me some pointers.

Here is the code: http://pastebin.com/ASaEQppv

http://www.google.com/search?q=opengl+texture+tutorial

Well, it looks like you have texturing set up in the LoadGLTextures() function, and to texture something you use glTexCoord3f() or some other variation, see here.

hmm yea, but my loadGLTextures loads several textures. i want to use building texture on the cubes. How do i specify which textures im gonna use. when using glTexCoord3f()

Good question. Actually, do you know why the line


glGenTextures(3, &texture[2]);

isn’t


glGenTextures(1, &texture[2]);

? Because you’re making three textures per picture. But anyway, to set which texture you’re using you use glBindTexture(GL_TEXTURE_2D, texture) where texture is a GLuint. So I guess you’d use glBindTexture(GL_TEXTURE_2D, texture[2]) for the building.

hmm if i understand you correct. when you call glBindTexture(GL_TEXTURE_2d, texture[1]); you’re saying to the compiler that any texture related thing after this is gonna be done on/with texture[1] ?

And thanks for helping :slight_smile:

Yeah, that’s basically how it works (as far as I know). I’m actually pretty new to texture and OpenGL in general (notice the “newbie” title under my name :slight_smile: ), but you can google texture in OpenGL if you’d like to know more or make sure of something.

Well i got textures now, but the problem is that the textures is all the same. All get the building texture. Anyone had that problem before?

http://pastebin.com/bKckWEsF

never mind. found the error. copy pasted wrong function :stuck_out_tongue: