PDA

View Full Version : Infinete plane with grid in OpenGL & QT4



mirkogonzales
02-17-2013, 06:16 PM
Hey

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

http://ts3.mm.bing.net/th?id=H.4895280054731142&pid=15.1

I'm starting to learn OpenGL in QT...

Tanks.

Mirko Gonzales

Dark Photon
02-17-2013, 07:41 PM
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.

mirkogonzales
02-18-2013, 04:41 PM
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?

mirkogonzales
02-21-2013, 05:24 AM
Any Example?

Dark Photon
02-21-2013, 07:02 AM
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.

mirkogonzales
02-21-2013, 10:00 AM
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!

V-man
02-22-2013, 06:37 AM
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.

Dark Photon
02-22-2013, 05:54 PM
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.