OPENGL Attributes Sample: Demonstrates Using OpenGL

The OPENGL attributes sample creates a control that draws a spinning cube using the OpenGL graphics library.

Security noteSecurity Note

This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.

To get samples and instructions for installing them:

To access samples from Visual Studio

  • On the Help menu, click Samples.

    By default, these samples are installed in drive:\Program Files\Microsoft Visual Studio 10.0\Samples\.

  • For the most recent version of this sample and a list of other samples, see Visual Studio Samples on the MSDN Web site.

Building and Running the Sample

To build and run this sample

  1. Open the solution file OpenGl.sln.

  2. From the Build menu, click Build Solution.

  3. After the sample builds, open OpenGl.htm in your Web browser.

You can test the control in the ActiveX Control Test Container. For details on accessing Test Container and using it to test a control, see Testing Properties and Events with Test Container.

Attributes

This sample uses the following attributes:

coclass, default, dll, dual, helpstring, id, implements_category, in, module, name, object, out, pointer_default, progid, propget, propput, registration_script, retval, uuid, vi_progid

Keywords

This sample uses the following keywords:

ATLASSERT; ATLTRACE; auxWireSphere; BEGIN_COM_MAP; BEGIN_CONNECTION_POINT_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; CComCoClass; CComControl; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObjectRoot; ChoosePixelFormat; CoTaskMemAlloc; CreateContext; CreateRGBPalette; DECLARE_GET_CONTROLLING_UNKNOWN; DECLARE_REGISTRY_RESOURCEID; DeleteObject; DescribePixelFormat; DisableThreadLibraryCalls; DrawText; END_CONNECTION_POINT_MAP; END_OBJECT_MAP; FireViewChange; GetClientRect; GetPixelFormat; glBegin; glClear; glClearColor; glClearDepth; glColor3f; glEnable; glEnd; glFinish; glLoadIdentity; glMatrixMode; glPopMatrix; glPushMatrix; glRotatef; glTranslatef; gluPerspective; glVertex3f; IDispatchImpl; IObjectSafetyImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl ; IOleObjectImpl; IPersistStorageImpl; IPersistStreamInitImpl; IViewObjectExImpl; joyReleaseCapture; joySetThreshold; memcpy; OBJECT_ENTRY; PIXELFORMATDESCRIPTOR; RealizePalette; ReleaseCapture; SelectPalette; SetBkMode; SetCapture; SetTextColor; SwapBuffers; USES_CONVERSION; wglCreateContext; wglDeleteContext; wglGetCurrentDC; wglMakeCurrent

Note

Some of the samples, such as this one, have not been modified to reflect the changes in the Visual C++ wizards, libraries, and compiler, but still demonstrate how to complete your desired task.

See Also

Other Resources

ATL Attributes Samples