Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 48391

CG is a programming language for 3D graphics that runs on the GPU. It was designed by NVIDIA and Microsoft. It stands for "C for graphics"

1 vote
2 answers
284 views

Accessing uniform variables from a Cg shader in OpenGL

I am trying to implement a simple PC program with OpenGL, using mandatorily Cg shaders (no Unity whatsoever). … I have already searched by myself (including the Nvidia Cg 'tutorial') but I can't seem to find both Cg and OpenGL discussed on a page without having to deal with Unity. …
Ety's user avatar
  • 133
0 votes
Accepted

Accessing uniform variables from a Cg shader in OpenGL

First (after preparing the GL window) you have to initialize the Cg stuff: myCgContext = cgCreateContext(); myCgVertexProfile = cgGLGetLatestProfile(CG_GL_VERTEX); cgGLSetOptimalOptions(myCgVertexProfile … I have declared: "uniform sampler2D tex;" cgGLSetTextureParameter(loctex, IDtex[1]); // IDtex is my array of texture IDs cgGLEnableTextureParameter(loctex); You can find more examples of accessing Cg
Ety's user avatar
  • 133
0 votes
1 answer
848 views

GLSL to Cg fragment shader

Unfortunately, I cannot manage to adapt a GLSL fragment shader to my project, which uses Cg. … To debug, I have a function that catches Cg errors, and my program breaks at this point. I have identified the two texture IDs in the main program. Can you suggest any improvement for this Cg shader? …
Ety's user avatar
  • 133
1 vote
Accepted

GLSL to Cg: why is the effect different?

The shader was fine. But when I tried to use other shaders I realized what was wrong. It was the C++ code that was lacking lines (rrr!! This is the reason why I hate shaders! It's so complicated to m …
Ety's user avatar
  • 133
1 vote
2 answers
575 views

GLSL to Cg: why is the effect different?

The effect can be shown here, through a GLSL shader: But when I use the equivalent Cg shader, the result becomes this: Using the same images (color map + normal map) and the same code (except the … light_pos), 0.0); vec3 color = diffuse * texture2D(color_texture, gl_TexCoord[0].st).rgb; // Set the output color of our current pixel gl_FragColor = vec4(color, 1.0); } And here is the Cg
Ety's user avatar
  • 133