VirtualBox

Changeset 3352 in vbox for trunk


Ignore:
Timestamp:
Jul 2, 2007 2:29:57 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
22545
Message:

Link with opengl.lib

Location:
trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/test/Makefile.kmk

    r3339 r3352  
    3333tstShOpenGL_DEFS     = VBOX_HGCM
    3434tstShOpenGL_SOURCES  = tstShOpenGL.cpp
    35 tstShOpenGL_LIBS     = $(PATH_LIB)/VBoxOGL.lib
     35tstShOpenGL_LIBS     = $(PATH_SDK_W2K3DDKX86_LIB)/opengl32.lib
    3636
    3737
     
    3939tstOGLSample_DEFS     =
    4040tstOGLSample_SOURCES  = tstOGLSample.cpp
    41 tstOGLSample_LIBS     = $(PATH_LIB)/VBoxOGL.lib
     41tstOGLSample_LIBS     = $(PATH_SDK_W2K3DDKX86_LIB)/opengl32.lib
    4242
    43 tstOGLSample_LIBS.win = \
    44                        $(PATH_LIB)/VBoxOGL.lib
    4543###        $(PATH_SDK_W2K3DDKX86_LIB)/opengl32.lib
    4644
  • trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/test/tstShOpenGL.cpp

    r3339 r3352  
    2222#include <stdio.h>
    2323
     24
     25
     26
     27// Enable OpenGL
     28
     29void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC)
     30{
     31        PIXELFORMATDESCRIPTOR pfd;
     32        int format;
     33       
     34        // get the device context (DC)
     35        *hDC = GetDC( hWnd );
     36       
     37        // set the pixel format for the DC
     38        ZeroMemory( &pfd, sizeof( pfd ) );
     39        pfd.nSize = sizeof( pfd );
     40        pfd.nVersion = 1;
     41        pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
     42        pfd.iPixelType = PFD_TYPE_RGBA;
     43        pfd.cColorBits = 24;
     44        pfd.cDepthBits = 16;
     45        pfd.iLayerType = PFD_MAIN_PLANE;
     46        format = ChoosePixelFormat( *hDC, &pfd );
     47        SetPixelFormat( *hDC, format, &pfd );
     48       
     49        // create and enable the render context (RC)
     50        *hRC = wglCreateContext( *hDC );
     51        wglMakeCurrent( *hDC, *hRC );
     52       
     53}
     54
     55// Disable OpenGL
     56
     57void DisableOpenGL(HWND hWnd, HDC hDC, HGLRC hRC)
     58{
     59        wglMakeCurrent( NULL, NULL );
     60        wglDeleteContext( hRC );
     61        ReleaseDC( hWnd, hDC );
     62}
     63
    2464int main(int argc, char **argv)
    2565{
     66    HDC hdc;
     67    HGLRC hglrc;
     68
     69    EnableOpenGL(0, &hdc, &hglrc);
     70
    2671    printf("GL_VENDOR       %s\n", glGetString(GL_VENDOR));
    2772    printf("GL_RENDERER     %s\n", glGetString(GL_RENDERER));
     
    2974    printf("GL_EXTENSIONS   %s\n", glGetString(GL_EXTENSIONS));
    3075
    31     glEnable(GL_BLEND);
    32     glFlush();
     76    DisableOpenGL(0, hdc, hglrc);
    3377    return 0;
    3478}
    35 
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette