Using Vector Engines

Start with the project you created in Using the Camera.

Take the following steps to add support for viewing vector drawing in different vector engines:

1.

Click the ResourceView tab in the Project Workspace. Double click IDR_MENU1 and add the following menu structure:

&Engine
     &GDI with ID = IDM_ENGINE_GDI
     &OpenGL with ID = IDM_ENGINE_OPENGL
     &DirectX with ID = IDM_ENGINE_DIRECTX

2.

Click the FileView tab in Project Workspace again and go to Vecaut.c. Add these lines right after the return 0L; statement of case IDM_FILE_EXIT for WM_COMMAND:

case IDM_ENGINE_GDI:
   // re-attach vector using GDI engine.
   L_VecAttachToWindow ( hWnd, &Vector, VECTOR_ENGINE_GDI, VECTOR_ENGINE_DOUBLEBUFFER );
   L_VecSetPolygonMode ( &Vector, VECTOR_POLYGON_LINE );
   L_VecSetUseLights ( &Vector, FALSE );
   ResetView( hWnd, &Vector );
   break;

case IDM_ENGINE_OPENGL:
   // re-attach vector using OpenGL engine.
   L_VecAttachToWindow( hWnd, &Vector, VECTOR_ENGINE_OPENGL, VECTOR_ENGINE_DOUBLEBUFFER );
   L_VecSetPolygonMode( &Vector, VECTOR_POLYGON_FILL );
   L_VecSetUseLights( &Vector, TRUE );
   L_VecSetAmbientColor ( &Vector, RGB( 0x3F, 0x3F, 0x3F ) );
   ResetView( hWnd, &Vector );
   break;

case IDM_ENGINE_DIRECTX:
   // re-attach vector using DirectX engine.
   L_VecAttachToWindow ( hWnd, &Vector, VECTOR_ENGINE_DIRECTX, VECTOR_ENGINE_DOUBLEBUFFER );
   L_VecSetPolygonMode ( &Vector, VECTOR_POLYGON_FILL );
   L_VecSetUseLights ( &Vector, TRUE );
   L_VecSetAmbientColor( &Vector, RGB( 0x3F, 0x3F, 0x3F ) );
   ResetView( hWnd, &Vector );
   break;

3.

Compile and run the demo.

4.

Select File/Open… from the program menu. Browse to c:\lead\images\random.dxf and click OK.

5.

You should be able now to select different vector engines and see the effect of how the drawing is painted on the window.