Skip to main content
GameDev.net gamedev.net
🔒 Locked

Oddities in Setting Cg Parameter

Started by jwkelly Feb 25, 2006 at 4:06 PM 0 replies 450+ views
Original Post
jwkelly
jwkelly
I'm working on a simple Cg Vertex/Fragment shader pair and have gotten everything working, save for one tiny detail which is still bothering me. Essentially, the fragment shader takes in a uniform float used to blend two colors (via the Cg lerp command). The strange thing is that when I specify the parameter via cgGLSetParameter1f, it reports the parameter being set correctly (if I query it via cgGLGetParameter1f I get the correct value), but the fragments are actually rendering as if 0.0 was specified (regardless of what is actually specified). If I change the uniform float to a uniform float2 and set the parameter appropriately and only use one of the two dimensions, it works correctly. It also works correctly if I replace the variable with a constant term. Somehow it seems the single dimensional form is not behaving as expected. Does anyone have any idea what might be causing this? I can post code if necessary.
gjaegy
gjaegy
which version of Cg are you using ? I remember having had some similar problem with an older verrsion. If not using the latest official one (1.4), try to download it.

I remember having fixed the problem by specifying the register manually. I think the syntax is something like :

uniform float fSomeFloat : C0

for using register 0. have a try
Gregory Jaegy[Homepage]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.