Home

 

From the 90s to the early 2000s

 

When I first added graphics to any program, it was to Turbo Pascal on an IBM XT in around 1992, and I did 2 dimensional gravity sims or graphical representations of statistical models, differential equations, and sequences/series and other things. There is nothing quite like looking at a function like y = x2, using numerical methods (Simpson's rule for example) to compute it, and watch a virtual infinitude of rectangular areas sum to the definite integral between two points computed analytically.

 

The graphics available for Borland products back in the olden days, known as the BGI, were very limited for many reasons, the most obvious of which was hardware.  By the mid 1990s, graphics had become a parallel hardware entity--like the CPU itself--created solely for handling graphical related mathematics without involving the CPU. It became a separate processor optimized for a small set of computations, capable of running on its own in order to bypass the long route to the CPU and peripherals (if needed) and operate autonomously.   Hardware makers created highly optimized systems able to be implemented with a standard library, like OpenGL, which would presumably be programmed make use of any compatible hardware on the system.

 

With Visual Basic 6.0 came Pictureboxes (GDI) and a fairly open-ended set of tools into which a graphic port could be created. The programmer could create a window and render in it, putting down bitmaps or jpgs, drawing lines and other shapes--very similar to the Borland BGI but vastly improved over the interceding years.  Pictureboxes also had native mouse event handlers and other items that made interfacing with the user a lot easier.

 

My first gravitational simulators in Visual Basic, featuring .jpg images of each planet or star,  moving around in perspective with a  rotatable 'world' (model) using arrow keys etc, was written to be run with the Picturebox GDI.

 

For VB at the time, there were no native libraries for DirectX or OpenGL, so I had to write my own transformations routines which I pulled straight out of my Linear Algebra text. The concept of 'vertices' and 'pixels' didnt' exist. Everything was a point to me, and occasionally, I'd put a sphere or a box at a particular point, and transform the key points--the corners or center.   I did didn't optimize matrix multiplication (column based multiplications versus row based, although I used column based just by luck) or apply other strategies, but it was still pretty fast considering all of the computations required.

 

 It was also a good exercise for me to write matrix solvers and determinant takers, and programs that fit quadratics to point sets etc. I still have all of that code, and I enjoy looking it over from time to time as I think back to the warm and fuzzy days of just me and my current PC at the time.  The display was just OK, and I quickly realized I needed to make use of OpenGL or DirectX. However, I didn't want to convert all of my work to C++, which at the time, was the only IDE capable of handling them.   VB was useful for GUI interface programs, databases, calling Access, Excel, dialing numbers, networking etc. Why would I want to now break out the C++ and effectively lose all of those tools? I didn't.

 

For any work related project, I necessarily used VB.  For a while, maybe a year or so, I quit working on Orbit--from around Spring 1999 until Spring of 2000. However, at some point,  I found a VB wrapper for OpenGL online. (Thanks to whoever wrote that thing BTW).

 

Thus began my first foray into OpenGL. It sucked. Any book I bought on the library was in C++. Also, OpenGL was developed for C++, and C++ and Visual Basic handle memory very differently, so almost nothing could be directly translated.  I spent several months working not only to understand OpenGL, but to try to understand it despite the incompatibility. There was a lot of frustration because some things simply would not work no matter what I did, while others would work if I wasted enough time trying different things. At the time though, it was the only OpenGL, open ended Solar System program available at download.com. With my day job, I didn't have time to toil with it and fix bugs.   I also realized I couldn't get bump mapping to work with the OpenGL wrapper I was using nor with a DirectX VB wrapper (8.0 I think) that also became available. Without bump mapping, I didn't feel motivated to do press on.

 

 

Early, pre-GL version of Orbit

Earliest version of Orbit. I wrote my own transformation modules in order to project everything in the system onto the 2d screen--basically, everything that happens when a model is rotated and translated, then projected using DirectX and OpenGL matrix operations.

The transform function for example below,  moves points around depending on the rotation angles. Of course, with OpenGL and DirectX now, you simply use something like World_Matrix = Matrix.RotationYawPitchRoll(alpha,beta, gamma) and you then apply that to either the device (thus all the points rendered) or set it in the shader and run the vertices through it.

Sample functions done the hard way before GL and DX exposed matrix stack

Public Sub transform(window As Object, p As Point, alpha As Single, beta As Single, gamma As Single)
Dim x As Single
Dim y As Single
Dim z As Single
Dim A As Single
Dim B As Single
Dim C As Single
On Error Resume Next
A = alpha
B = beta
C = gamma

x = p.x
y = p.y
z = p.z
p.yp = p.y
p.xp = p.x
p.xp = Cos(A) * (z * Cos(C) * Sin(B) - y * Sin(C)) + Sin(A) * (y * Cos(C) * Sin(B) + z * Sin(C)) + x * Cos(C) * Cos(B)
p.yp = Cos(A) * (z * Sin(C) * Sin(B) + y * Cos(C)) + Sin(A) * (y * Sin(C) * Sin(B) - z * Cos(C)) + x * Sin(C) * Cos(B)
p.xp = p.xp + window.width / 2
p.yp = p.yp + window.height / 2

End Sub

 

Early OpenGL version of Orbit simulating the Earth/Moon/Sun system in which the Sun is instead a black hole. VB6.0 and OpenGL wrapper I found somewhere. 1999

Were I to redo it now, I could add dust, and bump mapping (see below for bump mapping picture) quite easily. Celestia is available now however, and it's a great program from what I have seen. I have no interest in duplicating it.

 

GL Orbit circa 2000

Kurt Bingham 2008

Home