Infinete plane with grid in OpenGL & QT4


I Need a sample (very simple) to draw an pseudo infinite plane with a grid as seen in the image:

I’m starting to learn OpenGL in QT…


Mirko Gonzales

Cheapest solution is to render that with a repeating texture map, and just draw a plane with the texture on it. Best thing is that you get GPU filtering for free, which should radically reduce the aliasing over what you see in this picture. In particular if you turn on anisotropic filtering and max it out.

Thank you very much for the reply. How do I determine the limits for cover the whole screen? Could you give me a simple example?

Any Example?

It depends on the needs of your app. You can start with generating a big quad and centering it on the eyepoint at some constant elevation.

My project consists in plotting the path of a vehicle (represented by a 3D objet). The camera is always a constant distance and position on this. The plane is a pseudo infinite grid. I managed to upload a .Obj file and move. Only necessary to draw the pseudo infinite ground plane (grid). Help me… Please!

If you are going to render as a textured quad, then don’t use a single gigantic quad because the texture will shake due to floating point precision issues. Render many smaller quads. If you want to know how far your quads need to extend to, you just take a look at your projection matrix zFar value. If the value is 1000.0, then anything beyond that will get clipped.

If you render a textured quad, so you can just put a plane out there always centered on the eyepoint but have the texture dynamically “move” along, you can use projective texture coordinate generation (i.e. texgen) to map a world-space position to texture coordinates. Just be careful how you’re computing texture coordinates to avoid precision issues.