Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

The GLU functions and hit testing using OpenGL and MFC

0.00/5 (No votes)
1 Oct 2000 1  
This sample teaches you how to create an OpenGL based 3D Drawing application and demonstrates the GLU functions and hit testing using OpenGL and MFC
  • Download source files - 51 Kb
  • Sample Image - mfchittest.gif

    Introduction

    This sample teaches you how to create an OpenGL based 3D Drawing application using the MFC library. It shows how to setup the View's class for OpenGL by using special setup methods that would enable the view window to show 3D shapes.

    Sample:

    The sample MFC program demontrates how to setup OpenGL with MFC. It also demonstrates how to make 3D Shapes using the glu... and aux... functions, for example 3D Sphere or 3D Teapot. It also shows the very important Hit Selection process in MFC with OpenGL. You can click the shape you want to select it, then it is selected and reported with a message dialog.

    User Interactions:

    • By using the Command Toolbar, you can change program flow mode to Selection, Rotations or Translation modes.
    • While in Selection Mode, with Left Mouse click on the 3D Shapes in the scene will result in selection and report the shape.
    • When in Translation Mode, you can move the scene around every where. Also you may Zoom In & Out by Right Mouse button pressed and moved.
    • When in Rotation Mode, you can rotate the scene around any where. Also you could toggle the Rotation Axes between X, Y or Z by pressing the TAB key.
    • Toggle the Camera View Angle to X, Y or Z.
    • Toggle the Camera projection type between Perspective or Ortho.
    • Toggle Show or Hide axis.
    • Change the Draw, Shading and Lighting Orientation from the Draw Mode menu.

    Notes & Credits:

    The source code for the Camera, Scene and Co-Ordinate axis classes are from the sample application posted on www.codeguru.com's OpenGL link. Please ckeck the sample.

    Rquirements

    The application requires opengl32.dll for windows which can be obtained from www.opengl.org.

    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here