3D rendering engine for Delphi
所属分类:OpenGL
开发工具:Delphi
文件大小:219KB
下载次数:50
上传日期:2004-11-07 18:39:40
上 传 者:
xw54321
说明: opengl编程
(opengl Programming)
文件列表:
ColorConv.pas (4092, 2003-03-29)
Model3D.pas (29587, 2003-05-07)
Project1.dpr (250, 2003-04-28)
Project1.exe (408064, 2003-05-08)
Unit1.dfm (496, 2003-04-30)
Unit1.pas (2891, 2003-05-03)
3D rendering engine source code for delphi
Written by Peter Bone
http://www.geocities.com/peter_bone_uk
12 / 5 / 2003
This source code demonstrates the techniques used to handle 3D graphics without using
an API such as OpenGL. The code includes Gouraud shading, which gives much better
quality than flat shading for curved surfaces. The code does not yet include
perspective or texture mapping. The code also includes methods for building general
3D shapes.
To create a 3D object, first create an instance of the T3DModel class. You must then
build the model by creating the vertices and faces. This can be done using the
BuildRotationalVolume procedure, which can be used to create many different shapes.
You could also write your own code to build the model bearing in mind that the
vertices at the corners of the faces must be listed in clockwise order. You
must then specify the center point of the object and the position of the light
source. Once the model is built, you can translate the object to a position on the
screen using the Translate procedure or rotate it around an axis by a given angle
using the Rotate procedure. To render the object to a canvas, call the RenderObject
procedure and then draw the off screen bitmap to the canvas by doing
ACanvas.Draw(0,0,OffScrBmp);. See the example of how to use the class to render a
juggling club in the included Project1.dpr project.
近期下载者:
相关文件:
收藏者: