Graphics in C++
I am quite new to C++ and have learned the basics (objects, inheritence, pointers etc.). I am however having problems implementing any "graphics" at all. All I can do is write text. Is there an iostream class member I should use or something else obvious which I have missed. I would be grateful if you could help.
>>>>>>>>>>>>>>>>>Ilthigore<<<<<<<<<<<<<<<<<
Nothing of the kind. Assuming you''re working under Windows, the first thing you would have to do is switch from making console applications to Windows applications. Among other things, that means that you can''t use the normal IO streams for displaying text. If you''re using Microsoft VC, when creating a new Win32 app (or MFC, if you would prefer) tell it to create a simple "Hello world" application. That should show you a little bit about creating Windows applications.
For graphics, there are several options:
- the Windows GDI, easy but slow
- DirectX (DirectDraw for 2D stuff, Direct3D for 3D stuff)
- OpenGL
- other libraries, such as SDL, Allegro and what have you.
There''s a lot of information in the resources section.
For graphics, there are several options:
- the Windows GDI, easy but slow
- DirectX (DirectDraw for 2D stuff, Direct3D for 3D stuff)
- OpenGL
- other libraries, such as SDL, Allegro and what have you.
There''s a lot of information in the resources section.
Kippesoep
C++ is a programming language. It doesn''t define any graphics output by itself, in fact it doesn''t even define text output in the language itself (iostream is nothing but a convenience lib function set, it is not defined in the C++ core specifications).
To do graphics, you''ll need a graphics API. That''s simply a collection of functions or objects that let you access the graphics subsystem. Several such APIs are available. Some are multiplatform (they work on multiple OS''s and even non-x86 systems: SDL, OpenGL, etc), some are OS-specific (Windows: GDI, DirectDraw, D3D, etc).
So, your first step is to make a choice: Windows only, or platform independent ? The next choice is 2D or 3D. Since you are starting, 2D would be more appropriate. Assuming you use Windows, I''d suggest starting with simple GDI (or GDI+). There are lots of tutorials available on the net, the resource section of GDNet has some very good links/articles as well.
After you know the basics, you can move on to DirectDraw/SDL/Allegro, those are faster than GDI (a lot) but more complex. Once you feel ready (and have the required mathematical background knowledge), you can go 3D with OpenGL or Direct3D.
BTW: I''m moving this to the beginner forum.
/ Yann
To do graphics, you''ll need a graphics API. That''s simply a collection of functions or objects that let you access the graphics subsystem. Several such APIs are available. Some are multiplatform (they work on multiple OS''s and even non-x86 systems: SDL, OpenGL, etc), some are OS-specific (Windows: GDI, DirectDraw, D3D, etc).
So, your first step is to make a choice: Windows only, or platform independent ? The next choice is 2D or 3D. Since you are starting, 2D would be more appropriate. Assuming you use Windows, I''d suggest starting with simple GDI (or GDI+). There are lots of tutorials available on the net, the resource section of GDNet has some very good links/articles as well.
After you know the basics, you can move on to DirectDraw/SDL/Allegro, those are faster than GDI (a lot) but more complex. Once you feel ready (and have the required mathematical background knowledge), you can go 3D with OpenGL or Direct3D.
BTW: I''m moving this to the beginner forum.
/ Yann
Well it really isn''t graphics, but with it you can do small ascii graphics, if windows is a little hard to understand right now, you can always try the windows console functions. I have made small games like Tetris with them. It really is not hard to understand, and I like them because they are like PreWindows. It gives you a nice little understanding how an API works, without to much to learn. If you are interested in these functions and structures Ill print them out for you here.
Jeff D
Jeff D
Suffered seven plagues, but refused to let the slaves go free. ~ Ross Atherton
I''ve said it before, and I''ll say it again, IMHO Allegro is the only way to go for an inexperienced programmer. You are ready to draw on the screen in about 5 function calls. Its really a no brainer. In second place would be SDL but I haven''t used it yet so I can''t say for sure.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement