Help with graphics please
I want to start to use graphics in my programs and was wondering how to do things like load bitmaps and draw lines to screen. I have seen posts where people talk about directx and opengl, but i dont really understand; do you have to use directx or opengl to work with any kind of graphics in c++? The only other language i have ever used is visual basic and in that there are commands to load pictures or draw simple shapes. Could someone point me in the direction of some basic tutorials for 2d graphics.
thanks
Well, most people do use DirectX or OpenGL for the graphics, but I read about on another post of using Window''s GDI interface, but I wouldn''t mess with that. I can help a little, if you are somewhat familiar with C++, then maybe you should check out the NeHe tutorials in the Articles and Resources section, under OpenGL. These tutorials are mostly used for 3D, but after a few of the tutorials, you should know how to draw a 2D four sided polygon and stick a bitmap on the front of it, this is a little pathetic however. DirectX would probably help you, since it can normally support 2D, but I don''t know much about DirectX. I do believe that C++ does support loading and displayin bitmaps, but I don''t really know how, sorry. You shouldn''t have too much trouble with it though.
En taro Adun!
Doom to all who threaten the homeworld!
*Protoss Zealot - Starcraft*
En taro Adun!
Doom to all who threaten the homeworld!
*Protoss Zealot - Starcraft*
----------------------------------------------------------You know, I might as well go ahead and say I can't fix the problem... because that's when I figure out how.
quote: Original post by Zealot
I do believe that C++ does support loading and displaying bitmaps, but I don''t really know how, sorry.
No, it doesn''t. C and C++ are meant to be independent of their platform, and some platforms don''t have the ability to havegraphical output (no screen/monitor/display or whatever). Some people think that text output (cout and/or printf) should have even been left out of the core C/C++ standards. OpenGL and DirectX are more than adequite for any real time 2D or 3D graphics, in my opinion.
[Resist Windows XP''s Invasive Production Activation Technology!]
Heh, maybe I should have specified, MICROSOFT Visual C++, does have built in functions for loading bitmaps, Dialog boxes and Applications can have code for displaying the bitmaps, but as you said, it ain''t possible to load and display a bitmap like DirectX can without using some API. (I''ll betcha that I''m wrong again, )
En taro Adun!
Doom to all who threaten the homeworld!
*Protoss Zealot - Starcraft*
En taro Adun!
Doom to all who threaten the homeworld!
*Protoss Zealot - Starcraft*
----------------------------------------------------------You know, I might as well go ahead and say I can't fix the problem... because that's when I figure out how.
Now I remember, in one book I had, it used MFC, which does support drawing shapes and displaying bitmaps, but just plain ole C or C++ do not support this. Sorry.
En taro Adun!
Doom to all who threaten the homeworld!
*Protoss Zealot - Starcraft*
En taro Adun!
Doom to all who threaten the homeworld!
*Protoss Zealot - Starcraft*
----------------------------------------------------------You know, I might as well go ahead and say I can't fix the problem... because that's when I figure out how.
quote: Original post by Zealot
I''ll betcha that I''m wrong again,
As you point out, you are technically wrong (), but you''re realistically correct. Using VESA you can get software graphics. But, for hardware accelerated graphics, it''s just too much work to write rendering code for each video card in existance .
[Resist Windows XP''s Invasive Production Activation Technology!]
yea MFC classes support graphics though I will not recommend using MFC if u dont understand the Win32API before ...
MFC can be less pain but if u dont understand what u are doing its pointless.
So for graphics I would recommend Win32API u must have the reference for it with MsVC++ or just grab it at MSDN.
Using DirectX or OpenGL should come after u are really familiar with Win32API or its like studying philosophy when u cant wright a correct sentence...
DirectX and OpenGL become really usefull when ure doing advanced graphics rendering...
I am not a GURU still learning Win32API those are just some advice I grab browsing the internet.
MFC can be less pain but if u dont understand what u are doing its pointless.
So for graphics I would recommend Win32API u must have the reference for it with MsVC++ or just grab it at MSDN.
Using DirectX or OpenGL should come after u are really familiar with Win32API or its like studying philosophy when u cant wright a correct sentence...
DirectX and OpenGL become really usefull when ure doing advanced graphics rendering...
I am not a GURU still learning Win32API those are just some advice I grab browsing the internet.
Okay I have a different point of view than many people I''ve met but the way I learned graphics programming does have some benefits.
So first, I suggest you forget DirectX and OpenGL, at least for a couple of months. If you haven''t done any graphics programming before, it might be useful to learn how graphics data is organised. And in learning this, DOS will be of help for you. Try to find some tutorials on the net explaining the VGA mode 13h. It is the most basic one, but is also great for learning. One may say that it''s stupid to write any programs for this mode, since there are many others with higher resolutions and more colours (13h is 320x200 with 256 colors). Of course, but if you can''t deal with 256 colors, you won''t be able to work with 65536 either.
If you take my advice seriously, I also suggest you to download the Watcom compiler (it''s free at www.openwatcom.org) and then find any Hornet mirror (I only know Polish one - ftp://sunsite.icm.edu.pl/pub/demos). In its ''Code'' section you will find many simple and more advanced graphics effects. And many of them are only compileable by Watcom.
I know many people may find my suggestions old-fashioned, but this is the way I learned programming and I think I can quite easily develop now. Now I program mainly with OpenGL, but still like to watch my old 13h or VESA programs.
Greets,
Hazel
So first, I suggest you forget DirectX and OpenGL, at least for a couple of months. If you haven''t done any graphics programming before, it might be useful to learn how graphics data is organised. And in learning this, DOS will be of help for you. Try to find some tutorials on the net explaining the VGA mode 13h. It is the most basic one, but is also great for learning. One may say that it''s stupid to write any programs for this mode, since there are many others with higher resolutions and more colours (13h is 320x200 with 256 colors). Of course, but if you can''t deal with 256 colors, you won''t be able to work with 65536 either.
If you take my advice seriously, I also suggest you to download the Watcom compiler (it''s free at www.openwatcom.org) and then find any Hornet mirror (I only know Polish one - ftp://sunsite.icm.edu.pl/pub/demos). In its ''Code'' section you will find many simple and more advanced graphics effects. And many of them are only compileable by Watcom.
I know many people may find my suggestions old-fashioned, but this is the way I learned programming and I think I can quite easily develop now. Now I program mainly with OpenGL, but still like to watch my old 13h or VESA programs.
Greets,
Hazel
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement