Skip to main content
GameDev.net gamedev.net
🔒 Locked

blending textures

Started by Wilhelm van Huyssteen Nov 18, 2009 at 12:22 PM 1 replies 450+ views
Original Post
Wilhelm van Huyssteen
Wilhelm van Huyssteen
Hey. i dont want to blend different textures instead i want to blend a portion of a texture map defined by a set of texture coords with another portion of a texture map defined by another set of texture coords. if that makes any sense. how i think it should be done is to load two sets of texture coords into my VBO's and then to get the final colour of my texture for the pixel do the following where tex is my sampler vec4 texColour1 = texture2D(tex,gl_TexCoord[0].st); vec4 texColour2 = texture2D(tex,gl_TexCoord[1].st); colour = lerp(texColour1,texColour2,blendFactor); im not quite sure how texture blending works so this is just an guess. please correct me if im wrong. But if this is the way to do it my question would be how do i bind two sets of texture coords? the glTexCoordPointer method doesnt seem to allow you to bind more than one texture coord VBO. Thnx in Advance! EDIT: maybe my question is abit confusing... i basicly have a texture atlas filled with textures and i want to blend between two of these textures in my shader. [Edited by - EternityZA on November 19, 2009 12:22:16 AM]
snoutmate
snoutmate
Quote:
Original post by EternityZA
vec4 texColour1 = texture2D(tex,gl_TexCoord[0].st);
vec4 texColour2 = texture2D(tex,gl_TexCoord[1].st);

colour = lerp(texColour1,texColour2,blendFactor);

That is correct.
Quote:
But if this is the way to do it my question would be how do i bind two sets of texture coords? the glTexCoordPointer method doesnt seem to allow you to bind more than one texture coord VBO.


TexCoordPointer specifies the texcoords for active texture unit, so just switch it with glClientActiveTexture:

glClientActiveTexture(GL_TEXTURE0);glTexCoordPointer(...); // texcoords 0glClientActiveTexture(GL_TEXTURE1);glTexCoordPointer(...); // texcoords 1...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.