maybe i am just openGL'd out for the day and i know i am close just not sure what i am doing wrong. below is how i was doing it before and after that how i am trying to do it now. i am using this method to draw 3D terrain.
this first way of drawing the strip was to take already defined arrays. for my program it is terrain[1441][721][3]. basically i took the approach of searching through the data file , set up a few counters then assigned my 3d array that way. of course i knew this isnt the best way to do it but i will continue. after loading all the x, y, z(depth) into the array, my loop to draw it goes as such:
for(int j = 0; j < numy - 1; j++)
{
glBegin(GL_TRIANGLE_STRIP);
for(int i = 0; i < numx; i++)
{
glVertex3dv(terrain_gS[j]);
glVertex3dv(terrain_gS[j+1]);
}
glEnd();
}
my updated program now has my array defined after checking for and loading the data. since i am using a class obviously doing it the way before will give me an error. so i crunch through the data and come up with the same numbers but assign the x and y counts to local private variable to the class, then declare my terrain array as such:
terrain = new float[x_size * y_size * 3];
this equals to 3,116,883 points.
anyway i am trying to change the 2 for loops above to do that same thing but i my program keeps crashing or i play with it and it runs but my strips dont connect(a bunch of points in space) or something else weird happens. what would need to be corrected from below? on a final note, i have loaded my data in correctly as a function that i do not show you is written for that purpose so i not its not any numbers in the wrong place , its in this drawing part itself as below.
int count = 0;
for(int j = 0; j < y_size-1; j++)
{
glBegin(GL_TRIANGLE_STRIP);
for(int i = 0; i < x_size; i++)
{
glVertex3f(terrain[count], terrain[count+1], terrain[count+2]);
count += 3;
glVertex3f(terrain[count], terrain[count+1], terrain[count+2]);
count += 3;
//cout << count << endl;
}
glEnd();
}
im sorry for not formatting this to make it more readable -- how do i do that?? then i will go back and change it.. thanks so much in advance!
[Edited by - OpenGL_Guru on December 3, 2004 8:28:19 AM]