November 2nd, 2010, 06:05 PM
[Dev-C++, OpenGL, Windows (7,xp,vista)] General Questions
I am trying to learn game programmin in c++ and simple graphics. (My future goal is to make games that will work on as many computers as possible, including mac and other OS's.)
Using Dev-C++, I am trying to set up OpenGL, but with no luck. The MANY tutorials I find on the net say similar things and I did manage to get it to work, but with the following questions:
Where could I learn about the build process/linking libraries and what do commands like -lopengl32 -lglu32 mean under Project > Project Options > Parameters.
I hate to use them and not understand them.
Also, the first example I have seen to literally just make a simple window was 400 lines long, does game programming in c++ really require that much code?
I know basic C++, but not how to use graphic API's/libraries; they require a lot of setting up in the IDE which I am not experienced in whatsoever.
Any help is appreciated.
November 3rd, 2010, 01:12 AM
I found a lovely website http://www.lazyfoo.net/ , that has solved my problems.
November 4th, 2010, 10:32 PM
This will create a window if this is what you're looking for...
LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
windowClass.cbSize = sizeof(WNDCLASSEX);
windowClass.style = CS_HREDRAW | CS_VREDRAW;
windowClass.lpfnWndProc = WindowProc;
windowClass.hInstance = hInstance;
windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
windowClass.hbrBackground = (HBRUSH)COLOR_WINDOW;
windowClass.lpszClassName = "WindowClassName";
HWND windowHandle = CreateWindowEx(NULL, "WindowClassName", "Win32 Window",
WS_OVERLAPPEDWINDOW, 0, 0, 300, 300, NULL, NULL, hInstance, NULL);
while(GetMessage(&msg, NULL, 0, 0))
LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
return DefWindowProc(hWnd, message, wParam, lParam);
All of this is for both OpenGL and Direct3D programming.
If you wish to learn more about Visual C++ or OpenGL I would purchase Ivor Horton's Beginning C++ or have a look at it.
November 5th, 2010, 12:12 AM
thanks man! I'll have a look at that.
November 5th, 2010, 05:38 AM
Of course, the example is Windows only!
If you want to write platform independent GUI C/C++ code, look into wxWidgets, FLTK and a few others. Also, you need to realize that OpenGL works best when the video card supports it in hardware and you cannot guarantee that will always be the case, so be sure to check that your program can function in the absence of hardware accelerated OpenGL.