This topic is now archived and is closed to further replies.

drawing vert arrays

This topic is 5571 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am having a problem drawing an array of floats that make up my model. My question is when you are using an array for a vertex list does the array have to be declared initialy such as say : float ary[x][3] or are you allowed to have a dynamic array using new? I am using the new method because I intend for my models to be of different sizes so dynamic is the way to go. It bugs me that I can''t get inside of glDrawArrays() to see what exactly it is trying to draw. I get one point at the origin but nothing else. Also, in the model there isn''t even a point at the origin. If any OpenGL gurus could help me I would greatly appreciate it. Thanks, NextGenGamer

Share this post

Link to post
Share on other sites
sounds like youre doing something wrong

typedef float vector[3];

vector *verts = new vector[100];

set vert values here
draw the values

also a good debugging method is draw them NOT using vertex arrays but using immediate once this works then covert it over to vertex arrays

for (i=0;i<100;i++)
glVertex3fv( verts[0] );
glVertex3fv( verts[i][1] );
glVertex3fv( verts[i][2] );

Share this post

Link to post
Share on other sites
Hi, thanks for the response.
I have tried using a loop inside glBegin with points just to see the verts. This does work I see all the points and everything checks out it isn''t my array.

I was asking about the new thing becaues intstead of starting off with a single pointer I use **ary and init them all at run time.

glVertexPointer(3, GL_FLOAT, 0, md.GetVerts());
GetVerts return the address of the ary.

The problem is either here or with the actual draw.
glDrawArrays(GL_POINTS, 0, md.NumVerts());
NumVerts() returns how many verts there are.

both the array and the numverts var check out ok. I''m at a loss from here on though


Share this post

Link to post
Share on other sites