Click here to Skip to main content
6,821,293 members and growing! (22,516 online)
Email Password   helpLost your password?
Multimedia » OpenGL » General     Intermediate

The GLU functions and hit testing using OpenGL and MFC

By Masoud Samimi

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
VC6Win2K, MFC, OpenGL, Dev
Posted:1 Oct 2000
Views:88,568
Bookmarked:41 times
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
22 votes for this article.
Popularity: 6.01 Rating: 4.48 out of 5

1
1 vote, 11.1%
2

3
1 vote, 11.1%
4
7 votes, 77.8%
5
  • 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

    About the Author

    Masoud Samimi


    Member
    Check my site please. Smile
    Thank you.
    Occupation: Web Developer
    Location: United States United States

    Other popular OpenGL articles:

    Article Top
    You must Sign In to use this message board.
    FAQ FAQ 
     
    Noise Tolerance  Layout  Per page   
     Msgs 1 to 7 of 7 (Total in Forum: 7) (Refresh)FirstPrevNext
    GeneralHow to run 2 different(or same) OpenGL objects in one DialogBox? Pinmemberwerter122:17 3 May '04  
    GeneralLooks like there's some coordinate problems Pinmemberedsela10:05 2 Apr '04  
    GeneralHow is OpenGL compared to DirectX? PinmemberThorell5:56 12 May '03  
    GeneralExactly what i was looking for - Thankx ! PinsussMayuresh Kadu19:10 31 Oct '00  
    GeneralRe: Exactly what i was looking for - Thankx ! Pinmember12345670:14 24 Oct '01  
    GeneralOpenGl + Windows 2000 PinsussSanjay0:56 18 Oct '00  
    GeneralRe: OpenGl + Windows 2000 PinmemberAnonymous2:51 11 Sep '01  

    General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

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

    PermaLink | Privacy | Terms of Use
    Last Updated: 1 Oct 2000
    Editor: Chris Maunder
    Copyright 2000 by Masoud Samimi
    Everything else Copyright © CodeProject, 1999-2010
    Web10 | Advertise on the Code Project