Simple OpenGL Classes

Environment: Windows NT4 SP5, Windows 95b/98, Visual C++ 6

In engineering applications it is necessary to have 3D graphics functions which can make visualization using engineering data. The following simple classes provide such functions which have been implemented using SDK rather than MFC.

1. Features:

(1). 2D, 3D, and True 3D (4D) display
(2). Zooming and rotation.
(3). 4D cutting
(4). Legend and marker
(5). DIB printing
(6). Support some visualization properties such as color selection
(7). Support mixed GDI and OpenGL map rendering

2. History

From 1996 to 1998, I involved to develop a 3D reservoir modeling package using OpenGL and MFC on Windows NT with interpolation algorithms, such as Kriging, Neural Network, Fuzzy Logic, and genetic algorithms interpolation algorithms. However, the provided classes, which have been rewritten using Win32 API completely, only implement part of the original 3D reservoir modeling package. Due to time constraints, all interpolation algorithms and their binary file outputs, and nonregular 4D map display are not included in the above classes.

You are free to use or modify these classes and to use them in any of your applications. But I make no guarantees about these classes suitability for use. If there is any problem with anything I wrote, I will certainly try to help solve it.

3. Source Code

(1). OpenGL.h and OpenGL.cpp: property definition, map framework description, zooming, rotation, etc.

(2). OpenGL3D.h and OpenGL3D.cpp: implement the simplest 2D and 3D rendering.

(3). OpenGL4D.h and OpenGL4D.cpp: implement the simplest True 3D (4D) rendering.

4. Support classes

(1). ClassArr.h: template based class similar to MFC CArray, but independent on MFC.

(2). ColourPicker.h and ColourPicker.cpp: Codeguru code to implement colorpicker.

(3). Hdibapi.h and Hdibapi.cpp: DIB loading and saving.

(4). Str.h and Str.cpp: The simplest string class.

(5). TabWindow.h and TabWindow.cpp: MFC CTabCtrl derived component and contains an implementation of tab views.

5. Demo Project

The GLDemo, which is an MFC MDI application, demonstrates how to use classes mentioned above. It uses a splitter window. Most actions are shown in the left window and rendering is shown in the right window.

From the View menu, click Grid Data to load one of the grid data files (*.grd), where Surfer format files SurfA.grd (ASCII) and SurfB.grd, and other format files (defined by myself and available by request ) test3d.grd, test4d.grd, and true3d.grd. For 3D visualization, you can load maker file (the text file Marker.mrk only for SurfA.grd and SurfB.grd). Please note that Shitf + left mouse button down can move the legend. You can find most visualization properties in the left window. In addition, From File/Save To BMP, you can save the active window, client area, and any part of the client area (rectangle) to BMP.

About the Author

I am a senior software engineer for TechComm Simulation Pty Ltd., Sydney, Australia, where I specialize in Client/Server and TCP/IP programming on Unix and Windows NT. My e-mail address is yuantuh@techsim.com.au.

Downloads

Download demo project - 253 Kb
Download source - 47 Kb


