I'm writing a robotics interface and I want to draw a grid map of the environment. I have a matrix that stores the probability of occupation for each tile of the grid (0 for clear; 1 for occupeid).
Now, I'm drawing a sequence of GL_QUADS with the color of the occupation but it seems be slow.
for (int j=0; j<map.GetSizeY(); j++){ for (int i=0; i<map.GetSizeX(); i++){ glBegin(GL_QUADS); gray=1.0-map.GetProbValue(i,j,k); glColor3f(gray,gray,gray); glVertex2f((map.idx2x(i)-r),(map.idx2y(j)-r)); glVertex2f((map.idx2x(i)-r),(map.idx2y(j)+r)); glVertex2f((map.idx2x(i)+r),(map.idx2y(j)+r)); glVertex2f((map.idx2x(i)+r),(map.idx2y(j)-r)); glEnd(); } }
Is there any other way to draw the gridmap?
Thanks in advance,
André
PS: r is half of the resolution of the map (i,e. r is the size of each tile)