Sign in to follow this  
Poldi

VertexBuffer and Bezier Curves

Recommended Posts

Poldi    122
Hi, I have a question about vertex buffers. id like to use a vertex buffer for rendering a landscape. Currently i use this code: for(int x=0;x<SIZE;x++) for(int y=0;y<SIZE;y++){ glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, (3*SIZE+1)*3, 4, &ctrlpoints[x*3][y*3][0]); glEnable(GL_MAP2_VERTEX_3); glMapGrid2f(20, 0.0, 1.0, 20, 0.0, 1.0); glColor3f(1.0, 1.0, 1.0); glEvalMesh2(GL_LINE, 0, 20, 0, 20); } Problem: the landscape is evaluated again for each frame. I wonder if it would somehow be possible to save the mesh to a vertexbuffer after generation. could u please give me a code example or tell me where to look it up? thx, Henning

Share this post


Link to post
Share on other sites
zedzeek    529
u can generate the cureves yourself, theres plenty of info on the net on how to do this (it shouldnt be anyslower), glMap(..) is not gonna be done in hardware but on the cpu anyway

Share this post


Link to post
Share on other sites
Poldi    122
thx, ill try that then, i just found out, i can get the factors for the polynomes from OGL, that can save some time coding :) ill do it that way then.

some nice stuff u got there on ur hp, i like it.

Share this post


Link to post
Share on other sites
Dreq    100
This may be a complete shot in the dark, but if its a static terrain wouldn't a display list be a viable solution? I honestly haven't studied display lists yet (although its actuially what I'm going to teach myself tonight), but from what I understand it remembers how you draw the scene (inside the glNewList/glEndList blocks) and allows quick re-drawing of that scene. I could be completly wrong but it never hurts to try ;)

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