Hi
I have a header file like that. I'm willing to create a grid. By using OpenGl and C++. The problem is in there cpp file. I can't excatly draw. Hope you can help it.In the for loop i don't know how to fill inside the vertex blocks
Code :#ifndef Grid_h #define Grid_h #include "Shape.h" class Grid :: public Shape { public: Grid(); Grid(int numberOfLines,int distanceBetweenLines); void Draw(); int distanceBetweenLines; int numberOfLines; }; #endif
Code :#include "Grid.h" #include <GL/freeglut.h> Grid :: Grid() { numberOfLines = 0.0f; distanceBetweenLines = 0.0f; } Grid:: Grid(int numberOfLines , int distanceBetweenLines ) { cizimSekli = GL_LINES; //drawing way numberOfLines= 50; //number of Lines renk = Renk(0.0f, 1.0f, 0.0f); //Colour distanceBetweenLines = 20; for(int x = 0; x < numberOfLines; x++){ glBegin(GL_LINES); glVertex2f(x,0); glVertex2f(0,x); glEnd(); }; for(int y = 0; y < numberOfLines; y++){ glBegin(GL_LINES); glVertex2f(y,0); glVertex2f(0,y); glEnd(); }; }