Sign in to follow this  
StPapyna

I'm a New guy about draw mesh from vertex in openGL

Recommended Posts

Hi everyone .... I had a problem that's: I load vertex datas from a text file, build a array called vt,then i want to draw a terrain mesh,as following glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(3,GL_FLOAT,0,vt); glDrawArrays(GL_POINTS,0,25); glDisableClientState(GL_VERTEX_ARRAY); there is only 25 vertex,i want to use them to build a mesh. i build it in 3dsmax,and it's correct. but whichever the draw mode i choose,the lines looks like spider web, full of the whole space,does not like a mesh at all.... why ? thanks very much.. I am a beginner.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
before you go of into vertex arrays you should learn the glVertex3f calls first

maybe your vertexs aren't arranged correctly, a messed up pointer, or it could be something as simple as forgeting color or lighting

make sure you translate your matrix (move the scene away from the camera) enough where you can see the mesh.
by default negative z values show up in view and positives behind the camera

i would try some good tutorials such as nehe.gamedev.net

please post more details and maybe even some more code, because there is nothing here to describe the problem
does the screen clear, does anything draw at all?
be specific

Share this post


Link to post
Share on other sites
well, openGL is very clear that all triangles must be in the same order, so maybe some parts of your vertex array are in the wrong order, or something else. I really don't know, I'm not a fan of vertex arrays I don't think they even speed things up enough to make them worth using.

Share this post


Link to post
Share on other sites
Try something like


glBegin (GL_QUADS);
glVertex3f ( -1.0f, -1.0f, 0.0f );
glVertex3f ( 1.0f, -1.0f, 0.0f );
glVertex3f ( 1.0f, 1.0f, 0.0f );
glVertex3f ( -1.0f, 1.0f, 0.0f );
glEnd();


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