-
例子的基础知识:
界面设计:
界面关系描述:
object Form1: TForm1 Left = 290 Top = 175 Caption = 'Blur' ClientHeight = 462 ClientWidth = 518 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False OnCreate = FormCreate PixelsPerInch = 96 TextHeight = 13 object GLSceneViewer: TGLSceneViewer Left = 0 Top = 45 Width = 518 Height = 417 Camera = GLCamera1//相机 Buffer.FogEnvironment.FogColor.Color = {1283003F1283003F0000803F0000803F} Buffer.FogEnvironment.FogStart = 1.000000000000000000 Buffer.FogEnvironment.FogEnd = 3.000000000000000000 Buffer.BackgroundColor = clBackground Buffer.AmbientColor.Color = {0000000000000000000000000000803F} FieldOfView = 153.029327392578100000 Align = alClient OnMouseMove = GLSceneViewerMouseMove//鼠标事件 TabOrder = 0 end object Panel1: TPanel Left = 0 Top = 0 Width = 518 Height = 45 Align = alTop Caption = ' ' TabOrder = 1 object Label1: TLabel Left = 8 Top = 4 Width = 54 Height = 13 Caption = 'Blur Preset:' FocusControl = ComboBox1 end object Label2: TLabel Left = 216 Top = 4 Width = 61 Height = 13 Caption = 'Render Size:' FocusControl = ComboBox2 end object LabelFPS: TLabel Left = 376 Top = 26 Width = 20 Height = 13 Caption = 'FPS' end object ComboBox1: TComboBox Left = 8 Top = 20 Width = 161 Height = 21 Style = csDropDownList ItemIndex = 0 TabOrder = 0 Text = 'pNone (no change)' OnClick = ComboBox1Click Items.Strings = ( 'pNone (no change)' 'pGlossy' 'pBeastView' 'pOceanDepth' 'pDream' 'pOverBlur' 'pAdvancedBlur') end object ComboBox2: TComboBox Left = 216 Top = 20 Width = 145 Height = 21 Style = csDropDownList ItemIndex = 5 TabOrder = 1 Text = '256' OnChange = ComboBox2Change Items.Strings = ( '8' '16' '32' '64' '128' '256' '512') end end object GLScene1: TGLScene ObjectsSorting = osRenderFarthestFirst Left = 44 Top = 64 object GLLightSource1: TGLLightSource//光源 Ambient.Color = {BEC0403FBEC0403FBEC0403F0000803F} ConstAttenuation = 1.000000000000000000 Diffuse.Color = {BEC0403FBEC0403FBEC0403F0000803F} Position.Coordinates = {56551B40F9FF2D40F6FF3B400000803F} LightStyle = lsOmni SpotCutOff = 180.000000000000000000 end object GLCube1: TGLCube//立方体 Material.MaterialLibrary = GLMaterialLibrary1//材质 Material.LibMaterialName = 'LibMaterial' Direction.Coordinates = {82B16B3E068E77BF3986DFBD00000000} PitchAngle = -95.500000000000000000 Position.Coordinates = {DB9FEC3E806395BE509F213F0000803F} TurnAngle = 6.500000000000000000 Up.Coordinates = {DD7324BEE3EB17BE6BCE793F00000000} end object GLSphere1: TGLSphere//球 Material.MaterialLibrary = GLMaterialLibrary2//材质 Material.LibMaterialName = 'LibMaterial' Position.Coordinates = {6E3D38BF0A5515BE733C1CBF0000803F} Radius = 0.500000000000000000 end object GLDummyCube1: TGLDummyCube// CubeSize = 1.000000000000000000 end object GLCamera1: TGLCamera//相机 DepthOfView = 100.000000000000000000 FocalLength = 50.000000000000000000 NearPlaneBias = 0.100000001490116100 TargetObject = GLDummyCube1 Position.Coordinates = {41A38A3F6847033F2894FA3F0000803F} Direction.Coordinates = {A5C4F6BE96EA77BE3E9257BF00000000} Up.Coordinates = {B74DF6BD4B62783F582A57BE00000000} end end object GLMaterialLibrary1: TGLMaterialLibrary Materials = < item Name = 'LibMaterial' Tag = 0 Material.Texture.ImageClassName = 'TGLPicFileImage'//Texture是一个关注点 Material.Texture.Image.PictureFileName = 'marbletiles.jpg'//程序运行时要加载相片 Material.Texture.MagFilter = maNearest Material.Texture.MinFilter = miNearest Material.Texture.TextureMode = tmModulate Material.Texture.Compression = tcNone Material.Texture.Disabled = False end> TexturePaths = '..\..\..\..\media\'//相片的路径 Left = 140 Top = 64 end object GLCadencer1: TGLCadencer//动画节拍器 Scene = GLScene1 SleepLength = 0 OnProgress = GLCadencer1Progress//节拍事件 Left = 44 Top = 144 end object Timer1: TTimer OnTimer = Timer1Timer Left = 260 Top = 64 end object GLMaterialLibrary2: TGLMaterialLibrary//第二个材质库 Materials = < item Name = 'LibMaterial' Tag = 0 Material.Texture.ImageClassName = 'TGLPicFileImage' Material.Texture.Image.PictureFileName = 'marbletiles.jpg' Material.Texture.MagFilter = maNearest Material.Texture.MinFilter = miNearest Material.Texture.TextureMode = tmModulate Material.Texture.Compression = tcNone Material.Texture.Disabled = False end> TexturePaths = '..\..\..\..\media\' Left = 400 Top = 88 end end
代码控制:
unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, GLWin32Viewer, GLScene, GLObjects, GLTexture, GLHudObjects, GLCompositeImage, GLFileJPEG, GLCadencer, StdCtrls, ExtCtrls, GLBlur, GLCrossPlatform, GLMaterial, GLCoordinates, BaseClasses, Jpeg, GLUtils; type TForm1 = class(TForm) GLScene1: TGLScene; GLCamera1: TGLCamera; GLMaterialLibrary1: TGLMaterialLibrary; GLCube1: TGLCube; GLLightSource1: TGLLightSource; GLSceneViewer: TGLSceneViewer; GLCadencer1: TGLCadencer; GLSphere1: TGLSphere; Panel1: TPanel; ComboBox1: TComboBox; Label1: TLabel; Label2: TLabel; ComboBox2: TComboBox; Timer1: TTimer; GLDummyCube1: TGLDummyCube; LabelFPS: TLabel; GLMaterialLibrary2: TGLMaterialLibrary; procedure FormCreate(Sender: TObject); procedure GLCadencer1Progress(Sender: TObject; const deltaTime, newTime: Double); procedure ComboBox1Click(Sender: TObject); procedure ComboBox2Change(Sender: TObject); procedure Timer1Timer(Sender: TObject); procedure GLSceneViewerMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); private { Private declarations } oldx, oldy: integer; public { Public declarations } B: TGLBlur; end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin SetGLSceneMediaDir(); // Add GLBlur to scene B := TGLBlur.Create(self); GLSphere1.AddChild(B); B.TargetObject := GLCube1; B.RenderWidth := 256; B.RenderHeight := 256; // Load texture for objects GLMaterialLibrary1.Materials[0].Material.Texture.Image.LoadFromFile('HPIM5446.JPG');//加载相片 GLMaterialLibrary2.Materials[0].Material.Texture.Image.LoadFromFile('HPIM5446.JPG'); ComboBox1.ItemIndex := 1; ComboBox2.ItemIndex := 2; ComboBox1Click(self); end; procedure TForm1.GLCadencer1Progress(Sender: TObject; const deltaTime, newTime: Double); begin GLCube1.Turn(deltatime * 10); GLSphere1.Turn(deltatime * 50); end; procedure TForm1.ComboBox1Click(Sender: TObject); begin B.Preset := TGLBlurPreset(ComboBox1.itemIndex); end; procedure TForm1.ComboBox2Change(Sender: TObject); begin B.RenderWidth := StrToInt(ComboBox2.Items[ComboBox2.ItemIndex]); B.RenderHeight := B.RenderWidth; end; procedure TForm1.Timer1Timer(Sender: TObject); begin LabelFPS.Caption := FloatToStr(Trunc(GLSceneViewer.FramesPerSecond))+ ' FPS'; // GLSceneViewer.ResetPerformanceMonitor; end; procedure TForm1.GLSceneViewerMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin if ssLeft in Shift then begin GLCamera1.MoveAroundTarget(1 * (oldy - y), 1 * (oldx - x)); end; oldx := x; oldy := y; end; end.
相关推荐
这个“glscene例子”是针对Delphi程序员的一个示例项目,旨在展示如何利用GlScene库来创建交互式的3D场景。下面将详细解释这个示例中的关键知识点。 1. **Delphi**: Delphi是一款面向对象的可视化集成开发环境(IDE...
总的来说,"delphi的glscene例子和源代码大集合"是一个宝贵的资源,无论你是刚接触GLScene的新手还是希望提升技能的资深开发者,都可以从中获益。通过深入学习和实践这些实例,不仅可以增强对3D编程的理解,还能提高...
GlScene库基于OpenGL,一个强大的跨平台的图形编程接口,使得在Delphi中构建复杂的3D应用变得相对简单。在这个实例中,我们将深入探讨GlScene的动态属性和方法,以及如何通过3dsNodeSystem文件来实现3D场景的构建。 ...
10. **社区支持**:GLScene有一个活跃的开发者社区,用户可以在论坛上交流问题,获取帮助,分享代码和经验。 GLScene_v1.2_July_2013这个版本发布于2013年7月,可能包含了该时期最新的特性和改进。更新日志通常会...
**GLScene for Delphi:深度探索3D图形编程** GLScene是Delphi编程环境中的一款强大的3D图形库,它提供了丰富的功能,使开发者能够轻松创建...对于想要在Delphi中开发3D应用的人来说,这是一个不可多得的学习资源。
【GLScene_demo】是一个基于OpenGL图形库的演示项目,展示了GLScene库的使用。GLScene是一个强大的3D图形引擎,用于Delphi和C++Builder开发人员,它提供了丰富的功能,如光照、纹理映射、粒子系统、动画以及复杂的3D...
GLScene_v_1000714是一个针对Delphi编程环境的3D图形库,提供了丰富的OpenGL开发组件。这个库版本号为1000714,意味着它可能是该库的一个较新版本,包含了若干改进和修复。Delphi是一款流行的面向对象的 Pascal 编程...
而`glScene`是Delphi社区中一个强大的3D图形库,专为创建复杂的三维场景和应用程序设计。这个“delphi glscene”实例,正如其标题所言,是一个简单的茶壶模型在3D空间中旋转的示例,这为我们提供了学习和理解glScene...
GLScene控件包是专为Delphi编程环境设计的一个强大的3D图形库,它提供了丰富的功能,让开发者能够轻松地在Delphi应用中创建复杂的3D场景和效果。这个控件包不仅包含了基本的3D建模和渲染功能,还支持动画、光照、...
GLScene 1.1 Full Source D7-XE7 是一个针对 Delphi 开发者的图形库源码包,它提供了一套完整的3D图形渲染和场景管理功能。这个库旨在简化在 Delphi 中创建复杂的3D应用程序的过程,为开发者提供了丰富的功能和工具...
在CSDN的Delphi游戏及图形处理板块中网友凌风写过一篇不错的帖子,讲述GLScene的基本应用,另外还将GLScene的帮助文档翻译后制成电子档共享给大家。 也感谢培客网的方育华提供的这份资源。 觉得应该共享,拿出来和...
GLScene 是一个开源的 Delphi 和 C++ Builder 组件库,专门用于创建高质量的3D图形应用程序。它提供了一系列的组件,可以帮助开发者轻松地构建复杂的3D场景,无需深入理解底层的OpenGL技术。在“GLScene 3D实例”中...
GLScene是一个强大的开源3D图形库,专为Delphi、C++Builder以及Lazarus开发者设计,基于高性能的OpenGL图形接口。这个库的核心目标是简化3D应用的开发过程,通过提供一系列可视化的组件和对象,让程序员可以更加专注...
The release of GLScene v2.1 for Embarcadero RAD Studio Delphi & C++Builder 11.0 3D绘图组件 最新版V2.1 Extended support for third-party libraries GR32, BASS, FMOD, OpenAL, ODE and Newton. The ...
GLScene中文帮助文档,3D开发的利器,希望对大家有用。
GLScene v0.9 是一个基于OpenGL的开源3D图形库,专为开发人员设计,用于构建复杂的3D应用程序。这个库提供了丰富的功能,包括3D物体的创建、管理、光照处理以及材质编辑,使开发者能够更加便捷地在他们的项目中实现...
and 10.3 Rio,delphi,图像,图形,3D控件,包含演示源代码,网上找了很久 基本都不能用于DELPHI XE10,要不编译失败,要不代码不兼容,这个已经在32位程序输出,系统64位win10,XE10.3环境下测试成功的,有英文安装...
GLScene 是一个基于 Delphi 的开源图形库,它利用 OpenGL 技术提供了一整套用于创建 2D 和 3D 图形应用的框架。GLScene 的设计目标是简化 3D 渲染和交互,使得开发者能够快速构建复杂的 3D 场景而无需深入了解底层的...
delphi glscene demo 源代码演示大全