I'm an intermediate C++ programmer, and know very little about programming in Windows. I want to learn OpenGL; what's a really good book that would suit me? Thanks
Printable View
I'm an intermediate C++ programmer, and know very little about programming in Windows. I want to learn OpenGL; what's a really good book that would suit me? Thanks
OpenGL Game Programming
Look up the OpenGL Red and Blue books
>OpenGL Game Programming
seconded
>Look up the OpenGL Red and Blue books
I think that both are better as references more than something to start with, and they are available online anyway...
Okay, I think I'll go with OpenGL game programming, and I'm also purchasing "Tricks of the Trade of Windows Game Programming" by andres somethingorother. I'm going to learn a little 2D directX; that way I'll be more versitile. But learning openGL is more of a priority for me: I would like to code multiplatform; and stay away from microsoft specific!
OpenGL is easier to learn too.
*about to learn directX*
*pauses*
What? It is? :(
yes OpenGL is easier to learn than DirectX, in my opinion. Rest assured, that'll be your opinion too :)
if you like functions with 10 params, each is a struct with 20 members, and everything's name starts with 8 caps, then DirectX is for you :D
well, I love Opengl as much as everyone here, but there are some reasons to use DirectX:Quote:
if you like functions with 10 params, each is a struct with 20 members, and everything's name starts with 8 caps, then DirectX is for you
1) most commonly used graphics API in the prof. gaming market(I am speaking commercial titles, not indy-prof.)
2) Has full support by Windows, which is on ~92% of PCs
3) has most of the new features(shaders/etc.) built-in, instead of using encumbersome extensions.
Some reasons NOT to use DirectX:
1) doesn't run on those other ~8% of PCs, while OGL does
2) as mentioned in quote above, crappy naming scheme, overloaded(no, not the good kind) structs.
3) doesnt have a wide programmer base(while most commercial companies use DX, most hobbyists/programmers use OGL and you are more likely to get help if you have questions).
4) its M$(just had to include this :P).
now, back on topic..........
third this^^.Quote:
OpenGL Game Programming
1) Isn't really a reason to use DirectX, I don't care what other programmers are using as long as the API I use does what I want it to do.
2) OpenGL does so too, it also runs on the remaining 8% you spoke of.
3) I think that using OpenGL extensions are much better than downloading the latest framework every time a new feature is out.
In OpenGL, the only latest driver and extensions header file are required to use new features.
4) OpenGL has a better community than DirectX.
Wow, thanks a lot for all the replies! I'm going to get "OpenGL Game Programming" instead of "Tricks on the trade of Windows Programming". Those were just the answers I was looking for!
"tricks of the windows game programming gurus" is a good book, as is "tricks of the 3d game programming gurus". neither focus on openGL though.
i personally use directx more than ogl, simply because its what ive gotten used to using. make a few wrapper classes and you dont have to worry about all the messes microsoft has created for your convenience.
What is a wrapper? i'm still not sureQuote:
Originally posted by ...
make a few wrapper classes and you dont have to worry about all the messes microsoft has created for your convenience.
well, it is a programmer thing, and it's hard to explain if you don't already know what it is. but basically it just means that he made his own functions that do the directx stuff for him, and so he doesn't always have to remember the cumbersome details of directx stuff.
and OpenGL doesn't seem to be fully supported by microsoft, because a lot of the extensions that are extensions on Windows are NOT extensions on other operating systems...the only reason they must be extensions on Windows is that they don't update their OpenGL accessors (the headers and libraries you need to be able to make OpenGL function calls).
In short, they're both really good, both fast, both have their ups and downs, but OpenGL is easier and you're more likely to get help on the internet from other peeps. Also, you can always go into DirectX later, so why not start with the easier one?
While we're on the topic, I am also looking for advice on a book. I'm after a book that teaches more the theory of games programming than any particular API. Stuff like tiling and representing data, collision detection, etc. In fact a book that avoided API specific code all togethor. Does such a book exist and would it be helpful?
So would this be a very simple example of a wrapper?
Code:int setColor(unsigned short color)
{
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hOut,color);
return 1;
}
in a way, yes...
this is my initialization function in my direct3d wrapper. i pass in the hWnd of my window, the size of it, and a bool for fullscreen. my wrapper then tells directx to do this:
Code:
BOOL CDisplay::Init( HWND hWnd, int iWidth, int iHeight, BOOL bFullScreen )
{
// create the main d3d obj
m_d3dObj = Direct3DCreate9( D3D_SDK_VERSION );
if ( !m_d3dObj )
{
MessageBox( NULL, "Failed to create d3d object", "error", MB_OK );
m_pEL->Log( "Failed to create d3d object" );
return false;
}
// setup device parameters
memset( &m_d3dPresent, 0, sizeof( m_d3dPresent ) );
m_d3dPresent.BackBufferWidth = iWidth;
m_d3dPresent.BackBufferHeight = iHeight;
// windowed = D3DFMT_UNKNOWN
// fullscreen = D3DFMT_R5G6B5
m_d3dPresent.BackBufferFormat = (bFullScreen ? D3DFMT_R5G6B5 : D3DFMT_UNKNOWN);
m_d3dPresent.BackBufferCount = 1;
m_d3dPresent.Windowed = !bFullScreen;
m_d3dPresent.hDeviceWindow = hWnd;
m_d3dPresent.SwapEffect = D3DSWAPEFFECT_DISCARD;
m_d3dPresent.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
HRESULT hr = 0;
hr = m_d3dObj->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&m_d3dPresent, &m_d3dDevice );
*m_pEL << DXGetErrorString9( hr ) << " - " << DXGetErrorDescription9( hr ) << "\n";
if ( FAILED( hr ) )
{
MessageBox( NULL, "Failed creating d3d device", "error", MB_OK );
m_pEL->Log( "Failed creating d3d device" );
m_d3dObj->Release();
m_d3dObj = NULL;
return false;
}
m_hWnd = hWnd;
return true;
}
Thanks a lot everyone! I got the OpenGL Game Programming book - and the Tricks of the Trade of Windows Game Programming Book (directX). OpenGL Game Programming is great - It's works great when using it with NeHe tutorials. I'm going to skim through TOTWGP just for a basic idea of directX.
Also - the OpenGL Game programming uses DirectInput and DirectSound. That's great, but if I want to port to mac/linux, is there something platform independant i can use? Any ideas?
ps: look at my win32/tcp/ip book thread. i don't want to double post, and i have some questions
http://www.amazon.com/exec/obidos/AS...633064-5829400Quote:
Originally posted by Kinasz
While we're on the topic, I am also looking for advice on a book. I'm after a book that teaches more the theory of games programming than any particular API. Stuff like tiling and representing data, collision detection, etc. In fact a book that avoided API specific code all togethor. Does such a book exist and would it be helpful?
That is supposed to be pretty good - 5 stars on gameDev.net
You can use FreeGLUT for input and FMOD for sound. OpenAL is good for 3D sound too.
FreeGLUT
freeglut.sourceforge.net
FMOD
www.fmod.org
OpenAL
www.openal.org
FreeGLUT is not only an input library though. It also does all the work of creating a window and handling messages for you.
FMOD is an awesome sound and music library. It is free to use, and it is platform-independent. You can even use it on the PS2, Gamecube, and XBox if you want (I think you have to buy a license to use it for consoles though. The computer versions are free though).
OpenAL is library that resembles OpenGL, but is for audio. It works really nicely, and is platform-independent. It works really well with 3D audio. I prefer FMOD though.