int __stdcall WinMain(HINSTANCE hCurrentInstance, HINSTANCE hPrevInstance, LPSTR lp, int iShow)
{
....window creation
if(hwnd != NULL)
{
EnableGL(hwnd, &hdc, &hrc);
InitializeGL();
ShowWindow(hwnd, SW_SHOW);
GetClientRect(hwnd, &tempRect);
SetFieldOfView(tempRect.right,tempRect.bottom);
}
while(GetMessage(&msg, NULL, 0, 0))
{
if(msg.message == WM_QUIT)
{
break;
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
GetClientRect(hwnd, &tempRect);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
SetFieldOfView(tempRect.right,tempRect.bottom);
glColor3f(0.0, 0.0, 1.0);
glBegin(GL_QUADS);
glVertex2f(100,100);
glVertex2f(200,100);
glVertex2f(200,200);
glVertex2f(100,200);
glEnd();
SwapBuffers(hdc);
}
return msg.wParam;
}
Quads doesn't appear
Hi fellows
I want to put a very single 2D square in my app but I don't have sucess in this.
Here is my code:
My window remains black, what's going on? May I have forgot a matrix?
If you set up openGL correctly, then I think the problem might be your camera is inside the quad, so you can't see it.
Hi
check if :
- face culling is enabled
- your glOrtho() values (from -1.0f to 1.0f or some different value ?)
try something like that first :
check if :
- face culling is enabled
- your glOrtho() values (from -1.0f to 1.0f or some different value ?)
try something like that first :
glDisable(GL_CULL_FACE); glBegin(GL_QUADS); glVertex2f(0.0f, 0.0f); glVertex2f(1.0f, 0.0f); glVertex2f(1.0f, 1.0f); glVertex2f(0.0f, 1.0f); glEnd();
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement