Sign in to follow this  
cutovoi

Quads doesn't appear

Recommended Posts

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:
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;
}

My window remains black, what's going on? May I have forgot a matrix?

Share this post


Link to post
Share on other sites
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 :


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();


Share this post


Link to post
Share on other sites
I didn't insert the glOrthoMatrix. How can I put them?? I'm working in a 3D environment.
And I put this glOrthoMatrix and nothing occurs:
glOrtho(tempRect.left,tempRect.right, tempRect.right, tempRect.top, 0.1, 100);

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this