PDA

View Full Version : 2D Graphics!



Fernando
08-15-2001, 07:43 PM
Hi! I'm a beginner in OpenGL, and I want to know how do I write 2D graphics?

I have tried to search some topics about this, but all that I found were documents telling about 3D graphics, like "creating squares and triangles..."

Is it possible to write 2D graphics in Open GL?? or only 3D graphics are valid?

john
08-15-2001, 07:54 PM
yes. this has been done before, btw.



3D graphic:
+----+
/ /|
+----+ |
| | |
| |/
+----+

2D graphic:
+----+
| |
| |
+----+

moral? don't draw the third dimension.

cheers,
John

Fernando
08-15-2001, 08:08 PM
Yes, but i think when we draw a rectangle in Open GL, it automaticaly Loaded a Z buffer... it should not appear, but it is loadded and taking memory....

Am I right?

mikael_aronsson
08-15-2001, 10:11 PM
Hi !

OpenGL uses a pipeline architecture, this means that your graphics don't use any memory (except of course for the frame buffer) and you can disable the Z-buffer.

So you can just use the 2D version of the glVertex calls (glVertex2xxx).

Mikael

Rob The Bloke
08-16-2001, 05:48 PM
At last, someone who wants to program Streetfighter !! http://www.opengl.org/discussion_boards/ubb/smile.gif

Bob
08-17-2001, 01:16 AM
Why disable the Z-buffer when you don't even have to enable it in the first place, it's disable by default. And if you don't want a Z-buffer at all, then don't ask for one when creating the context.

After all, 2D is just a special case of 3D. It's 3D where all coordinates has the same Z-value.