fpvectorial: Starts a 3D viewer

git-svn-id: trunk@35041 -
This commit is contained in:
sekelsenmat 2012-01-30 13:04:32 +00:00
parent 18eae4cea8
commit b1dc06bfe7
7 changed files with 278 additions and 0 deletions

6
.gitattributes vendored
View File

@ -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

View 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

View 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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View 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>

View 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.

Binary file not shown.