3D Grid

Hi…

I’ve made a 3D grid to view “mountain peaks” using lots of QUAD_STRIPs parallel to each other. However, the problem is that the QUAD_STRIPs are all separated from each other (they don’t connect up). How can I create a Grid (an easy way) in OpenGL to have a 3D grid/mesh effect (possibly to enable lighting later on too).

Thanks.

I’ve thought of:

comparing each edge of the QUAD_STRIP with the edge of its neighboring QUAD_STRIP and storing the value of whichever is larger, into the smaller edge.

This could work…

nope. it didn’t work!

I don’t understand at all your issue…maybe a drawing of the situation might help! :slight_smile:

I think I know what you mean and something you might want. Use a variable and increase it by the size of your quads in your strip for each of the quads until you reach the desired size (width or height of the quads multiplied by the number of quads). I will provide example code (I used i for the integer because I am uncreative you can use any name for your variable that works):

    // Draw the ground
    glBegin(GL_QUAD_STRIP);
    for(int i=0;i<=6400;i += 16) {
        glVertex3f(i, 0.f, 0.f);         // Vertex 2
        glVertex3f(i, 0.f, 3072.f);      // Vertex 1
        glVertex3f(0.f, 0.f, i);         // Vertex 4
        glVertex3f(3072.f, 0.f, i);      // Vertex 3
    }
    glEnd();

It is extremely big to test whether I made the code good enough that it will run on my computer without running out of memory (I used 16 because I planned on using 16x16 pixel textures to cover each quad but I don’t know how to texture map quad_strips but I will find out eventually on my own but if I don’t I will start a new thread)