Home     Sign in    
OpenGL
7/4/2004
By Simbey

What is the most important aspect of all video games today?  I would actually say it's the game map size and replayability, but my opinion is easily lost in the overwhelming majority of others who would say it's the 3D graphics.

It is unfortunate how long it took me to enter into the world of 3D programming.  I always thought I'd end up learning Direct3D someday, but that will probably never happen.  Its learning curve plus my lack of available time plus the lack of decent documentation for Direct3D has made it impossible for me to figure it out!  But I am pleased to say I have made it into the 3D realm anyway via OpenGL!

The first thing I did was I took an old QBasic program that drew points and lines to simulate a 3D grid, and I ported it to OpenGL.


This program can rotate freely negative and positive, it zooms in and out, and the map can scroll in all four directions.  Since the program only renders what would be visible, the map size can be enormous.

The next thing I wanted to do was create a 3D model of the "Double S" symbol shown on this website.  The model turned out beautifully, but it wasn't enough.  I decided it would be appropriate to use the rotating symbol as a screensaver on my computer!


Most screensavers link to Microsoft's scrnsave.lib library, but that presented some difficulties for me.  I needed to render the rotating model as many times per second as possible, but there is only one obvious method to animate a standard screensaver:  the timer.  And that's slow.  I tried using a separate thread, but OpenGL wouldn't draw from it.  Next I went looking for a way to write screensavers from scratch.

I found some code for writing OpenGL screensavers from scratch, but nowhere on the Internet could I find code that included support for screensaver passwords.  I found how to handle them, but not in conjunction with OpenGL.  The problem was I could render the models, but GDI calls such as MessageBox() or DialogBox() didn't always show up because the device context I was using included two buffers for a sort of page flipping.

To wrap all of this up, I will just say I am now keeping track of my calls to SwapBuffers().  The primary GDI surface can be obtained by swapping the device context buffers an even number of times.

If anyone is interested, I will make the screensaver framework I used (and modified) public.

© 2001-2017 Simbey.com