Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How do I pass in a 2nd texture into my shader

edited March 2013 in Shaders Posts: 12

I want to pass in a 2nd texture into my fragment shader, how do I do it?

Comments

  • Posts: 454

    Just add a second uniform for it in the fragment shader, eg:

    uniform lowp sampler2D texture;
    uniform lowp sampler2D shadowMap;
    

    then in your main code you should be able to just do:

    mymesh.shader.texture = someimage
    mymesh.shader.shadowMap = someotherimage
    

    OpenGL ES on the iPad should happily support up to 8 textures in a fragment shader (unfortunately no textures in the vertex shader)

  • Thankyou :)

Sign In or Register to comment.