Multitexturing

Started by
5 comments, last by AndyEsser 16 years, 6 months ago
Hi... can you give me the tutorial or some information about multitexturing. I have browsing some info from internet about it. But, I only know few about it. I want to use this multitexturing for shadow mapping project with multi light source. Thanx before..
Advertisement
i have a tip for you my northern neighbour, there is this wonderfull website i once heard of that actually catologues the internet and than let's you search it's results :-) :-)

i mean seriouslly, type this in google "opengl multitexturing" ...i got 14,700 hits for that search, withough doubt what you are looking for is in there.
The easiest way to do multitexturing would be using shaders.

Simply read the colors from multiple textures and combine them like you want.
If I was helpful, feel free to rate me up ;)If I wasn't and you feel to rate me down, please let me know why!
OK2... I already read some tutorial about multitexturing...
I don't is this topic related with multitexturing or not.. But I want to know, how we can combine two texture or more into one texture?? Because I usually use glBindTexture to move one texture. But, if I use it twice.. The first texture will be deleted. Maybe one of you can give some solution or example code... Thanx
Do the maths yourself then.

Load the first texture into your program. Load the second data into your program. Then go through byte-by-byte and perform the operations on the information. Storing it into a new array (or however you store your textures) then create the texture. (DO NOT DO THIS EVERY FRAME)
@AndyEsser:
So you mean that to save two texture using glBindTexture... I must create by my math? I cannot use the opengl function for that??
There are ways of doing multitexturing using the FFP. However, as Lord_Evil suggested, using shaders would be the easiest way to go.

However, if you do not wish to use shaders, then you can load both textures into memory. And then loop thru each pixel and perform the relevant operations on it

texture1[w*h*3] // Array for holding data for Texture 1
texture2[w*h*3] // Array for holding data for Texture 2
texture3[w*h*3] // Array for holding data for Texture 3

[Loop Through X]
[Loop Through Y]
texture3[x*y+0] = texture1[x*y+0] * texture2[x*y+0]
texture3[x*y+1] = texture1[x*y+1] * texture2[x*y+1]
texture3[x*y+2] = texture1[x*y+2] * texture2[x*y+2]
[End Loop Through Y]
[End Loop Through X]

The code above will _Modulate_ the two colours of each pixel channel in Textures 1 and 2 and store the result in texture3. You can then use glGenTextures() on this array and then glBindTexture() the texture.

This topic is closed to new replies.

Advertisement