Results 1 to 2 of 2

Thread: Drawing grid

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2014
    Posts
    9

    Drawing grid

    Hello,

    Can anyone explain to me how can one draw a grid with different cells colors. I'm trying to implement Game of Life, and I need to draw a grid with white/black color for each cell.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Nov 2012
    Location
    Oldenburg, Germany
    Posts
    190
    You could simply draw a quad for each cell.
    Something like
    Code :
    glBegin(GL_QUADS);
    glColor(1,1,1);
    glVertex2f( x, y ); glVertex2f( x+cellSize, y );
    glVertex2f( x+cellSize, y+cellSize ); glVertex2f( x, y+cellSize );
    glEnd();
    will draw you a cell in the z=0 plane.
    There are quite a few good tutorials on the web showing how to do this.

Similar Threads

  1. OpenGL Drawing Grid (help)
    By IntelliSense in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 10-27-2013, 03:55 AM
  2. efficient drawing of a grid
    By dovkruger in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 10-21-2006, 01:48 PM
  3. Efficient drawing of a staggered grid
    By dovkruger in forum OpenGL: Advanced Coding
    Replies: 9
    Last Post: 10-20-2006, 11:48 PM
  4. tricks for drawing portions of a grid?
    By gmeed in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 08-29-2004, 06:38 PM
  5. Drawing a 3-D grid
    By PeterK in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-01-2000, 08:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean