My understanding,...is it right??

Started by
8 comments, last by pulpfist 16 years, 11 months ago
HI, I have neeing c++ programming for the last few months, and have been reading many c++ books, that only cover the console and not win32 apps, and i have just purchased 2 new books OPenGL game programming by Kevin HAwkins and Dave Hastle and Beginning OPenGL game programming by same authors I purchased these books in a hurry, and didn't realise that the 1st list was the 2nd edition of the latter !!! anyway, i have them now, and they were well discounted... so question one, which would you advise me to read first? From reading the beginning of each book they both take you straight in win32 apps, which will hold the opengl application. Now having not done any win32 programming, i dont really understand the code. Do you recommend before doing any Opengl programming that i first get a book on win32 programming if so, can you recommend anything? next this is my understanding of how things work, can anything clarrify. When game programming you have 2 different options Directx or OpengL when programming in directx, you dont use any other software to help you out, as directx has all the code you need (sound/2d/3d/ etc) where as OpenGl is purely code fro creating 2d/3d applications and does not contain any other code for music or sounds etc. When programming in openGl, you write your code in a win32 application, using the standard win32 code int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) etc,etc but you can also use wrapper code to make this easier, using such 3rd party code as sdl and glut. Now, should i learn to program or should i try and just right my code without any of the additional wrapper functions that sdl supplies? im using Visual studio 2005 thaks for reading
Advertisement
Quote:Original post by wforl
... a book on win32 programming if so, can you recommend anything?


Programming Windows, 5th Edition

Quote:Original post by wforl
Now, should i learn to program or should i try and just right my code without any of the additional wrapper functions that sdl supplies?


Yes, you should learn to program first. And then you should at least learn the basics of how windows gui programs work (see above link). After that, use glut, sdl, what have you.

"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
What do you mean "should I learn X"? There's no answer to that. Are you expecting someone to tell you,for instance, "no, you shouldn't learn Win32 or SDL"? You should learn as much as you can, but of course you have to make selections since you have only so much time. Win32,SDL and OpenGL are 3 different APIs used for various purposes. Whether or not you "should" learn something depends simply on what you want to do. And you haven't told us what your goal is, exactly.
Quote:
Do you recommend before doing any Opengl programming that i first get a book on win32 programming


Not really. If you are just going to use windows to get a rendering context, which is typically all they do in those types of books, then you don't need to know any more than what they write in there.

Also I recommend looking at SDL. It's a library that you can use to get an OpenGL rendering context without any win32 code. It also handles input and sound. Supposedly it's cross-platform too, so you could compile a Linux version, or whatever.
Quote:Original post by wforl
I purchased these books in a hurry, and didn't realise that the 1st list was the 2nd edition of the latter !!!

They aren't different editions of the same book. There are some differences in what they intend to teach you, but they are both intended for programmers at the same level so if you read one the other one will pretty much repeat the same stuff.

Quote:so question one, which would you advise me to read first?

I have only skimmed the second book, but my understanding is that OpenGL Game Programming primarily focus on OpenGL, while Beginning OpenGL Game Programming makes sure to relate it a little more to actual game programming. Whatever you start with is your choice. Try to look through the table of contents and skim chapter 3-8 or something like that and decide what you'd rather read about (the first couple of chapters are probably the same, Win32->setup->initialization).

Quote:From reading the beginning of each book they both take you straight in win32 apps, which will hold the opengl application. Now having not done any win32 programming, i dont really understand the code. Do you recommend before doing any Opengl programming that i first get a book on win32 programming if so, can you recommend anything?

They should both contain introductions to the very small subset of Win32 you will be using in the books so other resources aren't needed. Later on I would go learn more about Win32 though, but right now the books contain what you need.

Quote:When game programming you have 2 different options Directx or OpengL

There are more, but those are two possible options. Also on some platforms only one of them may be an option.

Quote:when programming in directx, you dont use any other software to help you out, as directx has all the code you need (sound/2d/3d/ etc)

Of course you do. That is what you're about to write. I guess what you mean is that DirectX contain interfaces to communicate with all kinds of hardwares which is mostly correct, but it do lack some stuff like networking and doesn't have proper support for some thing like 2D.

Quote:where as OpenGl is purely code fro creating 2d/3d applications and does not contain any other code for music or sounds etc.

No, but there are other libraries for this like OpenAL (open audio library) which is also usable with DirectX.

You need to remember that DirectX is a collection of different APIs where Direct3D is just the one which is used for graphics. You can choose to ignore all the other APIs in DirectX if you want to.

Quote:When programming in openGl, you write your code in a win32 application, using the standard win32 code

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)

etc,etc

but you can also use wrapper code to make this easier, using such 3rd party code
as sdl and glut.

Yes, but remember that what these wrappers do is just to provide their own WinMain function. Also the WinMain stuff is only for Windows and for complex applications there aren't any "standard code".

Quote:Now, should i learn to program or should i try and just right my code without any of the additional wrapper functions that sdl supplies?

im using Visual studio 2005

thaks for reading

If you wish to pretty much just read through the books I suggest using whatever the book uses. When you're done you can decide whether using a wrapper like SDL or GLUT is beneficial (it probably is).

EDIT:
Quote:I have neeing c++ programming for the last few months, and have been reading many c++ books,

Quote:Now, should i learn to program or should i try and just right my code without any of the additional wrapper functions that sdl supplies?

These doesn't really fit together. How can you have spend months reading and not learned to program? I assume you can program and you asked if you should learn to program a wrapper. If you can't program yet, then you should definitely do that before anything else. Remember that just reading through a book doesn't mean you can program, but if you can write a decent application yourself then you can program.
sorry, bad typing there..

what i meant was,

i have been reading and pritty much finished 2 books

c++ in 21 days

and

c++ a beginners guide

and feel quite comfortable with console programming, and have a fairly good undertanding of most of the topics in these books. And as my main target is a computer games programmer, i have now decided to move onto openGL, but from reading the first few chapters of these books, i notice that they are written in the win32 standard (is that the correct desription), ie, they use no other additional wrapper code such as Glut or SDL.

And i thought that maybe it would benifit me if maybe i purchased a win32 programming book, to explain such items as

1. call back functions - LRESULT CALLBACK MyWndProc(HWND MyHandle, UINT message, WPARAM wParam, LPARAM lParam)

2. PAINTSTRUCT paintStruct;

3. createing applications in windows with menus, buttons, etc

as to my understanding, glut and sdl, just simplify the use of creating windows, parenting and children etc.


to this point all i have done is made porgrams that operate in console mode such as simple games, maths opeartion programs, data storage (classes with inheritance) etc etc







Quote:Original post by wforl
And i thought that maybe it would benifit me if maybe i purchased a win32 programming book, to explain such items as

1. call back functions - LRESULT CALLBACK MyWndProc(HWND MyHandle, UINT message, WPARAM wParam, LPARAM lParam)

2. PAINTSTRUCT paintStruct;

3. createing applications in windows with menus, buttons, etc

as to my understanding, glut and sdl, just simplify the use of creating windows, parenting and children etc.


Those are the kinds of things covered in the book that I linked to above.

"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
thanks lessbeard,

I will most certainly purchase that book

1479 pages for £22, that sounds good to me ...

this forum moves very fast,

Quote:Original post by wforl
thanks lessbeard,

I will most certainly purchase that book

1479 pages for £22, that sounds good to me ...

this forum moves very fast,


It's a good reference book to have around if you plan to do any kind of windows programming. And because the book has been around for a while, you might be able to find a used copy for less money too. Later on should you use glut or sdl, it will provide you with an understanding of the kinds of things those libraries do for you (ie. creating windows, painting, etc.)
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
I think it is safe to say that you can do just fine with a win32 tutorial like
this

If you look through Nehe's OpenGL tutorials you will see that they use the same Win32 code for every tutorial. Its the same "Create a main window and set up a minimum message handler" stuff every time.

Quote:
i have been reading and pritty much finished 2 books
c++ in 21 days
and
c++ a beginners guide

You might find Thinking in C++ 2nd Edition by Bruce Eckel useful as a C++ reference as well, adding some flesh to the other two.

[Edited by - pulpfist on May 27, 2007 2:51:52 AM]

This topic is closed to new replies.

Advertisement