OpenGL Book

This is a discussion on OpenGL Book within the Game Programming forums, part of the General Programming Boards category; While we're on the topic, I am also looking for advice on a book. I'm after a book that teaches ...

  1. #16
    zsaniK Kinasz's Avatar
    Join Date
    Jan 2003
    Posts
    222
    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?
    "Assumptions are the mother of all **** ups!"

  2. #17
    Registered User
    Join Date
    Oct 2003
    Posts
    83
    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;
    }

  3. #18
    ...
    ... is offline
    Registered User
    Join Date
    Feb 2002
    Posts
    465
    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;
    }
    I came up with a cool phrase to put down here, but i forgot it...

  4. #19
    Registered User
    Join Date
    Oct 2003
    Posts
    83
    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

  5. #20
    Registered User
    Join Date
    Oct 2003
    Posts
    83
    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?
    http://www.amazon.com/exec/obidos/AS...633064-5829400

    That is supposed to be pretty good - 5 stars on gameDev.net

  6. #21
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    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.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. first opengl game, problems.
    By n3v in forum Game Programming
    Replies: 1
    Last Post: 07-11-2006, 08:22 PM
  2. Question about book
    By Kaidao in forum C++ Programming
    Replies: 6
    Last Post: 03-20-2006, 02:31 AM
  3. new book about game programming using DirectX
    By Carlos in forum Game Programming
    Replies: 0
    Last Post: 09-20-2005, 08:30 AM
  4. Memory leak - need help finding
    By ChadJohnson in forum C++ Programming
    Replies: 8
    Last Post: 04-06-2005, 07:26 PM
  5. I"m selling a book...
    By St0rmTroop3er in forum Game Programming
    Replies: 2
    Last Post: 12-13-2003, 12:55 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21