0
votes

I've read a couple of tutorials about what OpenGL is and how OpenGL works in code, but I simply don't get how you use it just like you use the canvas.

In all the tutorials they showed me that OpenGL is capable of drawing what ever object I want, but always with the examples of vertices like "1.0f, 1.0f, 0.0f", "-1.0f, -1.0f, 0.0f" and "0.0f, 0.0f, 0.0f". I assume the floats are representing pixels, means my my vertices are on A (1px/1px/0px), B (0px/0px/0px) and C (-1px,-1px,-1px). So if I view my new triangle from the near (e.g. 0/0/-10), then I can see it. If I view it from the far (e.g. 0/0/-500), then I do not see it, because it's simply only a few px² big. Am I right?

If I'm right, all these floats stand for pixels. Means If I view my OpenGL-Surface from far enough, I could see the screen and its' pixels in the original size, couldn't I? How do I determine the distance then, which I would have to set in the "GLU.gluLookAT(GL, x, y, DISTANCE, ...)"? And how can I move the coordinate plane to the top-left corner, or better bottom-left corner, of my screen?

Incase I'd be able to do that, I'd have my view point (GLU.gluLookAt(...)) at x=screen_width / 2, y=screen_height / 2 and z=?. In that case, wouldn't I see the object that is directly "under" me just in the dimensions as it is, and all the other objects (e.g. on x=0, y=0, z=0 OR x=screen_width, y=screen_height, z=0) from some other direction? I mean, wouldn't I see them deformed / shaped in another way?

I just want to use OpenGL, because it is faster and because I want to learn handling with it, but I want to have the same view on my objects, like I have on the canvas.

THanks in advance!

1

1 Answers

1
votes

Those floats don't stand for pixels. They are simply units in the OpenGL coordinate system. The pixels that are finally drawn are the combination of the transformations the graphics processing pipeline performs on that input data and you usually don't control them directly.