drawing vert arrays
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
www.celestialwake.com
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
eg
for (i=0;i<100;i++)
{
glBegin( GL_TRINGLES)
glVertex3fv( verts[0] );
glVertex3fv( verts[1] );<br>glVertex3fv( verts[2] );<br>glend </i> <br><br>http://uk.geocities.com/sloppyturds/gotterdammerung.html
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
eg
for (i=0;i<100;i++)
{
glBegin( GL_TRINGLES)
glVertex3fv( verts[0] );
glVertex3fv( verts[1] );<br>glVertex3fv( verts[2] );<br>glend </i> <br><br>http://uk.geocities.com/sloppyturds/gotterdammerung.html
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
NextGenGamer
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
NextGenGamer
did u enable GL_VERTEX_ARRAY also did u try glGet( GL_ERROR ) or whatever the correct syntax is
http://uk.geocities.com/sloppyturds/gotterdammerung.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement