Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: X-Originating-Email: [julianmoors AT hotmail DOT com] X-Sender: julianmoors AT hotmail DOT com From: "Julian Moors" To: Subject: RE: Experiencing problems with OpenGL Date: Mon, 9 May 2005 18:58:17 +0100 Message-ID: <000001c554c0$addc5800$210110ac@home35514da431> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-OriginalArrivalTime: 09 May 2005 17:58:20.0265 (UTC) FILETIME=[AF5F7590:01C554C0] X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id j49I1jeI024385 Hi everybody,   First and foremost I have to say that I am so happy with the concept of Cygwin and to the Cygwin volunteers “Keep up with the good work. It is so much appreciated”. I am having a little problem with compiling an OpenGL sourcefile.   Here's what I've done so far:   Installed Cygwin using setup.exe to c:\cygwin using default settings onto Windows XP SP 2 OS. Installed make, g++ and nano by running setup.exe again. Read the readme file located under /usr/share/opengl1-1-0. Little confused about what switches I should use when compiling .cpp file and whether to use a makefile or not. Ran the OpenGL examples to test if it’s possible to run the .exe files compiled and linked under Cygwin. All examples ran successfully. Tried to compile the following .cpp file whilst using -lglu32 -lopengl32 switches with g++: #define WIN32_LEAN_AND_MEAN #include #include #include HDC g_hDC; bool g_keys[256]; void SetupPixelFormat(HDC hDC) { int nPixelFormat; static PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, 32, 0,0,0,0,0,0, 0, 0, 0, 0,0,0,0, 16, 0, 0, PFD_MAIN_PLANE, 0, 0,0,0 }; nPixelFormat = ChoosePixelFormat(hDC,&pfd); SetPixelFormat(hDC,nPixelFormat,&pfd); } LRESULT CALLBACK WndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) { static HDC hDC; static HGLRC hRC; int width,height; switch (msg) { case WM_CREATE: { hDC = GetDC(hWnd); g_hDC = hDC; SetupPixelFormat(hDC); hRC = wglCreateContext(hDC); wglMakeCurrent(hDC,hRC); return 0; break; } case WM_SIZE: { width = LOWORD(lParam); height = HIWORD(lParam); glViewport(0,0,width,height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f,(GLfloat)width / (GLfloat)height,1.0f,1000.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); return 0; break; } case WM_CLOSE: { wglMakeCurrent(hDC,NULL); wglDeleteContext(hRC); PostQuitMessage(0); return 0; break; } case WM_SYSCOMMAND: { switch (wParam) { case SC_SCREENSAVE: { return 0; break; } case SC_MONITORPOWER: { return 0; break; } default: { break; } } break; } case WM_KEYDOWN: { g_keys[wParam] = TRUE; return 0; break; } case WM_KEYUP: { g_keys[wParam] = FALSE; return 0; break; } default: { break; } } return (DefWindowProc(hWnd,msg,wParam,lParam)); } int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd) { RECT wr; WNDCLASSEX wc; HWND hWnd; bool done; MSG msg; int width = 1280; int height = 800; int bits = 32; wr.left = (long)0; wr.right = (long)width; wr.top = (long)0; wr.bottom = (long)height; wc.cbSize = sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL,IDI_APPLICATION); wc.hCursor = LoadCursor(NULL,IDC_ARROW); wc.hbrBackground = NULL; wc.lpszMenuName = NULL; wc.lpszClassName = "OpenGLWindowClass"; wc.hIconSm = LoadIcon(NULL,IDI_APPLICATION); if (! RegisterClassEx(&wc)) { return 0; } DEVMODE dmScreenSettings; memset(&dmScreenSettings,0,sizeof(dmScreenSettings)); dmScreenSettings.dmSize = sizeof(dmScreenSettings); dmScreenSettings.dmPelsWidth = width; dmScreenSettings.dmPelsHeight = height; dmScreenSettings.dmBitsPerPel = bits; dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) { MessageBox(NULL,"Your current graphics card does not support the selected screen resolution. The application will now close.","APPLICATION ERROR",MB_OK | MB_ICONEXCLAMATION); } ShowCursor(FALSE); hWnd = CreateWindowEx(NULL, "OpenGLWindowClass", "OpenGL 1.2", WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0,0, wr.right - wr.left, wr.bottom - wr.top, NULL, NULL, hInstance, NULL); if (! hWnd) { return 0; } ShowWindow(hWnd,SW_SHOW); UpdateWindow(hWnd); done = false; while (! done) { PeekMessage(&msg,hWnd,NULL,NULL,PM_REMOVE); if (msg.message == WM_QUIT || g_keys[VK_ESCAPE]) { done = true; } else { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); /* game programming code goes here */ SwapBuffers(g_hDC); TranslateMessage(&msg); DispatchMessage(&msg); } } ChangeDisplaySettings(NULL,0); ShowCursor(TRUE); return msg.wParam; } This .cpp source file compiles perfectly under Visual Studio 6.0, but as I don’t have it anymore I’m unable to compile it now. Is there anyway I can compile this source under Cygwin or will I have to rewrite it and make use of the GLUI and GLUX libraries. If so could you explain this process for me with compile/linker command line switches. Thanks for your help. Julian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/