Advertisement

How to make an Infinite plane?

Started by August 25, 2002 01:47 AM
9 comments, last by takumi 22 years, 6 months ago
I want to make an infinite floor which give the user the illusion of moving in an infinite space. I think I should draw the part of the infinite floor that lies underneath the camera, wherever the camera happens to be. However I don''t know how to code it......... Can you all give me example or tutorial for me to reference? Thanks you very much.
I''m not sure exactly whats in your project but from what you''ve said you should be able to create a plane, and then update its position every frame based on the camera''s position, making the plane slightly bigger than the view of the camera. If you want your camera to move freely, you could also calculate the size of the plane based on the rotation and height of the camera (for example, if the camera is looking directly parralel to the plane, the plane could be expanded out to the clip plane.
Advertisement
Thanks you.

Actually, I still investigate on how to do the floor

So, do u know any good examples for me to reference? Thx~

  glBegin(GL_QUADS); { glVertex3f(  camerapos.x - farclipplane*sqrtoftwo,  0,  camerapos.y - farclipplane*sqrtoftwo ); glVertex3f(  camerapos.x + farclipplane*sqrtoftwo,  0,  camerapos.y - farclipplane*sqrtoftwo ); glVertex3f(  camerapos.x + farclipplane*sqrtoftwo,  0,  camerapos.y + farclipplane*sqrtoftwo ); glVertex3f(  camerapos.x - farclipplane*sqrtoftwo,  0,  camerapos.y + farclipplane*sqrtoftwo );} glEnd();  



"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

Thanks you very much~

Can u teach me how to obtain the value of "farclipplane"?


Besides, I want to ask a little question. :D

Why we need to use GL_QUADS to draw the floor? What is advantage of using it?

Because I saw some tutorials also use GL_QUADS for examples.

[edited by - takumi on August 25, 2002 8:38:24 AM]
a quad just draws 2 triangles.. as your floor will be sort of a quad, and not sort of a triangle, you draw a quat.

farclipplane is what you specify as farclipplane in gluPerspective.

read up the documentations about this, its very well documented and explained. and always ask google for information or description of such stuff..

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

Advertisement
Quads get split into tris before being sent to the video card anyway. Its faster to use a triangle strip in this example. ( although there won''t be much difference, its only two tris.. )
sounds like you want a scroller or somthing to that extent,
thats what i used before, just take the far cliped area of the poly, then simple start it over. Because if you had it so it followed the cam, collision might not work right.
I posted the idea about the scroller, and i also had another idea
well some games ive played simple take thw entire world, and rotate it to give the apperance of infinity.
Jason w.
you may have issues with the traignales drawn on screen ''jittering'' because they arn''t being clipped to the frustum very well.. in this case it would probably be easier to use a triangle fan.. vith the first vertex just below the camera...

something like: (off my head)

glBeing(GL_TRIANGLE_FAN);

glVertex4f(camera.x,camera.y,floorHeight,1);

glVertex4f(camera.x+1,camera.y+1,floorHeight,0);
glVertex4f(camera.x-1,camera.y+1,floorHeight,0);
glVertex4f(camera.x-1,camera.y-1,floorHeight,0);
glVertex4f(camera.x+1,camera.y-1,floorHeight,0);
glVertex4f(camera.x+1,camera.y+1,floorHeight,0);

glEnd();

that would probably work.. but texturing would be an issue with the infinite verticies...

This topic is closed to new replies.

Advertisement