Sign in to follow this  
rotalever

sending data to vertex shader

Recommended Posts

rotalever    122
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
rotalever    122
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
rotalever    122
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

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