Hello there, I was wondering how I could bind some textures in my Cg shader using OpenGL API.
For variables it was easy and obvious, I just use cgGLGetParameter to get the variable in my Cg shader and then use cgGLSetParameter to bind it to the variable in my application.
But for texture it wasn't so obvious. It's kind of confusing looking at the examples that use texture binding coz now there are no getParameter and setParameter like in the case of simple variables and modelView matrices. How does Cg know which is which?
Sometimes there are semantics like TEXUNIT0 sometimes there are none but they still bind without a problem, how did Cg know which OpenGL texture to bind to? Was it order dependent in my Cg shader, i.e. the first one I declared corresponds to the first Texture I set up in OpenGL? It's a little confusing that it doesn't follow the same logic as the one for simple variables and modelView matrices. I might be wrong but does it? Hmmm, looking at the examples available confused me coz I didn't see how Cg TEXUNIT0 connected to the OpenGL texture. I got the Cg Tutorial book but no explanation there (even in the appendix), I read the Cg manual nothing there (just examples with 1 paragraph of description). I just can't find one concrete explanation and detailed description/documentation for it.
Sorry looking at the manuals confuses and frustrates me. I need some helpful explanation and simple detailed examples. Please help.
Thanks a lot!
Texture Binding for Cg Shader using OpenGL API
Started by altair_john, Sep 20 2005 08:28 AM
1 reply to this topic
#1
Posted 20 September 2005 - 08:28 AM
#2
Posted 20 September 2005 - 05:56 PM
Somehow I was enlightened a little.
there are two implementations one OpenGL based which needs TEXUNIT0 and the other is Cg based which does not need TEXUNIT0. Am I right? (Additional Question) What is the technical/performance difference between the two? thanks!!!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











