如果希望在程序里动态的绑定纹理,绑定的代码,一定要写在所有的cg纹理参数绑定的前面,否则会出错。
以下代码正确:
glBindTexture(GL_TEXTURE_2D, m_xxxTexId);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256,256, 0, GL_RGBA, GL_UNSIGNED_BYTE,m_xxxTex);
cgGLSetTextureParameter( cgGetNamedParameter(m_raycastFrag,"xxx"),m_xxxTexId);
cgGLEnableTextureParameter(cgGetNamedParameter(m_raycastFrag,"xxx"));

cgGLSetTextureParameter( cgGetNamedParameter(m_raycastFrag,"xxxx"),  m_xxxxTexId);
cgGLEnableTextureParameter(cgGetNamedParameter(m_raycastFrag,"xxxx"));

如果把绑定放在cgGLSetTextureParameter之后,纹理绑定都会出错。

相关文章:

  • 2022-01-22
  • 2022-12-23
  • 2021-10-04
  • 2022-12-23
  • 2021-10-12
  • 2022-12-23
  • 2022-12-23
  • 2021-09-23
猜你喜欢
  • 2022-12-23
  • 2021-08-07
  • 2021-05-04
  • 2021-10-08
  • 2022-12-23
  • 2021-09-26
  • 2022-01-10
相关资源
相似解决方案