도전2022

Planet 3D (Alias GL Earth) 본문

소스코드

Planet 3D (Alias GL Earth)

hotdigi 2014. 1. 7. 07:14

http://www.codeproject.com/Articles/16360/Planet-3D-Alias-GL-Earth




Planet 3D (Alias GL Earth)

By 13 Nov 2006
Sample Image - planet3d.jpg

Introduction

The project exclusively uses the features found in VISUAL C# 2005 Express Edition.

Planet 3D is a companion to my Panorama contribution, that has already been posted there.

The demo is provided with several textures to create the stellar background and each of the planets.

Note: In order to keep the size of the ZIP file small, the provided textures are in low resolution mode (I have larger resolution that I can send on demand).

The control uses 3D polar coordinates, and either keyboard direction key or buttons to change the planet rotation angle.

You can also use the left mouse button while in the OpenGL control to rotate the planet.

Several classes and "user controls" help the creation of the skinned button and the dedicated trackbar.

Smooth zooming is used to enlarge or reduce the size of the planet while the stellar background is left unchanged.

Code Insight

SkinEngine.cs

This class is responsible for the drawing of skinned form and custom controls.

SkinButton.cs

User control to create skinned button using one single 5-image bitmap matching each of the button states: normal, down, disabled, focused, hover.
You can use either "standard" push button or shaped button with region.

SkinTrackbar.cs

User control to create a mouse only skinned track bar.
The thumb tracker can have any size or shape based on a provided bitmap.
The control orientation is based on the ratio between width and height; if width is larger than height then horizontal else vertical.
To help the user to figure the moving of the thumb track, the control draws a layered triangle over the background and uses a tooltip to show the current value.
You can inverse ranging swapping min/max values.

OpenGL.cs

Encapsulation of the OpenGL API being used.

Win32.cs

Encapsulation of the Win32 API being used.

GDImage.cs

Encapsulation of the GDImage API being used.
GDImage is a prerequisite to create OpenGL font and convert image to GL texture on the fly.

Comment

I hope you will like Planet 3D and perhaps learn a few things from it.

You will find more contributions on my Web site in the "C# corner" section.

History

  • 13th November, 2006: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

zapsolution
Software Developer zapsolution 
France France
I am a low level SDK programmer, focusing mainly on graphic imaging and multimedia applications.
I am using several languages, including C, C++, PowerBASIC, WinDev.
I have also played a little with C#, but DotNET is something i never use for public code production.


'소스코드' 카테고리의 다른 글

OpenGL Terrain Generation - An Introduction  (0) 2014.01.07
2D Drawing with an OpenGL Control  (0) 2014.01.07
OpenGL Pixel Buffer Object (PBO)  (0) 2014.01.07
Video Texture in OpenGL  (0) 2014.01.07
Panorama 360  (0) 2014.01.07