Comments

  • Any chance of getting the algorithm code?

    Posted by Mike Pliam on 12/26/2008 03:41pm

    I am finally mature enough to appreciate the brilliance of this implementation. You mentioned in the history section that you have left out the Kriging and other interpolation code. Would you consider posting the interpolation code, or providing it upon request ? I also would be interested in how you format the *.grd files. Thankyou.

    Reply
  • Solution to Release mode compilation problems

    Posted by Legacy on 11/21/2002 12:00am

    Originally posted by: Ashutosh R. Bhatikar

    Please do the following to resolve the Release mode compilation issue:
    
    1. Include stdafx.h file at the begining as shown under in the str.cpp file

    #include "stdafx.h"
    #include <stdio.h>
    #include <assert.h>
    #include <math.h>
    #include <stdlib.h>
    #include "Str.h"

    2. Please add opengl32.lib glu32.lib libraries in the Project settings for Win32 Release in the Object/Library Modules: edit box.

    Hope this helps.

    • I still can not compile

      Posted by bono02 on 02/02/2007 11:23am

      I still can not compile your code. I have added those lines you told me. I am using Visual Studio 2005. Could you help me? Thank you.

      Reply
    Reply
  • Help!! Help!!

    Posted by Legacy on 10/14/2002 12:00am

    Originally posted by: A Novice

    Good Day ,Everyone!

    Whenever I run the application, an error dialog appears ,which said "error in initializing the program (0xc0000142)", I think something is wrong with the memory,
    but how can I solve the problem ?

    Thank you and Need your help.

    2002/10/14

    Reply
  • Help!! Help!!

    Posted by Legacy on 10/14/2002 12:00am

    Originally posted by: A Novice

    Good Day ,Everyone!

    Whenever I run the application, an error dialog appears ,which said "error in initializing the program (0xc0000142)", I think something is wrong with the memory,
    but how can I solve the problem ?

    Thank you and Need your help.

    2002/10/14

    Reply
  • Error Compile in Release mode!

    Posted by Legacy on 08/14/2002 12:00am

    Originally posted by: caijun

    Debug compiles just fine but I cant get the Release version of the demo project to compile using VCPP 6.0 in either Win95 or NT4. Get the following compiler error message,

    C:\Program Files\Microsoft Visual Studio\MyProjects\OpenGL\GLDemo\Str.cpp(336) : fatal error C1010: unexpected end of file while looking for precompiled header directive

    Anybody know why this happens or how to correct it?

    Reply
  • Problems!!

    Posted by Legacy on 07/05/2002 12:00am

    Originally posted by: David Matthews

    I seem to be having a problem other people have noted:

    C:\graphtry\Str.cpp(336) : fatal error C1010: unexpected end of file while looking for precompiled header directive

    I wish to use the graph routine in an application of my own.
    I made a new MDI project and added the files you have in GLSrc.zip. But it won't compile. What's going wrong?

    Thanks for your help.

    David

    (PS the Demo makes it look like a great routine if I can get it to work in my project...)

    Reply
  • V.Useful & Clear.

    Posted by Legacy on 06/28/2002 12:00am

    Originally posted by: NC

    Thanks for making this available to all.

    Reply
  • Wont compile Release version using VCPP 6.0

    Posted by Legacy on 06/20/2002 12:00am

    Originally posted by: Michael B. Pliam

    Debug compiles just fine but I cant get the Release version of the demo project to compile using VCPP 6.0 in either Win95 or NT4.  Get the following compiler error message,
    
    

    C:\Program Files\Microsoft Visual Studio\MyProjects\OpenGL\GLDemo\Str.cpp(336) : fatal error C1010: unexpected end of file while looking for precompiled header directive

    Anybody know why this happens or how to correct it?

    Reply
  • Great jobs and a further question.

    Posted by Legacy on 05/21/2002 12:00am

    Originally posted by: jonathan

    I have built it and get the demonstration well .
    My question is how the surfer.grd and others .grd files
    are got . Can the file formats like .3ds and .dxf be
    converted to .grd with some converting tools ?

    Reply
  • OPENGL Project

    Posted by Legacy on 02/22/2002 12:00am

    Originally posted by: Despair

    Hi,
    I'm currently working on a 3d project in opengl. The assignment is to create a floor with 7 rooms, 5 different shapes and 4 different sizes. How do you suggest I go about starting this prokect? I also have to add lighting and camera perspectives when navigating through the rooms.
    Thanks

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

  • Hundreds of millions of users have adopted public cloud storage solutions to satisfy their Private Online File Sharing and Collaboration (OFS) needs. With new headlines on cloud privacy issues appearing almost daily, the need to explore private alternatives has never been stronger. Join ESG Senior Analyst Terri McClure and Connected Data in this on-demand webinar to take a look at the business drivers behind OFS adoption, how organizations can benefit from on-premise deployments, and emerging private OFS …

Most Popular Programming Stories

More for Developers

RSS Feeds