I am drawing a grid that has holes in it, ie some boxes I do not want to draw.
I am currently doing this in a very low-tech way, determining by if statement whether or not to draw the box, and drawing a sequence of connected boxes, like:
glBegin(GL_QUAD_STRIP);
do {
glColor …
glVertex(x,y,z)
glColor …
glVertex(x2,y2,z2);
} while (box should be drawn)
glEnd();
I also draw grid lines on top.
I’d like to use a single grid call, particularly because Java is comparatively slow, and I’ll bet performance would go way up, but this would require faking OpenGL into not drawing the boxes that aren’t there.
So:
-
Is there a value I can put in for color that will make the box disappear?
-
Will this technique work the same way using VBO? I would like to put the (constant) x,y grid up on the video card and only transmit the z value and the colors.
-
I am currently drawing the edges in a similarly ugly manner:
if (box exists) {
glVertex(lower-left-corner)
glVertex(lower-right-corner) // draw bottom edge
glVertex(loewr-left-corner)
glVertex(upper-left-corner) // draw left edge
}
This isn’t even fully correct, as it leaves off edges. I’d rather not draw all four sides however, as that would be redundant for all the boxes that are adjacent to other boxes. Ideally, there is a single meshing call that can be used to draw the grid lines but still skip the ones I want to skip?
thanks!