Jump to content
  • Advertisement
Sign in to follow this  
Draconis_9

cgSetParameter

This topic is 4027 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm implementing shaders into my c# Tao Framework project. The shader is working and is a slightly modified version of the nehe tutorial, the only thing that doesn't work is setting parameters. Both
[SOURCE]
Cg.cgSetParameter4f(color, 1.0f, 0.0f, 0.0f,1.0f);
[/SOURCE]
or
[SOURCE]
CgGl.cgGLSetParameter4f(color, 1.0f, 0.0f, 0.0f,1.0f);
[/SOURCE]
seem to have no effect what so ever at changing the colour. Shader from nehe without wave implemented
[SOURCE]
struct appdata 
{
	float4 position : POSITION;
	float4 color : COLOR0;
	float3 wave	: COLOR1;
};

struct vfconn
{
	float4 HPos	: POSITION;
	float4 Col0	: COLOR0;
};

vfconn main(appdata IN,	uniform float4x4 ModelViewProj)
{
	vfconn OUT;			

	OUT.HPos = mul(ModelViewProj, IN.position);

	OUT.Col0.xyz = IN.color.xyz;

	return OUT;
}
[/SOURCE]
Any help would be much appreciated. Thanks Draconis

Share this post


Link to post
Share on other sites
Advertisement
I assume "color" is appdata.color?

(if im not mistaken)

appdata.color is "color" per vertex color, and you will have to send color as a colorarray. see glColorPointer

If color is the same for all vertices than it's better that you use it as a global parameter.

float4 color : Color;
float3 wave : WaveColor;

struct appdata
{
float4 position : POSITION;
};

you than can get a valid CGparameter by using either "getParameterByName(<paramname>)" or getParameterBySemantic(<Semantic>)

After you have a valid CGparameter you can change/set the value with cgGLSetParameter4f(...)

hope this helps.

edit:

If your not familiar wirh vertexbuffers here is a link that helped me: http://www.spec.org/gwpg/gpc.static/vbo_whitepaper.html

[Edited by - D3DXVECTOR3 on December 6, 2007 2:10:26 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!