Original Post
Hi, i''ve been asking for help also at opengl forum, but didn''t have a clear answer to the following problem. I want to blend two textures together through a fragment program.
The shader code is this:
TEMP tex0;
TEMP tex1;
TEX tex0, fragment.texcoord[0], texture[0], 2D;
TEX tex1, fragment.texcoord[0], texture[1], 2D;
MUL oColor, tex0, tex1;
and this is the code in the opengl pipe:
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glEnable( GL_VERTEX_PROGRAM_ARB );
glBindProgramARB( GL_VERTEX_PROGRAM_ARB, g_vertexProgramID );
glEnable( GL_FRAGMENT_PROGRAM_ARB );
glBindProgramARB( GL_FRAGMENT_PROGRAM_ARB, g_pixelProgramID );
glBindTexture(GL_TEXTURE_2D, my_texture1);
glutSolidTeapot(.5);
glDisable( GL_FRAGMENT_PROGRAM_ARB );
glDisable( GL_VERTEX_PROGRAM_ARB );
SwapBuffers( g_hDC );
I loaded the two textures to blend in the initgl() function, but i don''t understand where you tell the fragment program which textures correspond to texture[0] and texture[1].
I''m a newbie i know, but simply reading the arb_fragment_program is impossible to write a program from scratch. It would be much better if, together with the arb paper, they would include a couple of well commentented tutorials. At least this is my opinion.