Howdy, Stranger!

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

Mesh Question

edited August 2012 in Questions Posts: 371

Is it possible to set multiple textures for a mesh? Or must I use seperate meshes for each texture

Tagged:

Comments

  • SimeonSimeon Admin Mod
    Posts: 4,958

    @Jordan a mesh can only use one texture. This is a mirroring of how OpenGL works underneath. A mesh is one "draw" command, issued to OpenGL. One draw command in OpenGL can only be used with a single active texture, a single shader, single blending mode, and so on.

  • Posts: 371

    Oh, ok. Thanks for the speedy reply

  • Posts: 2,161

    But you can combine your textures into a single "atlas" and adjust the texture coordinates according to where the subimage lies on the atlas.

    (I've done this for rendering a die.)

  • Posts: 371

    .@Andrew_Stacey, how would I go about doing this? What is an "atlas"? Subimage?
    Jordan

  • Posts: 2,161

    You make one big image and then draw on it all the images you want to use at disjoint places. So for my die, I stacked the six faces on top of each other in a single image. (I actually made the image 8 times larger than a single face to make the coordinate calculations more accurate). I set this image as the texture for my mesh. Then my texture coordinates referenced the "subimages", ie faces, of this big image.

    So for the first face, my texture coordinates were set up so that instead of the corners being at (0,0), (1,0), (0,1), and (1,1) they were at (0,0), (1,0), (0,.125), and (1,.125).

  • Posts: 371

    Oooh! So you would make the 'net' of the shape (or whatever it is you are displaying)!

Sign In or Register to comment.