• <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 楊粼波 閱讀(857) 評論(1)  編輯 收藏 引用

            評論

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

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

            精品久久久久久无码国产| 浪潮AV色综合久久天堂| 久久天天躁狠狠躁夜夜躁2O2O| 久久亚洲欧洲国产综合| 国内精品久久久久久不卡影院 | 久久精品国产清自在天天线| 国产免费久久久久久无码| 狠狠精品久久久无码中文字幕 | 日本欧美久久久久免费播放网| 一本一道久久综合狠狠老| 欧美黑人激情性久久| 蜜臀久久99精品久久久久久小说| 亚洲色大成网站www久久九| 久久久久成人精品无码中文字幕 | 中文字幕乱码久久午夜| 久久天天躁狠狠躁夜夜96流白浆| 久久无码人妻一区二区三区| 99久久99久久| 久久精品国产精品亚洲人人| 亚洲AV伊人久久青青草原| 久久大香萑太香蕉av| 久久99精品久久久久久久久久| 精品一区二区久久| 日日狠狠久久偷偷色综合0| 久久精品人人做人人爽电影| A狠狠久久蜜臀婷色中文网| 国产精品熟女福利久久AV| 久久成人小视频| 91久久福利国产成人精品| 2019久久久高清456| 一本大道久久a久久精品综合| 热久久国产欧美一区二区精品| 亚洲午夜久久久影院| 国产69精品久久久久99| 久久无码国产专区精品| 国产福利电影一区二区三区久久老子无码午夜伦不| 久久综合狠狠综合久久激情 | 国产毛片欧美毛片久久久| 久久93精品国产91久久综合 | 2021精品国产综合久久| 久久久久久无码国产精品中文字幕|