Sign in to follow this  

GLSL texture splatting with several textures and just one texture coordinate system.

Recommended Posts

I'm working in a terrain renderer/editor for a game. Well I'm using shaders and I have several textures (2 RGBA textures with the masks + 8 ground textures) to blend in a chunk. But I just need a texture coordinate system because all the textures will have te same size without <<offsets?>> (Well, English isn't my native language, sorry). ¿is that possible? Actually, I link the textures this way. Do I have to use MultiTextures? void Shaders::link_texture(ui32 shader, ui32 texture, char* alias) { GLhandleARB program = m_shaders[shader].p; i32 uniform_location = glGetUniformLocationARB(program, alias); glBindTexture(GL_TEXTURE_2D, texture); glUniform1iARB(uniform_location, 0); // Check shader errors CHECK_GL_OBJECT_ERRORS(program); } The problem is that I allways get the last texture which was bound. I get the same result even if I just use somethink like: void main() { // Sets the first ground gl_FragColor = ground1; } I think it's a problem binding the textures.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this