Whenever I draw points using glBegin(GL_POINTS) if the Z coord is > 1 or < 0 the point is not drawn. Can someone explain why it works that way? Or maybe supply a link that explains how to take advantage or the coordinate system.
I was using DirectX before and when you put a point at 1.0f,1.0f,10.0f. Depending on where your camera and stuff is, the point shows up in expected place. But for opengl it seems that 1.0f is limit for all dimentions. What’s the deal?
When you call gluPerspective(…), the last two arguments are the near and far clipping planes. Points won’t be drawn if their Z values are outside of this range.
Alternatively, you can use glFrustum(…) to accomplish the same job, but in a less intuitive fashion (IMO; You manually calculatethe FOV and aspect ratio).
If your near is 3, far is 7, your near clip plane will be at -3, the far clip plane at -7. (Negative z goes into the screen by default) So… if you try to draw a point with a z of 10.0f with no other transformations, you will not only be drawing it in front of the near clip plane, but behind your camera. Try to do a glTranslate(0.0, 0.0, -cameraDistance); to move the “camera” back a bit.
hmmmmm… I tried modifiying everything listed above. Right now im drawing and X allong the 0.0f z axis and a mesh ball in the middle. Made the numbers greater and smaller and they didn’t even look like they effect anything. the glLook does how ever give me different results. but i changed the near and far to all different numbers and nothing happens. Oh well… maybe it’s my G-Card or maybe I should stick to DirectX.
Thanks everyone for your help and i will keep monkeying around.
what about posting your code, or parts of it? if glPerspective does not affect anything, something has to be wrong with your program, and that should be fixed, as otherwise there’s the danger of you sticking do directx and we surely would like to help preventing this.
Again, if you are putting something at z=0, you are not going to see it, since in a perspective matrix, you should have your near far plane >0. (As I stated in your previous example of 3 for the near plane, it will be at z=-3, so z=0 is still in front of the near clip plane and will not be displayed.
Switch to D3D if you want, but you are going to run into these same problems. It uses matrices pretty much the same way as OpenGL.