Most of the sample code from Microsoft's DirectX SDK includes variables which use the g_
prefix for Windows API variables, as well as DirectX pipeline variables, such as the swapchain.
Here are some samples:
D3D10_DRIVER_TYPE g_driverType;
ID3D10Device* g_pd3dDevice;
IDXGISwapChain* g_pSwapChain;
ID3D10RenderTargetView* g_pRenderTargetView;
ID3D10Effect* g_pEffect;
ID3D10EffectTechnique* g_pTechnique;
ID3D10InputLayout* g_pVertexLayout;
ID3D10Buffer* g_pVertexBuffer;
ID3D10Buffer* g_pIndexBuffer;
ID3D10EffectMatrixVariable* g_pWorldVariable;
ID3D10EffectMatrixVariable* g_pViewVariable;
ID3D10EffectMatrixVariable* g_pProjectionVariable;
D3DXMATRIX g_World;
D3DXMATRIX g_View;
D3DXMATRIX g_Projection;
What is the reasoning behind this? I'm not getting what the g_
signifies, and why you wouldn't use more convenient names like "SwapChain." Can anyone explain?