65.9K
CodeProject is changing. Read more.
Home

Panorama 360

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.45/5 (13 votes)

Oct 29, 2006

CPOL

1 min read

viewsIcon

121246

downloadIcon

7250

OpenGL full 360 spherical panorama

Sample Image - panorama_net.jpg

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:

  1. Handling of keyboard direction keys is done in Form_KeyDown and Form_PreviewKeydown, this is to bypass the nasty TAB order that would rather put the focus on trackbar, instead of the OpenGL control.
  2. To perform smooth animation and limit CPU usage I am using a tip, using StartAnimation and the WndProc 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