How do I assign multiple textures into single a mesh in OpenGL? -


first example: can take huge rock shaped mesh , put tiled rock texture on it. now, places needs covered grass texture (or other vegetation).

another example: usually, terrain built tiled textures. in order achieve less "tilly" look, can apply 4 times bigger (or 16 , on..) tiled texture on it, , you'll gain nice "random" tiled texture (seen in udk's docs).

blender (the 3d graphics app) opengl based, , allows assign multiple materials single mesh.

how can in own opengl application? thanks, amir

p.s: i'm looking better solution rendering 50 tris tex , and 3 more tris tex b.

what you're looking called multitexturing. modern graphics cards have several texture units each can sample different texture. when render rock specify vertices have uv coordinates each texture want render.

in opengl can use glactivetexture select active texture unit can bind texture , use in subsequent rendering. vertices need additional texture coordinate pairs; 1 pair per texture intend render.

the modern way multitexturing using shaders (glsl in opengl typically). load , bind each texture different texture unit, set shader uniforms value of texture units (0 texture unit 0 etc) you're using, sample each texture, , blend using desired blending function output color.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -