Cg is a high-level shading language developed by Nvidia.
Questions tagged [cg]
300 questions
5
votes
1 answer
OpenGL-ES and Cg
Can I use Cg shader language with OpenGL ES 2.0?
I know that I can use GLSL with OpenGL ES 2.0 and Cg with OpenGL, but I wonder if there is Cg support for OpenGL ES.

Jiho Choi
- 119
- 1
- 8
5
votes
2 answers
Vertex position relative to normal
In a surface shader, given the world's up axis (and the others too), a world space position and a normal in world space, how can we rotate the worldspace position into the space of the normal?
That is, given a up vector and a non-orthogonal…

This company is turning evil.
- 5,021
- 5
- 34
- 58
5
votes
1 answer
what are passes and multiple shader passes and their private variables
I know that multi pass rendering is about rendering separate parts of the scene and combining them into on image with blending factors applied , this has been done in rendering graphics. but What is a pass and
What are multiple passes in shaders.…

S.A.Parkhid
- 2,772
- 6
- 28
- 58
5
votes
6 answers
CG: Specify a variable not to be interpolated between vertex and fragment shader
I'm using GC for writing shaders inside Unity3D.
I'm using vertex colors attributes for passing some parameters to the shader. They won't be used so for defining colors, and should be forwarded from vertex shader to pixel shader without modifyng…

Heisenbug
- 38,762
- 28
- 132
- 190
5
votes
1 answer
Multiple Render Targets in OpenGL with Cg
I'm trying (in vain) to set up MRT using OpenGL and NVIDIA's Cg shader system, with the ultimate goal of deferred rendering. I've successfully gotten both shaders and Render To Texture for single targets working, but as soon as I attempt rendering…

Matt Kline
- 10,149
- 7
- 50
- 87
4
votes
1 answer
How to blur the outcome of a fragment shader?
I'm working on a shader that generates little clouds based on some mask images. Right now it works well, but i feel the result is missing something, and i thought a blur would be nice. I remember a basic blur algorithm where you have to apply a…

Samssonart
- 3,443
- 3
- 31
- 41
4
votes
3 answers
Does CG 3.0 leak?
I'm finding CG appears to have a memory leak. I submitted a report via nvidia.com, but if you try this here:
If you remove the line that says
cgD3D11SetTextureParameter( g.theTexture, g.sharedTex ) ;
The leak stops.
Does CG 3.0 really leak?
Using…

bobobobo
- 64,917
- 62
- 258
- 363
4
votes
2 answers
What is the correct algorithm to perform double-float division?
I'm following the algorithms provided by this paper by Andrew Thall describing algorithms for performing math using the df64 data type, a pair of 32-bit floating point numbers used to emulate the precision of a 64-bit floating point number. However,…

Xirema
- 19,889
- 4
- 32
- 68
4
votes
1 answer
OpenGL: How do I get the coordinates of a specific point after transformation?
Suppose I have a point at (250,125,-20).
After the following transformation,
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(100.0, 50.0, 0.0);
glRotatef(-25.0, 0.0, 1.0, 0.0);
How can I get the value of current coordinates of that…

Roun
- 1,449
- 1
- 18
- 25
4
votes
1 answer
How to write a Unity Shader that respects sorting layers?
I want to sort my Sprites using Unitys sorting Layers. I attached a custom Shader to one of my Sprites. Sadly the Sprite with this shader always draws behind the other Sprites disrespecting the sorting layer.
How to implement sorting layer respect…

f.b.
- 490
- 1
- 5
- 17
4
votes
1 answer
unity3d, multiple render targets - different behavior in Direct3D/OpenGl
I'm writing shader for unity3d. The shader uses multiple render targets to render post processing effect.
However, I've run into interesting issue.
When Unity3d runs in direct3d mode, by default all standard shaders write data only into first color…

SigTerm
- 26,089
- 6
- 66
- 115
4
votes
1 answer
Calculate tangent space in C++
I am trying to render a scene using normal mapping
Therefore I am calculating the tangent space in C++ and store the binormal and tanget seperately in an array which will be uploaded to my shader using vertexattribpointer.
Here is how I calculate…

glethien
- 2,440
- 2
- 26
- 36
4
votes
2 answers
Silhouette outline shader
I know this a very well documented subject, but I still have some problems. I made the outline for a silhouette but with doubling the mesh. I have a good fps but the outline is too harsh, I want it to progressive fade out. Here is the result:
It…

ahsoka
- 133
- 1
- 3
- 12
4
votes
1 answer
repeating tile from tile atlas texture
I need help with CG fragment shaders. I have one big texture which holds all the tiles. I really don't know where to start with this one.
Now when quad/sprite goes over certain size i would need to repeat texture as it was one single texture.

BlackCat
- 329
- 5
- 17
4
votes
1 answer
Cg problems with OpenGL
I'm working on an OpenGL project on Windows, using GLEW to provide the functionality the provided Windows headers lack. For shader support, I'm using NVIDIA's Cg. All the documentation and code samples I have read indicate that the following is the…

Matt Kline
- 10,149
- 7
- 50
- 87