Jump to content
  • Advertisement
Sign in to follow this  
denebo

OpenGL Basic questions

This topic is 2462 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've started learning OpenGL recently (using C++ and GCC).

- As of now, in order to move the scene around (objects in the scene) I've been using glTranslatef. I can move objects left and right, but when I try to translate on the Z axis, my objects disappear. I'm sure I'm missing some sort of initialization step regarding depth, but I'm pretty lost. I used glEnable(GL_DEPTH_TEST) (although I'm not even sure what this does) and have been clearing the GL_DEPTH_BUFFER_BIT.


- Another thing I've been having trouble understanding is the coordinate system. I migrated from using DirectX, where top left was coordinate (0, 0). With a bit of messing around in OpenGL, I think I got an idea of how the coordinates work. The middle of the screen is (0,0) and each cuadrant is 1.0 units. I don't understand how to use this coordinate system though.

Share this post


Link to post
Share on other sites
Advertisement
1. How are you setting up your view matrix? perspective? ortho?
2. What do you mean, 'how to use' the coordinate system, what are you trying to do?

Share this post


Link to post
Share on other sites
I think you came from DX 2D, all 3D coordinate systems are 0,0,0 in the middle of the screen. Opengl, x = right, y = up, z = coming out at you from your screen.

glOrtho/gluPerspective, whichever one you are using, there is a near and far value. Things behind the near plane, are listed as behind you and not drawn. Things behind the far value or too far away are not draw. Remember positive z comes out at you, negative z points into the screen so remember which way you are translating.

Share this post


Link to post
Share on other sites
maybe your near and far planes are incorrect, so your object has been moved out of scope.
or maybe, they are moved behind your camera.

answer these questions may help you solve the issue:

A, where is your camera?
B, In what direction is your camera facing?
C, what are your near and far planes?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!