Sign in to follow this  

sending data to vertex shader

This topic is 4022 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

Hmm, but how to get the data for "vec2 uniform" onto the graphiccard?
I thought using something like glColor..() can work?
And yeah it's constant for all vertices, but changes with each frame.

Share this post


Link to post
Share on other sites

GLhandleARB prgmShdr;

...

GLuint eyePos = glGetUniformLocationARB( prgmShdr, "eyePos" );

...

glUniform3fARB( eyePos, 0.0f, 0.0f, 0.0f );


if you have vec2 uniform eyePos in your shader. if its not called eyePos, change "eyePos" to the variable name.

Share this post


Link to post
Share on other sites
What does the line
GLuint eyePos = glGetUniformLocationARB( prgmShdr, "eyePos" );
do exactly?
I have the coordinates in the main program as two floats. Could I pass them directly with this glUniform3fARB ? Hmm..., I dont understand you code... :-(

Share this post


Link to post
Share on other sites
Aah, I think I've guessed, what it means.
glGetUniformLocationARB() gives me something to store data for the shader, glUniform3fARB( eyePos, 0.0f, 0.0f, 0.0f ); will store the information. And I can change the 0.0fs to the values I need... Thanks!

Share this post


Link to post
Share on other sites

This topic is 4022 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this