如何在CG语言中进行多纹理输入
glGenTextures (2*range+1, Texture_Id);
for(int i=0; i<2*range+1; i++)
{
glBindTexture (target, Texture_Id[i]);
glTexParameteri (target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri (target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri (target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri (target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
glTexImage2D (target, 0, GL_FLOAT_RGBA16_NV, FileSize.x, FileSize.y, 0,
GL_RGBA, GL_HALF_FLOAT_NV, InRgba[Repro[curframe-start][i]-start]);
}
for(int i=0; i<2*range+1; i++)
{
char str[100];
sprintf(str,"tex%d",i);
CgFragmentParam_tex[i] = cgGetNamedParameter(CgFragmentProgram, str);
checkForCgError("getting image parameter");
cgGLSetTextureParameter(CgFragmentParam_tex[i], Texture_Id[i]);
checkForCgError("setting texture 2D texture");
}
for(int i=0; i<2*range+1; i++)
{
cgGLEnableTextureParameter(CgFragmentParam_tex[i]);
checkForCgError("enable texture texture");
}
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/chpdirect1984/archive/2007/12/02/1911556.aspx