View Full Version : Surface Bezier - Collisions

02-01-2010, 10:02 AM
Hello everyone,

I hope my topic will generate responses to help me here because I'm really really really stuck.

I created my site using a three dimension table to have a ground flare.

For this I used the opengl functions glmap and glEval.

My field is displayed perfectly.

However I would like now made collisions with the ground.
My problem is that the field is rounded and I'm only the tops of the control points of the curve.
While the ground is round.

I would like to know how I can retrieve the tangents to the curves or simply having all the control points between.

I would like to know how his is that I can not display bezier curves in opengl with an array dimen greater than [32,32,3] if I go over 32 then nothing appears .

Thank you soon to help me out of pity, because I can not see doing so was as straight lines while the field is a curve.

02-01-2010, 01:44 PM
I believe you should use a vertex shader, there you should be able to access the normals and points generated by the bezier evaluator, then if you want to save the data you should render your surface (seeing it from above) to a texture using a fragment shader. for example:

//vertex shader
varying vec3 NormalVector;
varying vec3 SurfacePoint;

void main()
NormalVector= gl_Normal;
SurfacePoint= gl_ModelViewProjectionMatrix * gl_Vertex;
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;


//fragment shader
varying vec3 NormalVector; //interpolated data
varying vec3 SurfacePoint;

void main()
gl_FragData[0] = NormalVector; //write result to multiple buffers
gl_FragData[1] = SurfacePoint;

I hope it's useful.

02-01-2010, 02:09 PM
For begin thank for your answer, you are the only personne who had reply at my post.

Sorry for my english i am french.

I have 1 probleme and 1 question.

My problem is:

I use c# thus Tao FrameWork.

I don't have GlFragData and glModelViewProjectionMatrix.

My question is:

Can i use :

Gl.glMap2f(Gl.GL_MAP2_VERTEX_3, 0, 1,
3, 32, 0, 1, 3 * 32, 32, ref pts[0, 0, 0]);
0, 1, 2, 2, 0, 1, 4, 2, ref textures[0,0,0]);

Gl.glMapGrid2f(32, 0.0f, 1.0f, 32, 0.0f, 1.0f);

Gl.glEvalMesh2(Gl.GL_FILL, 0, 32, 0, 32);

And retrieve the normals and points generated ?


Alfonse Reinheart
02-01-2010, 03:11 PM
I don't have GlFragData and glModelViewProjectionMatrix.

They're talking about GLSL vertex and fragment shader code. He's saying that you should use a vertex and fragment shader to output the coordinates of the mesh data to render targets.

02-01-2010, 04:30 PM
Ok I didn't know the shaders.

If i have understand:

The shader stores the vertex data sent.
Then I can get a triple table?

I have see that this technology can create problem because she depend of graphics card ?

Would it be better to recalculate different points on the curve thanks to a mathematical formula?