Jump to content
  • Advertisement
Sign in to follow this  
cutovoi

Quads doesn't appear

This topic is 4285 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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.

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!