Click here to Skip to main content
Click here to Skip to main content

The GLU functions and hit testing using OpenGL and MFC

By , 1 Oct 2000
Rate this:
Please Sign up or sign in to vote.
<!-- Download Links -->
  • Download source files - 51 Kb
  • <!-- Article image -->

    Sample Image - mfchittest.gif

    <!-- Main HTML starts here -->

    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

    About the Author

    Masoud Samimi
    Technical Lead Samimi Information Technology
    United Arab Emirates United Arab Emirates
    My company provides services in the fields of:
     
    LAN/WAN Networking
    Data Management and Security
    Data Recovery
    ERP/CRM Solutions
    IT Infrastructure Solutions
    Software/Hardware Sales/Service

    Comments and Discussions

     
    GeneralMy vote of 4 PinmemberMrLonely250425-Jul-10 18:30 
    QuestionHow to run 2 different(or same) OpenGL objects in one DialogBox? Pinmemberwerter13-May-04 21:17 
    GeneralLooks like there's some coordinate problems Pinmemberedsela2-Apr-04 9:05 
    QuestionHow is OpenGL compared to DirectX? PinmemberThorell12-May-03 4:56 
    GeneralExactly what i was looking for - Thankx ! PinsussMayuresh Kadu31-Oct-00 18:10 
    GeneralRe: Exactly what i was looking for - Thankx ! Pinmember123456723-Oct-01 23:14 
    GeneralOpenGl + Windows 2000 PinsussSanjay17-Oct-00 23:56 
    GeneralRe: OpenGl + Windows 2000 PinmemberAnonymous11-Sep-01 1:51 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    | Advertise | Privacy | Mobile
    Web01 | 2.8.140415.2 | Last Updated 2 Oct 2000
    Article Copyright 2000 by Masoud Samimi
    Everything else Copyright © CodeProject, 1999-2014
    Terms of Use
    Layout: fixed | fluid