I am having issues with finding the vertices that make up all the triangles within a given opengl triangle strip. I was wondering if anyone could help with ways of approaching that with some pseudo code or examples.
Here is an example of me drawing every vertex. I know that I need to assign each vertex to a triangle object which contains local variables point1, point2, and point3. These three variables are a vector object which each have an x, y, and z. But my problem always ends up with where do I create the triangle object when I obviously shouldn't create one every iteration of either for loop? Also, the reason I am needing to know the points of every triangle is because I am calculating surface normals.
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
for (float z=0.0f; z<=20.0f; z+=2.0f) {
for (float x=0.0f; x<=20.0f; x+=2.0f) {
GL11.glVertex3f(x, 0.0f, z);
}
}
GL11.glEnd();
Also, I am using the lwjgl in java if that is of any help.
Assuming your code worked:
triangleList now has all triangles being rendered!