PDA

View Full Version : Blending two textures gradually ?



Space Toaster
08-31-2000, 02:31 PM
Is there anyway to blend 2 textures gradually.

Per example, I have two triangles with two different textures and I want to interpolate textures the same way OpenGL interpolate colors on solid objects (by assigning a color to each vertex)

Any clue, suggestions ?

MikeC
08-31-2000, 03:14 PM
Two possibilities:

1) Draw the triangle twice. Once normally with one texture bound, then again with the other texture bound, blending (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) enabled and an alpha of 0 for one or two of the triangle's verts.

2) Use a 3-dimensional texture (NxNx2) with your two textures as layers r=0 and r=1, enable filtering and use glTexCoord3 instead of glTexCoord2.

1) will be faster (and guaranteed to be supported) on most current hardware, though this may change in future.

[This message has been edited by MikeC (edited 08-31-2000).]