cg

Accessing OpenGL state variables in Cg

I need to access the OpenGL state variables (such as the MVP matrices) in my Cg shader program. I'm passing these values to my Cg shader program manually using calls such as cgGLSetStateMatrixParameter() in my C/C++ code. Is there an easier way to do this? ...

Stacking Cg shaders

In my engine I load Cg shaders from pairs of vertex/pixel shader files. I would like to be able to stack shaders to combine them (lighting + material, etc.). Short of breaking up the shaders into separate functions and then creating a single shader script string from those, do you know of any good ways of stacking different shaders in Cg...

ATIX550 Can‘t use HardwareShadowMap in Cg?

sorry about my English. I am not good at English. Exactly the same code,in the GF7600GT, Tex2Dproj can return the correct value. But the X550 return to the depth of texture samples, ATI graphics card is not fully support the NV of Cg? ...

Linking Nvidia's Cg framework statically in Xcode

10 billion kudos for life to anyone who can figure this one out. Nvidia only provides a standard framework for Cg, which I cannot figure how I can link statically. I need to link it statically because it's for a plugin. Is there any way at all this can be done? ...

Line is erased when drawing shapes

Hi, I am trying to make an application for drawing shapes on screen by touching it. I can draw a line from one point to another- but it erases on each new draw. Here is my code: CGPoint location; CGContextRef context; CGPoint drawAtPoint; CGPoint lastPoint; -(void)awakeFromNib{ //[self addSubview:noteView]; } -(void)touchesMoved...

Cg shaders not being applied after switch to glVertexPointer

My renderer used to render geometry with the old fixed function stuff using glBegin/glEnd. After switching it to use vertex arrays via glVertexPointer et. al., my Cg shaders stopped showing up. If i just do a regular texture binding, it works fine, so the array data is solid. Also if I use the old glBegin/glEnd system, the Cg shaders wor...

Packing attributes in a texture, deferred rendering

Hi, I'm rolling a deferred shader pipe, and due to the need to keep the G-buffers in a unified format a need to compress attributes is needed. I've sadly been unable to find some good information on how this actually is done. I have a G-buffer format that uses 16 bits per component in a fixed point format. Sadly as I target shader mode...

Embedding cg shaders in C++ GPGPU library

I'm writing a GPGPU Fluid simulation, which runs using C++/OpenGL/Cg. At the moment, the library requires that the user specify a path to the shaders, which is will then read it from. I'm finding it extremely annoying to have to specify that in my own projects and testing, so I want to make the shader contents linked in with the rest. ...

How to run Cg vertex/fragment shader on CPU?

Hi all, I'm playing about with some vertex and fragment shaders using Cg on my little netbook (running Linux). Clearly I'm going to frequently hit resource limits for my graphics controller, so was wondering if there's a nice way to run the shaders on the CPU, just to test them. Something like D3D's refrast... TIA Andy ...

Cg and OpenGL 3

Hi, I'm currently learning the differences between OpenGL 2 and 3, and I noticed that many functions like glVertex, glVertexPointer, glColor, glColorPointer, etc. have disappeared. I'm used to using Cg to handle shaders. For example I'd write this simple vertex shader: void main(in inPos : POSITION, out outPos : POSITION) { outPos...

Is it correct to attach Frame Buffer Object to a 3D texture with 8-bit internal format

Basically, my program uses frame buffer object to render to a 3D texture. If the 3D texture which I attach to fbo is in GL_RGB8 format, which is 24 bits per texel, there is no problem. Only 8-bits of them are used. The problem happens when I try to use GL_ALPHA8 (8 bits per texel) as the internal format for the 3D texture, the rendering...

C++ Nvidia Cg question

Hello! I started using Nvidia Cg shaders recently and everything looks and works fine if I'm doing it on the Nvidia GPU (GTS250 in my case). I tried launching the same (my own test application) on ATI HD4650 and saw no output. Right after that I started experimenting with test examples (provided with Nvidia Cg 3.0) and 6/7 work, but th...

Example for rendering with Cg to a offscreen frame buffer object

I would like to see an example of rendering with nVidia Cg to an offscreen frame buffer object. The computers I have access to have graphic cards but no monitors (or X server). So I want to render my stuff and output them as images on the disk. The graphic cards are GTX285. ...

Cg: Proper way to write/read from a floating point texture

I currently have a R8G8B8 floating point render target and want to use it as a R24 target. The code //cg out = float4(v, v, v, v); seems to clamp out between 0 and 1. What's the proper way to write/read to a floating point texture in Cg? ...

Cg Redistributable Libraries - Linux location

Hi! I want to run program that needs Cg Redistributable Libraries (from Nvidia). I would like to know, where should i put those libraries, so that program will be able to find them. If I install Cg Toolkit, the program works normally. I am using Ubuntu linux. Thank you. ...