Dark Bit Factory & Gravity

PROGRAMMING => General coding questions => Topic started by: energy on March 14, 2008

Title: OpenGL: saving Coordinates from glevalcoord1f
Post by: energy on March 14, 2008
Hi
I generated with glevalcoord1f a Bezier-Curve!
Is it possible to save the generated Coordinates in an external array?
Is there a function that does it?
Havent found anything in the RedBook!

Want to use them for camera!!!

Thanx in advance!
 
Title: Re: OpenGL: saving Coordinates from glevalcoord1f
Post by: hellfire on March 14, 2008
Is it an option to simply implement it yourself?
What it basically does is this:
(http://www.2dcurves.com/polynomial/h03polyf.gif)
Title: Re: OpenGL: saving Coordinates from glevalcoord1f
Post by: ninogenio on March 14, 2008
 ;D and for people like me, what does that equation mean?

@energy i dont think its posible with ogl to retrieve transformed coords. you have to manually transform any coords you wish to keep track of. having said that ive never used glevalcoord1f what exactly does it do?
Title: Re: OpenGL: saving Coordinates from glevalcoord1f
Post by: hellfire on March 14, 2008
Quote
ive never used glevalcoord1f what exactly does it do?
The Function glEvalCoord1f evaluates a polynomial previously specified by glMap1f and sets its' value as vertex-, texture-, normal- or color-value.
Polynomials are just smooth functions with some ups & downs.

Quote
what does that equation mean?
That "Sum"-Sign is nothing more than a loop:
Code: [Select]
for (int i=0;i<n;i++)
  y+= a[i] * pow(x, i);
where "a" are the polynomial's coefficients from glMap1f() and "x" the parameter you passed to EvalCoord1f().
In practice you won't use the "pow" but just do another multiply.

Quote
i dont think its posible with ogl to retrieve transformed coords
I think you won't get a vertex-position since it's not an actual state (maybe i'm wrong here) but you can tell EvalCoord to generate a texture coordinate and read that back using glGetf(GL_CURRENT_TEXTURE_COORDS, &values).
Title: Re: OpenGL: saving Coordinates from glevalcoord1f
Post by: ninogenio on March 14, 2008
very usefull info hellfire thanks very much k+!
Title: Re: OpenGL: saving Coordinates from glevalcoord1f
Post by: energy on March 15, 2008
@Hellfire thanx for the answer.
Thought that OPENGL can do the work for me!
so i did i handy...
a cool Tut about this is:
http://www.gamedev.net/reference/articles/article1808.asp

cheers
energy