• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            牽著老婆滿街逛

            嚴以律己,寬以待人. 三思而后行.
            GMail/GTalk: yanglinbo#google.com;
            MSN/Email: tx7do#yahoo.com.cn;
            QQ: 3 0 3 3 9 6 9 2 0 .

            使用vc6開發opengl工程

            From:http://blog.chinaunix.net/u/15586/showart_206394.html

            //使用vc6開發opengl工程[原創]
            //首先要在工程設置連接中加入opengl32.lib
            //微軟在Visual C++中已提供了三個OpenGL的函數庫(glu32.lib, glau.lib,OpenGL32.lib)
            //注意要加入頭文件#i nclude <gl/gl.h>
            //因為gl.h文件在vc的include 下面的gl目錄下面
            //下面是一個基于win32的例子
            /**************************
             * Includes
             *
             *************************
            */


            #i nclude 
            <windows.h>
            #i nclude 
            <gl/gl.h>


            /**************************
             * Function Declarations
             *
             *************************
            */


            LRESULT CALLBACK WndProc (HWND hWnd, UINT message,
            WPARAM wParam, LPARAM lParam);
            void EnableOpenGL (HWND hWnd, HDC *hDC, HGLRC *hRC);
            void DisableOpenGL (HWND hWnd, HDC hDC, HGLRC hRC);


            /**************************
             * WinMain
             *
             *************************
            */


            int WINAPI WinMain (HINSTANCE hInstance,
                                HINSTANCE hPrevInstance,
                                LPSTR lpCmdLine,
                                
            int iCmdShow)
            {
                WNDCLASS wc;
                HWND hWnd;
                HDC hDC;
                HGLRC hRC;        
                MSG msg;
                BOOL bQuit 
            = FALSE;
                
            float theta = 0.0f;

                
            /* register window class */
                wc.style 
            = CS_OWNDC;
                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 
            = (HBRUSH) GetStockObject (BLACK_BRUSH);
                wc.lpszMenuName 
            = NULL;
                wc.lpszClassName 
            = "GLSample";
                RegisterClass (
            &wc);

                
            /* create main window */
                hWnd 
            = CreateWindow (
                  
            "GLSample""OpenGL Sample"
                  WS_CAPTION 
            | WS_POPUPWINDOW | WS_VISIBLE,
                  
            00256256,
                  NULL, NULL, hInstance, NULL);

                
            /* enable OpenGL for the window */
                EnableOpenGL (hWnd, 
            &hDC, &hRC);

                
            /* program main loop */
                
            while (!bQuit)
                
            {
                    
            /* check for messages */
                    
            if (PeekMessage (&msg, NULL, 00, PM_REMOVE))
                    
            {
                        
            /* handle or dispatch messages */
                        
            if (msg.message == WM_QUIT)
                        
            {
                            bQuit 
            = TRUE;
                        }

                        
            else
                        
            {
                            TranslateMessage (
            &msg);
                            DispatchMessage (
            &msg);
                        }

                    }

                    
            else
                    
            {
                        
            /* OpenGL animation code goes here */

                        glClearColor (
            0.0f0.0f0.0f0.0f);
                        glClear (GL_COLOR_BUFFER_BIT);

                        glPushMatrix ();
                        glRotatef (theta, 
            0.0f0.0f1.0f);
                        glBegin (GL_TRIANGLES);
                        glColor3f (
            1.0f0.0f0.0f);   glVertex2f (0.0f1.0f);
                        glColor3f (
            0.0f1.0f0.0f);   glVertex2f (0.87f-0.5f);
                        glColor3f (
            0.0f0.0f1.0f);   glVertex2f (-0.87f-0.5f);
                        glEnd ();
                        glPopMatrix ();

                        SwapBuffers (hDC);

                        theta 
            += 1.0f;
                        Sleep (
            1);
                    }

                }


                
            /* shutdown OpenGL */
                DisableOpenGL (hWnd, hDC, hRC);

                
            /* destroy the window explicitly */
                DestroyWindow (hWnd);

                
            return msg.wParam;
            }



            /********************
             * Window Procedure
             *
             *******************
            */


            LRESULT CALLBACK WndProc (HWND hWnd, UINT message,
                                      WPARAM wParam, LPARAM lParam)
            {

                
            switch (message)
                
            {
                
            case WM_CREATE:
                    
            return 0;
                
            case WM_CLOSE:
                    PostQuitMessage (
            0);
                    
            return 0;

                
            case WM_DESTROY:
                    
            return 0;

                
            case WM_KEYDOWN:
                    
            switch (wParam)
                    
            {
                    
            case VK_ESCAPE:
                        PostQuitMessage(
            0);
                        
            return 0;
                    }

                    
            return 0;

                
            default:
                    
            return DefWindowProc (hWnd, message, wParam, lParam);
                }

            }



            /*******************
             * Enable OpenGL
             *
             ******************
            */


            void EnableOpenGL (HWND hWnd, HDC *hDC, HGLRC *hRC)
            {
                PIXELFORMATDESCRIPTOR pfd;
                
            int iFormat;

                
            /* get the device context (DC) */
                
            *hDC = GetDC (hWnd);

                
            /* set the pixel format for the DC */
                ZeroMemory (
            &pfd, sizeof (pfd));
                pfd.nSize 
            = sizeof (pfd);
                pfd.nVersion 
            = 1;
                pfd.dwFlags 
            = PFD_DRAW_TO_WINDOW | 
                  PFD_SUPPORT_OPENGL 
            | PFD_DOUBLEBUFFER;
                pfd.iPixelType 
            = PFD_TYPE_RGBA;
                pfd.cColorBits 
            = 24;
                pfd.cDepthBits 
            = 16;
                pfd.iLayerType 
            = PFD_MAIN_PLANE;
                iFormat 
            = ChoosePixelFormat (*hDC, &pfd);
                SetPixelFormat (
            *hDC, iFormat, &pfd);

                
            /* create and enable the render context (RC) */
                
            *hRC = wglCreateContext( *hDC );
                wglMakeCurrent( 
            *hDC, *hRC );

            }



            /******************
             * Disable OpenGL
             *
             *****************
            */


            void DisableOpenGL (HWND hWnd, HDC hDC, HGLRC hRC)
            {
                wglMakeCurrent (NULL, NULL);
                wglDeleteContext (hRC);
                ReleaseDC (hWnd, hDC);
            }

            posted on 2007-04-07 21:44 楊粼波 閱讀(854) 評論(1)  編輯 收藏 引用

            評論

            # re: 使用vc6開發opengl工程 2008-02-15 16:37 newcomer

            可以加QQ么 我正在做IPMSG可是 以前沒做過 想請教 我的QQ 335298238  回復  更多評論   

            久久久久久久91精品免费观看| 久久99国产综合精品女同| 久久ZYZ资源站无码中文动漫 | 久久精品国产亚洲αv忘忧草| 久久精品国产99国产精品| 久久免费线看线看| 精品一久久香蕉国产线看播放| 26uuu久久五月天| 久久久久无码专区亚洲av| 久久久久久国产精品无码下载| 久久国产V一级毛多内射| 久久精品国产亚洲5555| 亚洲午夜精品久久久久久浪潮| 欧美色综合久久久久久| 欧美精品国产综合久久| 久久精品亚洲AV久久久无码| 久久亚洲精品成人av无码网站| 国内精品久久久久久99蜜桃| 亚洲国产精品久久久久| 久久久无码精品午夜| 久久精品国产乱子伦| 精品久久久久久久| 久久精品亚洲欧美日韩久久| 一级做a爰片久久毛片毛片| 久久精品国产亚洲AV香蕉| 婷婷久久综合九色综合98| 亚洲美日韩Av中文字幕无码久久久妻妇 | 国产∨亚洲V天堂无码久久久 | 久久综合狠狠综合久久97色| 久久久久亚洲AV成人网人人网站 | 狠狠人妻久久久久久综合蜜桃| 欧美性大战久久久久久| 久久夜色精品国产噜噜亚洲AV| 品成人欧美大片久久国产欧美... 品成人欧美大片久久国产欧美 | 亚洲精品乱码久久久久久中文字幕 | 色偷偷久久一区二区三区| 精品久久久久久国产免费了| 亚洲精品无码久久千人斩| 久久精品一区二区三区中文字幕| 麻豆亚洲AV永久无码精品久久| 国产高清美女一级a毛片久久w|