mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 11:30:28 +02:00
fpvectorial: Starts a 3D viewer
git-svn-id: trunk@35041 -
This commit is contained in:
parent
18eae4cea8
commit
b1dc06bfe7
6
.gitattributes
vendored
6
.gitattributes
vendored
@ -964,6 +964,12 @@ components/fpvectorial/examples/fpce_mainform.pas svneol=native#text/plain
|
||||
components/fpvectorial/examples/fpcorelexplorer.ico -text
|
||||
components/fpvectorial/examples/fpcorelexplorer.lpi svneol=native#text/plain
|
||||
components/fpvectorial/examples/fpcorelexplorer.lpr svneol=native#text/plain
|
||||
components/fpvectorial/examples/fpv3d_mainform.lfm svneol=native#text/plain
|
||||
components/fpvectorial/examples/fpv3d_mainform.pas svneol=native#text/plain
|
||||
components/fpvectorial/examples/fpv3dviewer.ico -text
|
||||
components/fpvectorial/examples/fpv3dviewer.lpi svneol=native#text/plain
|
||||
components/fpvectorial/examples/fpv3dviewer.lpr svneol=native#text/plain
|
||||
components/fpvectorial/examples/fpv3dviewer.res -text
|
||||
components/fpvectorial/examples/fpvc_mainform.lfm svneol=native#text/plain
|
||||
components/fpvectorial/examples/fpvc_mainform.pas svneol=native#text/plain
|
||||
components/fpvectorial/examples/fpvectorialconverter.ico -text
|
||||
|
40
components/fpvectorial/examples/fpv3d_mainform.lfm
Normal file
40
components/fpvectorial/examples/fpv3d_mainform.lfm
Normal file
@ -0,0 +1,40 @@
|
||||
object formFPV3D: TformFPV3D
|
||||
Left = 257
|
||||
Height = 240
|
||||
Top = 177
|
||||
Width = 320
|
||||
Caption = 'formFPV3D'
|
||||
ClientHeight = 240
|
||||
ClientWidth = 320
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
LCLVersion = '0.9.31'
|
||||
object FileNameEdit1: TFileNameEdit
|
||||
Left = 12
|
||||
Height = 21
|
||||
Top = 8
|
||||
Width = 280
|
||||
DialogOptions = []
|
||||
FilterIndex = 0
|
||||
HideDirectories = False
|
||||
ButtonWidth = 23
|
||||
NumGlyphs = 0
|
||||
MaxLength = 0
|
||||
TabOrder = 0
|
||||
end
|
||||
object Button1: TButton
|
||||
Left = 12
|
||||
Height = 25
|
||||
Top = 40
|
||||
Width = 75
|
||||
Caption = 'Button1'
|
||||
TabOrder = 1
|
||||
end
|
||||
object glControl: TOpenGLControl
|
||||
Left = 12
|
||||
Height = 162
|
||||
Top = 72
|
||||
Width = 296
|
||||
OnPaint = glControlPaint
|
||||
end
|
||||
end
|
116
components/fpvectorial/examples/fpv3d_mainform.pas
Normal file
116
components/fpvectorial/examples/fpv3d_mainform.pas
Normal file
@ -0,0 +1,116 @@
|
||||
unit fpv3d_mainform;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, OpenGLContext, Forms, Controls, Graphics,
|
||||
Dialogs, EditBtn, StdCtrls, fpvectorial, gl, glu;
|
||||
|
||||
type
|
||||
|
||||
{ TformFPV3D }
|
||||
|
||||
TformFPV3D = class(TForm)
|
||||
Button1: TButton;
|
||||
FileNameEdit1: TFileNameEdit;
|
||||
glControl: TOpenGLControl;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure glControlPaint(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
public
|
||||
{ public declarations }
|
||||
VecDoc: TvVectorialDocument;
|
||||
end;
|
||||
|
||||
var
|
||||
formFPV3D: TformFPV3D;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TformFPV3D }
|
||||
|
||||
procedure TformFPV3D.glControlPaint(Sender: TObject);
|
||||
begin
|
||||
glClearColor(1.0, 1.0, 1.0, 1.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(45.0, double(width) / height, 0.1, 100.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
glTranslatef(0.0, 0.0,-6.0);
|
||||
glRotatef(100, 220, 330, 0.0);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f(0.0,1.0,0.0); // Set The Color To Green
|
||||
glVertex3f( 1.0, 1.0,-1.0); // Top Right Of The Quad (Top)
|
||||
glVertex3f(-1.0, 1.0,-1.0); // Top Left Of The Quad (Top)
|
||||
glVertex3f(-1.0, 1.0, 1.0); // Bottom Left Of The Quad (Top)
|
||||
glVertex3f( 1.0, 1.0, 1.0); // Bottom Right Of The Quad (Top)
|
||||
glEnd();
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f(1.0,0.5,0.0); // Set The Color To Orange
|
||||
glVertex3f( 1.0,-1.0, 1.0); // Top Right Of The Quad (Bottom)
|
||||
glVertex3f(-1.0,-1.0, 1.0); // Top Left Of The Quad (Bottom)
|
||||
glVertex3f(-1.0,-1.0,-1.0); // Bottom Left Of The Quad (Bottom)
|
||||
glVertex3f( 1.0,-1.0,-1.0); // Bottom Right Of The Quad (Bottom)
|
||||
glEnd();
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f(1.0,0.0,0.0); // Set The Color To Red
|
||||
glVertex3f( 1.0, 1.0, 1.0); // Top Right Of The Quad (Front)
|
||||
glVertex3f(-1.0, 1.0, 1.0); // Top Left Of The Quad (Front)
|
||||
glVertex3f(-1.0,-1.0, 1.0); // Bottom Left Of The Quad (Front)
|
||||
glVertex3f( 1.0,-1.0, 1.0); // Bottom Right Of The Quad (Front)
|
||||
glEnd();
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f(1.0,1.0,0.0); // Set The Color To Yellow
|
||||
glVertex3f( 1.0,-1.0,-1.0); // Bottom Left Of The Quad (Back)
|
||||
glVertex3f(-1.0,-1.0,-1.0); // Bottom Right Of The Quad (Back)
|
||||
glVertex3f(-1.0, 1.0,-1.0); // Top Right Of The Quad (Back)
|
||||
glVertex3f( 1.0, 1.0,-1.0); // Top Left Of The Quad (Back)
|
||||
glEnd();
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f(0.0,0.0,1.0); // Set The Color To Blue
|
||||
glVertex3f(-1.0, 1.0, 1.0); // Top Right Of The Quad (Left)
|
||||
glVertex3f(-1.0, 1.0,-1.0); // Top Left Of The Quad (Left)
|
||||
glVertex3f(-1.0,-1.0,-1.0); // Bottom Left Of The Quad (Left)
|
||||
glVertex3f(-1.0,-1.0, 1.0); // Bottom Right Of The Quad (Left)
|
||||
glEnd();
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f(1.0,0.0,1.0); // Set The Color To Violet
|
||||
glVertex3f( 1.0, 1.0,-1.0); // Top Right Of The Quad (Right)
|
||||
glVertex3f( 1.0, 1.0, 1.0); // Top Left Of The Quad (Right)
|
||||
glVertex3f( 1.0,-1.0, 1.0); // Bottom Left Of The Quad (Right)
|
||||
glVertex3f( 1.0,-1.0,-1.0); // Bottom Right Of The Quad (Right)
|
||||
glEnd();
|
||||
|
||||
// Speed := double(OpenGLControl1.FrameDiffTimeInMSecs)/10;
|
||||
|
||||
// cube_rotationx += 5.15 * Speed;
|
||||
// cube_rotationy += 5.15 * Speed;
|
||||
// cube_rotationz += 20.0 * Speed;
|
||||
|
||||
glControl.SwapBuffers;
|
||||
end;
|
||||
|
||||
procedure TformFPV3D.FormCreate(Sender: TObject);
|
||||
begin
|
||||
VecDoc := TvVectorialDocument.Create;
|
||||
end;
|
||||
|
||||
procedure TformFPV3D.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
VecDoc.Free;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
BIN
components/fpvectorial/examples/fpv3dviewer.ico
Normal file
BIN
components/fpvectorial/examples/fpv3dviewer.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
95
components/fpvectorial/examples/fpv3dviewer.lpi
Normal file
95
components/fpvectorial/examples/fpv3dviewer.lpi
Normal file
@ -0,0 +1,95 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="3">
|
||||
<Item1>
|
||||
<PackageName Value="fpvectorialpkg"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LazOpenGLContext"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item3>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="fpv3dviewer.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="fpv3dviewer"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="fpv3d_mainform.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="formFPV3D"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="fpv3d_mainform"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="fpv3dviewer"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<MsgFileName Value=""/>
|
||||
</CompilerMessages>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
21
components/fpvectorial/examples/fpv3dviewer.lpr
Normal file
21
components/fpvectorial/examples/fpv3dviewer.lpr
Normal file
@ -0,0 +1,21 @@
|
||||
program fpv3dviewer;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, fpv3d_mainform, lazopenglcontext
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource := True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TformFPV3D, formFPV3D);
|
||||
Application.Run;
|
||||
end.
|
||||
|
BIN
components/fpvectorial/examples/fpv3dviewer.res
Normal file
BIN
components/fpvectorial/examples/fpv3dviewer.res
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user