C++/OpenGL

I do not know much about C++ yet…But i don’t really know some lines of code that appear in the beginning of the tutorials in nehe.gamedev.net

//////////////////////////////////
HWND g_hWnd;
// This is the handle for the window
RECT g_rRect;
// This holds the window dimensions
HDC g_hDC;
// General HDC - (handle to device context)
HGLRC g_hRC;
// General OpenGL_DC - Our Rendering Context for OpenGL
HINSTANCE g_hInstance;
// This holds the global hInstance for UnregisterClass() in DeInit()
////////////////////////////////////////////
What the hell is the H***'s and RECT types? and which library contains them?

Thanks!

Hi.

They are included in Win32 API.

You need to create Win32 project, if you use

VC++.

Try including windows.h after you created a Win32 Project.

As a matter of fact, i dont use the windows.h. Why is that lib so used, when it is not necessary. Or am i wrong?

Originally posted by KeSh:
Why is that lib so used, when it is not necessary. Or am i wrong?
The Win32 API is THE method to create and manage windows (at least under Windows, under Linux it is X11, …). So when you want to do anything other than text mode it is absolutely neccesary to use it, either directly or indirectly.

If you don’t want to use it directly, you have to use some wrapper library like SDL, MFC or simply glut, which in turn makes calls to the Windows API for you.