Introduction
The project uses exclusively the features found in VISUAL C# 2005 Express Edition.
The purpose of this demo is to mimic the JAVA applets that can be found over the NET to create virtual tours.
Animation
Use either buttons or direction keys to change view angle.
About the Code
The code itself is small, but there are two important points:
- Handling of keyboard direction keys is done in
Form_KeyDown
andForm_PreviewKeydown
, this is to bypass the nasty TAB order that would rather put the focus on trackbar, instead of the OpenGL control. - To perform smooth animation and limit CPU usage I am using a tip, using
StartAnimation
and theWndProc Api.WM_TIMER
message, altogether.
Note: I am using GDImage
to select a new panorama and create OpenGL texture and font on the fly, but you can use any other OpenGL helper doing the same, this won't affect the core RenderOpenGL
method.
Apart of the MAIN_Form
class, the project uses 3 specific classes:
- OpenGL.cs (dedicated OpenGL API encapsulation)
- Win32.cs (low level Win32 API encapsulation)
- GDImage.cs (low level graphic encapsulation)
ZIP Content
- Project source code for .NET 2.0+
- Two JPEG textures in the \bin\debug folder
- GDImage.dll in the \bin\debug folder (prerequisite to create OpenGL texture and font on the fly)
Enjoy!
You can check for the latest version here in the "C# corner" section.
You will also find on my C# Web page other demos that haven't been posted here.
History
- 29th October, 2006: Initial post