WinMain Background color?

Hi, for some reason the background color of my window is always black! I've been googling around and still can't find a solution. Heres the code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
int WINAPI WinMain(	HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,int nCmdShow )
{
	WNDCLASSEX Flag;
	MSG userTemp;
	memset(&userTemp,0,sizeof(userTemp));
	Flag.lpszClassName = "The Flag Class";
	Flag.cbSize        = sizeof(WNDCLASSEX);
	Flag.lpfnWndProc   = WindowProc;
	Flag.hCursor       = LoadCursor(NULL, IDC_ARROW);
	Flag.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
	Flag.lpszMenuName  = NULL;
	Flag.cbClsExtra    = 0;
	Flag.cbWndExtra    = 0;
	
	if( !RegisterClassEx(&Flag) )
	{
		return E_FAIL;
	}
	hwnd = CreateWindowEx( NULL,"The Flag Class","07047878 Flag Simulation",WS_OVERLAPPEDWINDOW,0,0, 640,480, NULL, NULL, hinstance, NULL );
	ShowWindow(hwnd, nCmdShow);
	UpdateWindow(hwnd);
	start();
	shader();
	while(userTemp.message != WM_QUIT)
	{
		if( PeekMessage(&userTemp, NULL, 0, 0, PM_REMOVE) )
		{ 
			TranslateMessage( &userTemp );
			DispatchMessage( &userTemp );
		}
		else
		{
			timeCurrent = timeGetTime();
			timeElapsed = (float)((timeCurrent - timeLast) * 0.001);
			timeLast = timeCurrent;
			renderFlag();
		}
	}
}


And heres the renderFlag function:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
void renderFlag(void)
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glTranslatef(-4.0, -2.5, -10.0);
	glRotatef(ySpin + 90.0, 1.0, 0.0, 0.0);
	glRotatef(xSpin, 0.0, 1.0, 0.0);
	glTranslatef(0.0,0.0,-6.0);
	renderFlagPole();
	glUseProgramObjectARB(g_programObj);
	setShaderConstants();
	if(wireFrameMode)
	{
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
	}
	else
	{
		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	}
	glCallList(meshDisplayList);
	glUseProgramObjectARB(NULL);
	SwapBuffers(hdc);
}

Well is your "glClearColor(...)" set as black? Win32 will provide you with the rendering context, that's the window. Pretty much everything after that is OpenGL.

See Here: http://www.opengl.org/sdk/docs/man/xhtml/glClearColor.xml
This worked perfectly. Thank's a lot!
Topic archived. No new replies allowed.