mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-10 08:28:14 +02:00
MG: added nvidia opengl support and a new opengl example from satan
git-svn-id: trunk@352 -
This commit is contained in:
parent
9c0893ff5e
commit
d5ce8010d6
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -13,10 +13,14 @@ components/codetools/linkscanner.pas svneol=native#text/pascal
|
||||
components/codetools/memcheck.pas svneol=native#text/pascal
|
||||
components/codetools/sourcechanger.pas svneol=native#text/pascal
|
||||
components/codetools/sourcelog.pas svneol=native#text/pascal
|
||||
components/gtk/gtkglarea/data/texture1.bmp -text svneol=native#image/bmp
|
||||
components/gtk/gtkglarea/data/texture2.bmp -text svneol=native#image/bmp
|
||||
components/gtk/gtkglarea/data/texture3.bmp -text svneol=native#image/bmp
|
||||
components/gtk/gtkglarea/exampleform.pp svneol=native#text/pascal
|
||||
components/gtk/gtkglarea/gtkglarea.pp svneol=native#text/pascal
|
||||
components/gtk/gtkglarea/gtkglarea_demo.pp svneol=native#text/pascal
|
||||
components/gtk/gtkglarea/gtkglarea_int.pp svneol=native#text/pascal
|
||||
components/gtk/gtkglarea/nvgl.pp svneol=native#text/pascal
|
||||
components/synedit/allunits.pp svneol=native#text/pascal
|
||||
components/synedit/syncompletion.pas svneol=native#text/pascal
|
||||
components/synedit/synedit.inc svneol=native#text/pascal
|
||||
|
@ -111,7 +111,7 @@ UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
|
||||
PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages)
|
||||
override PACKAGE_NAME=lazarus
|
||||
override PACKAGE_VERSION=0.7a
|
||||
override TARGET_UNITS+=gtkglarea_int gtkglarea exampleform gtkglarea_demo
|
||||
override TARGET_UNITS+=gtkglarea_int nvgl gtkglarea exampleform gtkglarea_demo
|
||||
override CLEAN_FILES+=gtkglarea_demo
|
||||
override DIST_ZIPNAME=lazarus.gtkglarea.$(ZIPSUFFIX)
|
||||
override COMPILER_OPTIONS+=-gl -k-lGL
|
||||
@ -1205,7 +1205,6 @@ endif
|
||||
cleartarget:
|
||||
-$(DEL) gtkglarea_demo
|
||||
all: cleartarget gtkglarea_demo$(PPUEXT)
|
||||
-$(DEL) *$(PPUEXT)
|
||||
makefile: Makefile.fpc
|
||||
-$(FPCMAKE) -w
|
||||
makefiles: makefile
|
||||
|
@ -9,7 +9,7 @@ name=lazarus
|
||||
version=0.7a
|
||||
|
||||
[target]
|
||||
units=gtkglarea_int gtkglarea exampleform gtkglarea_demo
|
||||
units=gtkglarea_int nvgl gtkglarea exampleform gtkglarea_demo
|
||||
|
||||
|
||||
[default]
|
||||
@ -36,7 +36,6 @@ cleartarget:
|
||||
-$(DEL) gtkglarea_demo
|
||||
|
||||
all: cleartarget gtkglarea_demo$(PPUEXT)
|
||||
-$(DEL) *$(PPUEXT)
|
||||
|
||||
makefile: Makefile.fpc
|
||||
-$(FPCMAKE) -w
|
||||
|
BIN
components/gtk/gtkglarea/data/texture1.bmp
Normal file
BIN
components/gtk/gtkglarea/data/texture1.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
BIN
components/gtk/gtkglarea/data/texture2.bmp
Normal file
BIN
components/gtk/gtkglarea/data/texture2.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 192 KiB |
BIN
components/gtk/gtkglarea/data/texture3.bmp
Normal file
BIN
components/gtk/gtkglarea/data/texture3.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 768 KiB |
@ -27,14 +27,34 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, GTKGlArea, Forms, LResources, Buttons, StdCtrls,
|
||||
gtkglarea_int, gtk, glib, gl;
|
||||
gtkglarea_int, gtk, glib, NVGL;
|
||||
|
||||
type
|
||||
TglTexture = class
|
||||
Width,Height: longint;
|
||||
Data : pointer;
|
||||
end;
|
||||
|
||||
type
|
||||
TExampleForm = class(TForm)
|
||||
GTKGLAreaControl1: TGTKGLAreaControl;
|
||||
ExitButton1: TButton;
|
||||
LightingButton1: TButton;
|
||||
BlendButton1: TButton;
|
||||
MoveCubeButton1: TButton;
|
||||
MoveBackgroundButton1: TButton;
|
||||
RotateZButton1: TButton;
|
||||
RotateZButton2: TButton;
|
||||
HintLabel1: TLabel;
|
||||
procedure IdleFunc(Sender: TObject; var Done: Boolean);
|
||||
procedure FormResize(Sender: TObject);
|
||||
procedure ExitButton1Click(Sender: TObject);
|
||||
procedure LightingButton1Click(Sender: TObject);
|
||||
procedure BlendButton1Click(Sender: TObject);
|
||||
procedure MoveCubeButton1Click(Sender: TObject);
|
||||
procedure MoveBackgroundButton1Click(Sender: TObject);
|
||||
procedure RotateZButton1Click(Sender: TObject);
|
||||
procedure RotateZButton2Click(Sender: TObject);
|
||||
procedure GTKGLAreaControl1Paint(Sender: TObject);
|
||||
procedure GTKGLAreaControl1Resize(Sender: TObject);
|
||||
public
|
||||
@ -42,37 +62,285 @@ type
|
||||
private
|
||||
AreaInitialized: boolean;
|
||||
end;
|
||||
|
||||
TParticle = class
|
||||
x, y, z: GLfloat;
|
||||
vx, vy, vz: GLfloat;
|
||||
life: single;
|
||||
end;
|
||||
|
||||
TParticleEngine = class
|
||||
//x, y, z: GLfloat;
|
||||
Particle: array [1..500] of TParticle;
|
||||
procedure MoveParticles;
|
||||
procedure DrawParticles;
|
||||
//procedure Init;
|
||||
procedure Start;
|
||||
//procedure Stop;
|
||||
public
|
||||
constructor Create;
|
||||
private
|
||||
procedure RespawnParticle(i: integer);
|
||||
end;
|
||||
|
||||
var AnExampleForm: TExampleForm;
|
||||
front, left1: GLuint;
|
||||
rx, ry, rz, rrx, rry, rrz: single;
|
||||
LightAmbient : array [0..3] of GLfloat;
|
||||
checked, blended, MoveCube, MoveBackground: boolean;
|
||||
textures : array [0..2] of GLuint; // Storage For 3 Textures
|
||||
MyglTextures : array [0..2] of TglTexture;
|
||||
lightamb, lightdif, lightpos, light2pos, light2dif, light3pos, light3dif, light4pos, light4dif, fogcolor: array [0..3] of GLfloat;
|
||||
ParticleEngine: TParticleEngine;
|
||||
drops: GLuint;
|
||||
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
function LoadFileToMemStream(Filename: string): TMemoryStream;
|
||||
var FileStream: TFileStream;
|
||||
begin
|
||||
Result:=TMemoryStream.Create;
|
||||
try
|
||||
FileStream:=TFileStream.Create(Filename, fmOpenRead);
|
||||
try
|
||||
Result.CopyFrom(FileStream,FileStream.Size);
|
||||
Result.Position:=0;
|
||||
finally
|
||||
FileStream.Free;
|
||||
end;
|
||||
except
|
||||
Result.Free;
|
||||
Result:=nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
function LoadglTexImage2DFromBitmapFile(Filename:string; var Image:TglTexture): boolean;
|
||||
type
|
||||
TBITMAPFILEHEADER = packed record
|
||||
bfType: Word;
|
||||
bfSize: DWORD;
|
||||
bfReserved1: Word;
|
||||
bfReserved2: Word;
|
||||
bfOffBits: DWORD;
|
||||
end;
|
||||
|
||||
BITMAPINFOHEADER = packed record
|
||||
biSize : DWORD;
|
||||
biWidth : Longint;
|
||||
biHeight : Longint;
|
||||
biPlanes : WORD;
|
||||
biBitCount : WORD;
|
||||
biCompression : DWORD;
|
||||
biSizeImage : DWORD;
|
||||
biXPelsPerMeter : Longint;
|
||||
biYPelsPerMeter : Longint;
|
||||
biClrUsed : DWORD;
|
||||
biClrImportant : DWORD;
|
||||
end;
|
||||
|
||||
RGBQUAD = packed record
|
||||
rgbBlue : BYTE;
|
||||
rgbGreen : BYTE;
|
||||
rgbRed : BYTE;
|
||||
// rgbReserved : BYTE;
|
||||
end;
|
||||
|
||||
BITMAPINFO = packed record
|
||||
bmiHeader : BITMAPINFOHEADER;
|
||||
bmiColors : array[0..0] of RGBQUAD;
|
||||
end;
|
||||
|
||||
PBITMAPINFO = ^BITMAPINFO;
|
||||
|
||||
TBitsObj = array[1..1] of byte;
|
||||
PBitsObj = ^TBitsObj;
|
||||
|
||||
TRawImage = packed record
|
||||
p:array[0..0] of byte;
|
||||
end;
|
||||
PRawImage = ^TRawImage;
|
||||
|
||||
const
|
||||
BI_RGB = 0;
|
||||
|
||||
var
|
||||
MemStream: TMemoryStream;
|
||||
BmpHead: TBitmapFileHeader;
|
||||
BmpInfo:PBitmapInfo;
|
||||
ImgSize:longint;
|
||||
InfoSize, PixelCount, i:integer;
|
||||
BitsPerPixel:integer;
|
||||
AnRGBQuad: RGBQUAD;
|
||||
begin
|
||||
Result:=false;
|
||||
MemStream:=LoadFileToMemStream(Filename);
|
||||
if MemStream=nil then exit;
|
||||
try
|
||||
if (MemStream.Read(BmpHead, sizeof(BmpHead))<sizeof(BmpHead))
|
||||
or (BmpHead.bfType <> $4D42) then begin
|
||||
writeln('Invalid windows bitmap (header)');
|
||||
exit;
|
||||
end;
|
||||
InfoSize:=BmpHead.bfOffBits-SizeOf(BmpHead);
|
||||
GetMem(BmpInfo,InfoSize);
|
||||
try
|
||||
if MemStream.Read(BmpInfo^,InfoSize)<>InfoSize then begin
|
||||
writeln('Invalid windows bitmap (info)');
|
||||
exit;
|
||||
end;
|
||||
if BmpInfo^.bmiHeader.biSize<>sizeof(BitmapInfoHeader) then begin
|
||||
writeln('OS2 bitmaps are not supported yet');
|
||||
exit;
|
||||
end;
|
||||
if BmpInfo^.bmiHeader.biCompression<>bi_RGB then begin
|
||||
writeln('RLE compression is not supported yet');
|
||||
exit;
|
||||
end;
|
||||
BitsPerPixel:=BmpInfo^.bmiHeader.biBitCount;
|
||||
if BitsPerPixel<>24 then begin
|
||||
writeln('Only truecolor bitmaps supported yet');
|
||||
exit;
|
||||
end;
|
||||
ImgSize:=BmpInfo^.bmiHeader.biSizeImage;
|
||||
if MemStream.Size-MemStream.Position<ImgSize then begin
|
||||
writeln('Invalid windows bitmap (bits)');
|
||||
exit;
|
||||
end;
|
||||
Image.Width:=BmpInfo^.bmiHeader.biWidth;
|
||||
Image.Height:=BmpInfo^.bmiHeader.biHeight;
|
||||
PixelCount:=Image.Width*Image.Height;
|
||||
GetMem(Image.Data,PixelCount * 3);
|
||||
try
|
||||
for i:=0 to PixelCount-1 do begin
|
||||
MemStream.Read(AnRGBQuad,sizeOf(RGBQuad));
|
||||
{$IFOPT R+}{$DEFINE RangeCheck}{$ENDIF}
|
||||
{$R-}
|
||||
with PRawImage(Image.Data)^ do begin
|
||||
p[i*3+0]:=AnRGBQuad.rgbRed;
|
||||
p[i*3+1]:=AnRGBQuad.rgbGreen;
|
||||
p[i*3+2]:=AnRGBQuad.rgbBlue;
|
||||
end;
|
||||
{$IFDEF RangeCheck}
|
||||
{$R+}
|
||||
{$ENDIF}
|
||||
end;
|
||||
except
|
||||
writeln('Error converting bitmap');
|
||||
FreeMem(Image.Data);
|
||||
Image.Data:=nil;
|
||||
exit;
|
||||
end;
|
||||
finally
|
||||
FreeMem(BmpInfo);
|
||||
end;
|
||||
Result:=true;
|
||||
finally
|
||||
MemStream.Free;
|
||||
end;
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
|
||||
constructor TExampleForm.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
if LazarusResources.Find(ClassName)=nil then begin
|
||||
SetBounds((Screen.Width-400) div 2,(Screen.Height-300) div 2,400,300);
|
||||
SetBounds((Screen.Width-800) div 2,(Screen.Height-600) div 2,800,600);
|
||||
Caption:='LCL Example for the gtkglarea component';
|
||||
|
||||
Application.OnIdle:=@IdleFunc;
|
||||
OnResize:=@FormResize;
|
||||
blended:=false;
|
||||
ParticleEngine:=TParticleEngine.Create;
|
||||
|
||||
ExitButton1:=TButton.Create(Self);
|
||||
with ExitButton1 do begin
|
||||
Name:='ExitButton1';
|
||||
Parent:=Self;
|
||||
SetBounds(300,10,80,25);
|
||||
SetBounds(320,10,80,25);
|
||||
Caption:='Exit';
|
||||
OnClick:=@ExitButton1Click;
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
LightingButton1:=TButton.Create(Self);
|
||||
with LightingButton1 do begin
|
||||
Name:='LightingButton1';
|
||||
Parent:=Self;
|
||||
SetBounds(220,0,80,25);
|
||||
Caption:='Lighting';
|
||||
OnClick:=@LightingButton1Click;
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
BlendButton1:=TButton.Create(Self);
|
||||
with BlendButton1 do begin
|
||||
Name:='BlendButton1';
|
||||
Parent:=Self;
|
||||
SetBounds(220,0,80,25);
|
||||
Caption:='Blending';
|
||||
OnClick:=@BlendButton1Click;
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
MoveCubeButton1:=TButton.Create(Self);
|
||||
with MoveCubeButton1 do begin
|
||||
Name:='MoveCubeButton1';
|
||||
Parent:=Self;
|
||||
SetBounds(320,10,80,25);
|
||||
Caption:='Move Cube';
|
||||
Checked:=false;
|
||||
OnClick:=@MoveCubeButton1Click;
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
MoveBackgroundButton1:=TButton.Create(Self);
|
||||
with MoveBackgroundButton1 do begin
|
||||
Name:='MoveBackgroundButton1';
|
||||
Parent:=Self;
|
||||
SetBounds(320,10,80,25);
|
||||
Caption:='Move Back';
|
||||
Checked:=false;
|
||||
OnClick:=@MoveBackgroundButton1Click;
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
RotateZButton1:=TButton.Create(Self);
|
||||
with RotateZButton1 do begin
|
||||
Name:='RotateZButton1';
|
||||
Parent:=Self;
|
||||
SetBounds(320,10,80,25);
|
||||
Caption:='P. Respawn';
|
||||
Checked:=false;
|
||||
OnClick:=@RotateZButton1Click;
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
RotateZButton2:=TButton.Create(Self);
|
||||
with RotateZButton2 do begin
|
||||
Name:='RotateZButton2';
|
||||
Parent:=Self;
|
||||
SetBounds(320,10,80,25);
|
||||
Caption:='Rotate Z -';
|
||||
Checked:=false;
|
||||
OnClick:=@RotateZButton2Click;
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
HintLabel1:=TLabel.Create(Self);
|
||||
with HintLabel1 do begin
|
||||
Name:='HintLabel1';
|
||||
Parent:=Self;
|
||||
SetBounds(10,10,280,50);
|
||||
SetBounds(0,0,280,50);
|
||||
Caption:='Demo';
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
Resize;
|
||||
|
||||
AreaInitialized:=false;
|
||||
GTKGLAreaControl1:=TGTKGLAreaControl.Create(Self);
|
||||
with GTKGLAreaControl1 do begin
|
||||
@ -83,41 +351,465 @@ begin
|
||||
OnResize:=@GTKGLAreaControl1Resize;
|
||||
Visible:=true;
|
||||
end;
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Particle Engine
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
constructor TParticleEngine.Create;
|
||||
var i: integer;
|
||||
begin
|
||||
for i:=1 to 500 do Particle[i]:=TParticle.Create;
|
||||
end;
|
||||
|
||||
procedure TParticleEngine.DrawParticles;
|
||||
var i: integer;
|
||||
begin
|
||||
//if blended then glEnable(GL_DEPTH_TEST) else glEnable(GL_BLEND);
|
||||
glBindTexture(GL_TEXTURE_2D, textures[0]);
|
||||
for i:=1 to 500 do begin
|
||||
glTranslatef(Particle[i].x, Particle[i].y, Particle[i].z);
|
||||
glCallList(drops);
|
||||
{glBegin(GL_TRIANGLE_STRIP);
|
||||
glNormal3f( 0.0, 0.0, 1.0);
|
||||
glTexCoord2f( 1.0, 1.0); glVertex3f(Particle[i].x+0.03, Particle[i].y+0.03, Particle[i].z);
|
||||
glTexCoord2f( 0.0, 1.0); glVertex3f(Particle[i].x-0.03, Particle[i].y+0.03, Particle[i].z);
|
||||
glTexCoord2f( 1.0, 0.0); glVertex3f(Particle[i].x+0.03, Particle[i].y-0.03, Particle[i].z);
|
||||
glTexCoord2f( 0.0, 0.0); glVertex3f(Particle[i].x-0.03, Particle[i].y-0.03, Particle[i].z);
|
||||
glEnd;}
|
||||
glTranslatef(-Particle[i].x, -Particle[i].y, -Particle[i].z);
|
||||
end;
|
||||
//if blended then glDisable(GL_DEPTH_TEST) else glDisable(GL_BLEND);
|
||||
end;
|
||||
|
||||
procedure TParticleEngine.RespawnParticle(i: integer);
|
||||
begin
|
||||
Particle[i].x:=0;
|
||||
Particle[i].y:=0;
|
||||
Particle[i].z:=0;
|
||||
Particle[i].vx:=-0.0025+random(1000)/200000;
|
||||
Particle[i].vy:=0.02+random(750)/100000;
|
||||
Particle[i].vz:=-0.0025+random(1000)/200000;
|
||||
Particle[i].life:=random(10000)/2500+0.75;
|
||||
end;
|
||||
|
||||
procedure TParticleEngine.MoveParticles;
|
||||
var i: integer;
|
||||
begin
|
||||
for i:=1 to 500 do begin
|
||||
if Particle[i].life>0 then begin
|
||||
Particle[i].life:=Particle[i].life-0.01;
|
||||
Particle[i].x:=Particle[i].x+Particle[i].vx;
|
||||
|
||||
Particle[i].vy:=Particle[i].vy-0.0002; // gravity
|
||||
Particle[i].y:=Particle[i].y+Particle[i].vy;
|
||||
|
||||
Particle[i].z:=Particle[i].z+Particle[i].vz;
|
||||
end else begin
|
||||
RespawnParticle(i);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TParticleEngine.Start;
|
||||
var i: integer;
|
||||
begin
|
||||
for i:=1 to 500 do begin
|
||||
RespawnParticle(i);
|
||||
end;
|
||||
end;
|
||||
|
||||
{procedure TParticleEngine.Stop;
|
||||
var i: integer;
|
||||
begin
|
||||
for i:=1 to 1000 do begin
|
||||
Particle[i].life:=0;
|
||||
end;
|
||||
end;}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
procedure TExampleForm.IdleFunc(Sender: TObject; var Done: Boolean);
|
||||
begin
|
||||
GTKGLAreaControl1Paint(Self);
|
||||
Done:=false; // don't wait, come back as fast as possible
|
||||
end;
|
||||
|
||||
procedure TExampleForm.LightingButton1Click(Sender: TObject);
|
||||
begin
|
||||
if glIsEnabled(GL_LIGHTING)=GL_TRUE then glDisable(GL_LIGHTING) else glEnable(GL_LIGHTING);
|
||||
GTKGLAreaControl1Paint(Self);
|
||||
end;
|
||||
|
||||
procedure TExampleForm.BlendButton1Click(Sender: TObject);
|
||||
begin
|
||||
if glIsEnabled(GL_BLEND)=GL_TRUE then begin
|
||||
glDisable(GL_BLEND);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
blended:=true;
|
||||
end
|
||||
else begin
|
||||
glEnable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
blended:=false;
|
||||
end;
|
||||
GTKGLAreaControl1Paint(Self);
|
||||
end;
|
||||
|
||||
procedure TExampleForm.MoveCubeButton1Click(Sender: TObject);
|
||||
begin
|
||||
MoveCube:=not MoveCube;
|
||||
GTKGLAreaControl1Paint(Self);
|
||||
end;
|
||||
|
||||
procedure TExampleForm.MoveBackgroundButton1Click(Sender: TObject);
|
||||
begin
|
||||
MoveBackground:=not MoveBackground;
|
||||
GTKGLAreaControl1Paint(Self);
|
||||
end;
|
||||
|
||||
procedure TExampleForm.RotateZButton1Click(Sender: TObject);
|
||||
begin
|
||||
ParticleEngine.Start;
|
||||
end;
|
||||
|
||||
procedure TExampleForm.RotateZButton2Click(Sender: TObject);
|
||||
var i: integer;
|
||||
begin
|
||||
for i:=1 to 300 do begin
|
||||
rz:=rz-0.05;
|
||||
GTKGLAreaControl1Paint(Self);
|
||||
glFlush;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TExampleForm.FormResize(Sender: TObject);
|
||||
begin
|
||||
//GTKGLAreaControl1.Width:=AnExampleForm.Width-100;
|
||||
//GTKGLAreaControl1.Height:=AnExampleForm.Height-100;
|
||||
if GTKGLAreaControl1<>nil then
|
||||
GTKGLAreaControl1.SetBounds(10, 30, Width-120, Height-40);
|
||||
ExitButton1.SetBounds(Width-90, 5, 80, 25);
|
||||
LightingButton1.SetBounds(Width-90, 50, 80, 25);
|
||||
BlendButton1.SetBounds(Width-90, 80, 80, 25);
|
||||
MoveCubeButton1.SetBounds(Width-90, 115, 80, 25);
|
||||
MoveBackgroundButton1.SetBounds(Width-90, 145, 80, 25);
|
||||
RotateZButton1.SetBounds(Width-90, 180, 80, 25);
|
||||
RotateZButton2.SetBounds(Width-90, 215, 80, 25);
|
||||
HintLabel1.SetBounds(10, 0, 80, 25);
|
||||
//writeln('Form: ',ExitButton1.Width);
|
||||
//writeln('GTKGLarea: ',GTKGLareaControl1.Height);
|
||||
end;
|
||||
|
||||
procedure TExampleForm.ExitButton1Click(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TExampleForm.GTKGLAreaControl1Paint(Sender: TObject);
|
||||
|
||||
procedure myInit;
|
||||
begin
|
||||
{init rotation variables}
|
||||
//xrot:=0; yrot:=0; zrot:=0;
|
||||
//xrotspeed:=0; yrotspeed:=0; zrotspeed:=0;
|
||||
{init lighting variables}
|
||||
{ambient color}
|
||||
lightamb[0]:=0.6;
|
||||
lightamb[1]:=0.6;
|
||||
lightamb[2]:=0.6;
|
||||
lightamb[3]:=1.0;
|
||||
{diffuse color}
|
||||
lightdif[0]:=0.8;
|
||||
lightdif[1]:=0.0;
|
||||
lightdif[2]:=0.0;
|
||||
lightdif[3]:=1.0;
|
||||
{diffuse position}
|
||||
lightpos[0]:=0.0;
|
||||
lightpos[1]:=0.0;
|
||||
lightpos[2]:=3.0;
|
||||
lightpos[3]:=1.0;
|
||||
{diffuse 2 color}
|
||||
light2dif[0]:=0.0;
|
||||
light2dif[1]:=0.8;
|
||||
light2dif[2]:=0.0;
|
||||
light2dif[3]:=1.0;
|
||||
{diffuse 2 position}
|
||||
light2pos[0]:=3.0;
|
||||
light2pos[1]:=0.0;
|
||||
light2pos[2]:=3.0;
|
||||
light2pos[3]:=1.0;
|
||||
{diffuse 3 color}
|
||||
light3dif[0]:=0.0;
|
||||
light3dif[1]:=0.0;
|
||||
light3dif[2]:=0.8;
|
||||
light3dif[3]:=1.0;
|
||||
{diffuse 3 position}
|
||||
light3pos[0]:=-3.0;
|
||||
light3pos[1]:=0.0;
|
||||
light3pos[2]:=0.0;
|
||||
light3pos[3]:=1.0;
|
||||
{fog color}
|
||||
|
||||
fogcolor[0]:=0.5;
|
||||
fogcolor[1]:=0.5;
|
||||
fogcolor[2]:=0.5;
|
||||
fogcolor[3]:=1.0;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
procedure InitGL;cdecl;
|
||||
var i: integer;
|
||||
begin
|
||||
{setting lighting conditions}
|
||||
glLightfv(GL_LIGHT0,GL_AMBIENT,lightamb);
|
||||
glLightfv(GL_LIGHT1,GL_AMBIENT,lightamb);
|
||||
glLightfv(GL_LIGHT2,GL_DIFFUSE,lightdif);
|
||||
glLightfv(GL_LIGHT2,GL_POSITION,lightpos);
|
||||
glLightfv(GL_LIGHT3,GL_DIFFUSE,light2dif);
|
||||
glLightfv(GL_LIGHT3,GL_POSITION,light2pos);
|
||||
glLightfv(GL_LIGHT4,GL_POSITION,light3pos);
|
||||
glLightfv(GL_LIGHT4,GL_DIFFUSE,light3dif);
|
||||
glEnable(GL_LIGHT0);
|
||||
glEnable(GL_LIGHT1);
|
||||
glEnable(GL_LIGHT2);
|
||||
glEnable(GL_LIGHT3);
|
||||
glEnable(GL_LIGHT4);
|
||||
//glEnable(GL_LIGHTING);
|
||||
{}
|
||||
for i:=0 to 2 do begin
|
||||
Textures[i]:=0;
|
||||
MyglTextures[i]:=TglTexture.Create;
|
||||
end;
|
||||
{loading the texture and setting its parameters}
|
||||
if not LoadglTexImage2DFromBitmapFile('data/texture1.bmp',MyglTextures[0]) then begin
|
||||
Halt;
|
||||
end;
|
||||
if not LoadglTexImage2DFromBitmapFile('data/texture2.bmp',MyglTextures[1]) then begin
|
||||
Halt;
|
||||
end;
|
||||
if not LoadglTexImage2DFromBitmapFile('data/texture3.bmp',MyglTextures[2]) then begin
|
||||
Halt;
|
||||
end;
|
||||
glGenTextures(3, textures[0]);
|
||||
for i:=0 to 2 do begin
|
||||
glBindTexture(GL_TEXTURE_2D, Textures[i]);
|
||||
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
|
||||
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
|
||||
glTexImage2D(GL_TEXTURE_2D,0,3,MyglTextures[i].Width,MyglTextures[i].Height,0
|
||||
,GL_RGB,GL_UNSIGNED_BYTE,MyglTextures[i].Data^);
|
||||
end;
|
||||
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
|
||||
{instead of GL_MODULATE you can try GL_DECAL or GL_BLEND}
|
||||
glEnable(GL_TEXTURE_2D); // enables 2d textures
|
||||
glClearColor(0.0,0.0,0.0,1.0); // sets background color
|
||||
glClearDepth(1.0);
|
||||
glDepthFunc(GL_LEQUAL); // the type of depth test to do
|
||||
glEnable(GL_DEPTH_TEST); // enables depth testing
|
||||
glShadeModel(GL_SMOOTH); // enables smooth color shading
|
||||
{blending}
|
||||
//glEnable(GL_BLEND);
|
||||
glColor4f(1.0,1.0,1.0,0.5); // Full Brightness, 50% Alpha ( NEW )
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
//glDisable(GL_DEPTH_TEST);
|
||||
glLightModelf(GL_LIGHT_MODEL_AMBIENT, 1.0);
|
||||
{fog}
|
||||
glFogi(GL_FOG_MODE,GL_LINEAR); // Fog Mode
|
||||
glFogfv(GL_FOG_COLOR,fogColor); // Set Fog Color
|
||||
glFogf(GL_FOG_DENSITY,0.2); // How Dense Will The Fog Be
|
||||
glHint(GL_FOG_HINT,GL_NICEST); // Fog Hint Value
|
||||
glFogf(GL_FOG_START,1.0); // Fog Start Depth
|
||||
glFogf(GL_FOG_END,2.5); // Fog End Depth
|
||||
//glEnable(GL_FOG); // Enables GL_FOG
|
||||
{}
|
||||
glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
|
||||
glHint(GL_POLYGON_SMOOTH_HINT,GL_NICEST);
|
||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);
|
||||
//glEnable(GL_LIGHTING);
|
||||
|
||||
// creating display list for particles
|
||||
drops:=glGenLists(1);
|
||||
glNewList(drops, GL_COMPILE);
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glNormal3f( 0.0, 0.0, 1.0);
|
||||
glTexCoord2f( 1.0, 1.0); glVertex3f(+0.025, +0.025, 0);
|
||||
glTexCoord2f( 0.0, 1.0); glVertex3f(-0.025, +0.025, 0);
|
||||
glTexCoord2f( 1.0, 0.0); glVertex3f(+0.025, -0.025, 0);
|
||||
glTexCoord2f( 0.0, 0.0); glVertex3f(-0.025, -0.025, 0);
|
||||
glEnd;
|
||||
glEndList;
|
||||
|
||||
end;
|
||||
|
||||
begin
|
||||
if (gint(True) = gtk_gl_area_make_current(GTKGLAreaControl1.Widget)) then
|
||||
begin
|
||||
if not AreaInitialized then begin
|
||||
glViewport(0,0, PGtkWidget(GTKGLAreaControl1.Widget)^.allocation.width,
|
||||
PGtkWidget(GTKGLAreaControl1.Widget)^.allocation.height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum( -20.0, 20.0, -20.0, 20.0, 1.0, 145.0 );
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0, 0, -5.5);
|
||||
myInit;
|
||||
InitGL;
|
||||
glMatrixMode (GL_PROJECTION); { prepare for and then }
|
||||
glLoadIdentity (); { define the projection }
|
||||
glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0); { transformation }
|
||||
glMatrixMode (GL_MODELVIEW); { back to modelview matrix }
|
||||
glViewport (0, 0, GTKGLAreaControl1.Width, GTKGLAreaControl1.Height); { define the viewport }
|
||||
AreaInitialized:=true;
|
||||
end;
|
||||
|
||||
ParticleEngine.MoveParticles;
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
|
||||
glLoadIdentity; { clear the matrix }
|
||||
glTranslatef (0.0, 0.0,-2.5); { viewing transformation }
|
||||
glScalef (1.0, 1.0, 1.0); { modeling transformation }
|
||||
{rotate}
|
||||
|
||||
glClearColor(0,0,0,1);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glColor3f(1,0,1);
|
||||
glBegin(GL_TRIANGLES);
|
||||
glVertex3f(10,10,-2);
|
||||
glColor3f(0,1,1);
|
||||
glVertex3f(10,90,-1);
|
||||
glColor3f(0,1,0);
|
||||
glVertex3f(90,90,-2);
|
||||
glEnd();
|
||||
//yrot:=yrot+yrotspeed;
|
||||
//zrot:=zrot+zrotspeed;
|
||||
|
||||
glPushMatrix;
|
||||
|
||||
if MoveBackground then begin
|
||||
rrx:=rrx-0.5;
|
||||
rry:=rry-0.25;
|
||||
rrz:=rrz-0.4;
|
||||
end;
|
||||
|
||||
glRotatef(rrx,1.0,0.0,0.0);
|
||||
glRotatef(rry,0.0,1.0,0.0);
|
||||
glRotatef(rrz,0.0,0.0,1.0);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, textures[2]);
|
||||
glBegin(GL_QUADS);
|
||||
glNormal3f( 0.0, 0.0, 1.0);
|
||||
glTexCoord2f( 1.0, 1.0); glVertex3f( 2.5, 2.5, 2.5);
|
||||
glTexCoord2f( 0.0, 1.0); glVertex3f(-2.5, 2.5, 2.5);
|
||||
glTexCoord2f( 0.0, 0.0); glVertex3f(-2.5,-2.5, 2.5);
|
||||
glTexCoord2f( 1.0, 0.0); glVertex3f( 2.5,-2.5, 2.5);
|
||||
|
||||
glNormal3f( 0.0, 0.0,-1.0);
|
||||
glTexCoord2f( 0.0, 1.0); glVertex3f( 2.5, 2.5,-2.5);
|
||||
glTexCoord2f( 0.0, 0.0); glVertex3f( 2.5,-2.5,-2.5);
|
||||
glTexCoord2f( 1.0, 0.0); glVertex3f(-2.5,-2.5,-2.5);
|
||||
glTexCoord2f( 1.0, 1.0); glVertex3f(-2.5, 2.5,-2.5);
|
||||
|
||||
{Left Face}
|
||||
glNormal3f(-1.0, 0.0, 0.0);
|
||||
glTexCoord2f( 1.0, 1.0); glVertex3f(-2.5, 2.5, 2.5);
|
||||
glTexCoord2f( 0.0, 1.0); glVertex3f(-2.5, 2.5,-2.5);
|
||||
glTexCoord2f( 0.0, 0.0); glVertex3f(-2.5,-2.5,-2.5);
|
||||
glTexCoord2f( 1.0, 0.0); glVertex3f(-2.5,-2.5, 2.5);
|
||||
{Right Face}
|
||||
glNormal3f( 1.0, 0.0, 0.0);
|
||||
glTexCoord2f( 1.0, 1.0); glVertex3f( 2.5, 2.5,-2.5);
|
||||
glTexCoord2f( 0.0, 1.0); glVertex3f( 2.5, 2.5, 2.5);
|
||||
glTexCoord2f( 0.0, 0.0); glVertex3f( 2.5,-2.5, 2.5);
|
||||
glTexCoord2f( 1.0, 0.0); glVertex3f( 2.5,-2.5,-2.5);
|
||||
|
||||
{Top Face}
|
||||
glNormal3f( 0.0, 1.0, 0.0);
|
||||
glTexCoord2f( 1.0, 1.0); glVertex3f( 2.5, 2.5,-2.5);
|
||||
glTexCoord2f( 0.0, 1.0); glVertex3f(-2.5, 2.5,-2.5);
|
||||
glTexCoord2f( 0.0, 0.0); glVertex3f(-2.5, 2.5, 2.5);
|
||||
glTexCoord2f( 1.0, 0.0); glVertex3f( 2.5, 2.5, 2.5);
|
||||
{Bottom Face}
|
||||
glNormal3f( 0.0,-1.0, 0.0);
|
||||
glTexCoord2f( 1.0, 1.0); glVertex3f(-2.5,-2.5,-2.5);
|
||||
glTexCoord2f( 0.0, 1.0); glVertex3f( 2.5,-2.5,-2.5);
|
||||
glTexCoord2f( 0.0, 0.0); glVertex3f( 2.5,-2.5, 2.5);
|
||||
glTexCoord2f( 1.0, 0.0); glVertex3f(-2.5,-2.5, 2.5);
|
||||
|
||||
glEnd;
|
||||
|
||||
glRotatef(-rrz,0.0,0.0,1.0);
|
||||
glRotatef(-rry,0.0,1.0,0.0);
|
||||
glRotatef(-rrx,1.0,0.0,0.0);
|
||||
|
||||
glPushMatrix;
|
||||
|
||||
if MoveCube then begin
|
||||
rx:=rx+0.5;
|
||||
ry:=ry+0.25;
|
||||
rz:=rz+0.8;
|
||||
end;
|
||||
|
||||
glRotatef(rx,1.0,0.0,0.0);
|
||||
glRotatef(ry,0.0,1.0,0.0);
|
||||
glRotatef(rz,0.0,0.0,1.0);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, textures[1]);
|
||||
glBegin(GL_QUADS);
|
||||
{Front Face}
|
||||
glNormal3f( 0.0, 0.0, 1.0);
|
||||
glTexCoord2f( 1.0, 1.0); glVertex3f( 0.5, 0.5, 0.5);
|
||||
glTexCoord2f( 0.0, 1.0); glVertex3f(-0.5, 0.5, 0.5);
|
||||
glTexCoord2f( 0.0, 0.0); glVertex3f(-0.5,-0.5, 0.5);
|
||||
glTexCoord2f( 1.0, 0.0); glVertex3f( 0.5,-0.5, 0.5);
|
||||
|
||||
{Back Face}
|
||||
glNormal3f( 0.0, 0.0,-1.0);
|
||||
glTexCoord2f( 0.0, 1.0); glVertex3f( 0.5, 0.5,-0.5);
|
||||
glTexCoord2f( 0.0, 0.0); glVertex3f( 0.5,-0.5,-0.5);
|
||||
glTexCoord2f( 1.0, 0.0); glVertex3f(-0.5,-0.5,-0.5);
|
||||
glTexCoord2f( 1.0, 1.0); glVertex3f(-0.5, 0.5,-0.5);
|
||||
glEnd;
|
||||
glBindTexture(GL_TEXTURE_2D, textures[1]);
|
||||
glBegin(GL_QUADS);
|
||||
{Left Face}
|
||||
glNormal3f(-1.0, 0.0, 0.0);
|
||||
glTexCoord2f( 1.0, 1.0); glVertex3f(-0.5, 0.5, 0.5);
|
||||
glTexCoord2f( 0.0, 1.0); glVertex3f(-0.5, 0.5,-0.5);
|
||||
glTexCoord2f( 0.0, 0.0); glVertex3f(-0.5,-0.5,-0.5);
|
||||
glTexCoord2f( 1.0, 0.0); glVertex3f(-0.5,-0.5, 0.5);
|
||||
{Right Face}
|
||||
glNormal3f( 1.0, 0.0, 0.0);
|
||||
glTexCoord2f( 1.0, 1.0); glVertex3f( 0.5, 0.5,-0.5);
|
||||
glTexCoord2f( 0.0, 1.0); glVertex3f( 0.5, 0.5, 0.5);
|
||||
glTexCoord2f( 0.0, 0.0); glVertex3f( 0.5,-0.5, 0.5);
|
||||
glTexCoord2f( 1.0, 0.0); glVertex3f( 0.5,-0.5,-0.5);
|
||||
glEnd;
|
||||
glBindTexture(GL_TEXTURE_2D, textures[2]);
|
||||
glBegin(GL_QUADS);
|
||||
{Top Face}
|
||||
glNormal3f( 0.0, 1.0, 0.0);
|
||||
glTexCoord2f( 1.0, 1.0); glVertex3f( 0.5, 0.5,-0.5);
|
||||
glTexCoord2f( 0.0, 1.0); glVertex3f(-0.5, 0.5,-0.5);
|
||||
glTexCoord2f( 0.0, 0.0); glVertex3f(-0.5, 0.5, 0.5);
|
||||
glTexCoord2f( 1.0, 0.0); glVertex3f( 0.5, 0.5, 0.5);
|
||||
{Bottom Face}
|
||||
glNormal3f( 0.0,-1.0, 0.0);
|
||||
glTexCoord2f( 1.0, 1.0); glVertex3f(-0.5,-0.5,-0.5);
|
||||
glTexCoord2f( 0.0, 1.0); glVertex3f( 0.5,-0.5,-0.5);
|
||||
glTexCoord2f( 0.0, 0.0); glVertex3f( 0.5,-0.5, 0.5);
|
||||
glTexCoord2f( 1.0, 0.0); glVertex3f(-0.5,-0.5, 0.5);
|
||||
glEnd;
|
||||
|
||||
// draw particles here for dynamic particle system
|
||||
|
||||
//ParticleEngine.DrawParticles;
|
||||
|
||||
glRotatef(-rz,0.0,0.0,1.0);
|
||||
glRotatef(-ry,0.0,1.0,0.0);
|
||||
glRotatef(-rx,1.0,0.0,0.0);
|
||||
|
||||
glpushMatrix;
|
||||
|
||||
// draw particles here for static particle system
|
||||
|
||||
ParticleEngine.DrawParticles;
|
||||
|
||||
glPopMatrix;
|
||||
glPopMatrix;
|
||||
glPopMatrix;
|
||||
glFlush;
|
||||
|
||||
// Swap backbuffer to front
|
||||
gtk_gl_area_swap_buffers(PGtkGLArea(GTKGLAreaControl1.Widget));
|
||||
end;
|
||||
@ -126,8 +818,10 @@ end;
|
||||
procedure TExampleForm.GTKGLAreaControl1Resize(Sender: TObject);
|
||||
begin
|
||||
if (gint(True) = gtk_gl_area_make_current(GTKGLAreaControl1.widget)) then
|
||||
glViewport(0, 0, PGtkWidget(GTKGLAreaControl1.Widget)^.allocation.width,
|
||||
PGtkWidget(GTKGLAreaControl1.Widget)^.allocation.height);
|
||||
end;
|
||||
|
||||
{glViewport(0, 0, PGtkWidget(GTKGLAreaControl1.Widget)^.allocation.width,
|
||||
PGtkWidget(GTKGLAreaControl1.Widget)^.allocation.height);}
|
||||
glViewport (0, 0, GTKGLAreaControl1.Width, GTKGLAreaControl1.Height);
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
3145
components/gtk/gtkglarea/nvgl.pp
Normal file
3145
components/gtk/gtkglarea/nvgl.pp
Normal file
File diff suppressed because it is too large
Load Diff
31
ide/main.pp
31
ide/main.pp
@ -266,7 +266,6 @@ type
|
||||
function DoBackupFile(const Filename:string;
|
||||
IsPartOfProject:boolean): TModalResult;
|
||||
procedure UpdateCaption;
|
||||
procedure UpdateMainUnitSrcEdit;
|
||||
procedure DoBringToFrontFormOrUnit;
|
||||
procedure OnMacroSubstitution(TheMacro: TTransferMacro; var s:string;
|
||||
var Handled, Abort: boolean);
|
||||
@ -1625,7 +1624,7 @@ end;
|
||||
procedure TMainIDE.mnuProjectOptionsClicked(Sender : TObject);
|
||||
begin
|
||||
if ShowProjectOptionsDialog(Project)=mrOk then begin
|
||||
UpdateMainUnitSrcEdit;
|
||||
// UpdateMainUnitSrcEdit;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1812,7 +1811,7 @@ CheckHeap('TMainIDE.DoNewEditorUnit L '+IntToStr(GetMem_Cnt));
|
||||
PropertyEditorHook1.LookupRoot := TForm(CInterface.Control);
|
||||
TDesigner(TempForm.Designer).SelectOnlyThisComponent(TempForm);
|
||||
end;
|
||||
UpdateMainUnitSrcEdit;
|
||||
//UpdateMainUnitSrcEdit;
|
||||
|
||||
FCodeLastActivated:=not (NewUnitType in [nuForm]);
|
||||
writeln('TMainIDE.DoNewUnit end');
|
||||
@ -2155,7 +2154,7 @@ writeln('TMainIDE.DoCloseEditorUnit A PageIndex=',PageIndex);
|
||||
i:=Project.IndexOf(ActiveUnitInfo);
|
||||
if (i<>Project.MainUnit) and (ActiveUnitInfo.Source.IsVirtual) then begin
|
||||
Project.RemoveUnit(i);
|
||||
UpdateMainUnitSrcEdit;
|
||||
//UpdateMainUnitSrcEdit;
|
||||
end;
|
||||
writeln('TMainIDE.DoCloseEditorUnit end');
|
||||
Result:=mrOk;
|
||||
@ -2737,7 +2736,7 @@ writeln('TMainIDE.DoSaveProject A SaveAs=',SaveAs,' SaveToTestDir=',SaveToTestDi
|
||||
if MainUnitInfo<>nil then MainUnitInfo.Modified:=false;
|
||||
if MainUnitSrcEdit<>nil then MainUnitSrcEdit.Modified:=false;
|
||||
end;
|
||||
UpdateMainUnitSrcEdit;
|
||||
//UpdateMainUnitSrcEdit;
|
||||
UpdateCaption;
|
||||
end;
|
||||
|
||||
@ -3028,7 +3027,7 @@ Begin
|
||||
if (AnUnitInfo.FormName<>'') then
|
||||
Project.RemoveCreateFormFromProjectFile(
|
||||
'T'+AnUnitInfo.FormName,AnUnitInfo.FormName);
|
||||
UpdateMainUnitSrcEdit;
|
||||
//UpdateMainUnitSrcEdit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -3419,23 +3418,6 @@ begin
|
||||
Caption:=NewCaption;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.UpdateMainUnitSrcEdit;
|
||||
var MainUnitSrcEdit: TSourceEditor;
|
||||
MainUnitInfo: TUnitInfo;
|
||||
CurText: string;
|
||||
begin
|
||||
if Project.MainUnit>=0 then begin
|
||||
MainUnitInfo:=Project.Units[Project.MainUnit];
|
||||
if MainUnitInfo.Loaded then begin
|
||||
MainUnitSrcEdit:=SourceNoteBook.FindSourceEditorWithPageIndex(
|
||||
MainUnitInfo.EditorIndex);
|
||||
CurText:=MainUnitSrcEdit.Source.Text;
|
||||
if CurText<>MainUnitInfo.Source.Source then
|
||||
MainUnitSrcEdit.Source.Text:=MainUnitInfo.Source.Source;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoBringToFrontFormOrUnit;
|
||||
var AForm: TCustomForm;
|
||||
ActiveUnitInfo: TUnitInfo;
|
||||
@ -4022,6 +4004,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.122 2001/10/16 14:19:10 lazarus
|
||||
MG: added nvidia opengl support and a new opengl example from satan
|
||||
|
||||
Revision 1.121 2001/10/15 17:41:30 lazarus
|
||||
MG: fixed splashform showing
|
||||
|
||||
|
@ -26,6 +26,7 @@ begin
|
||||
Inherited Create(AOwner);
|
||||
{set the component style to csButton}
|
||||
fCompStyle := csButton;
|
||||
ControlStyle:=ControlStyle-[csClickEvents];
|
||||
{set default alignment}
|
||||
Align := alNone;
|
||||
{setup default sizes}
|
||||
@ -124,8 +125,8 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.4 2001/10/16 10:51:10 lazarus
|
||||
MG: added clicked event to TButton, MessageDialog reacts to return key
|
||||
Revision 1.5 2001/10/16 14:19:13 lazarus
|
||||
MG: added nvidia opengl support and a new opengl example from satan
|
||||
|
||||
Revision 1.3 2001/06/06 12:30:41 lazarus
|
||||
MG: bugfixes
|
||||
|
@ -128,7 +128,7 @@ end;
|
||||
|
||||
Procedure TControl.LMCaptureChanged(Var Message: TLMessage);
|
||||
Begin
|
||||
Writeln('[LMCaptureChanged for '+classname+']');
|
||||
//Writeln('[LMCaptureChanged for '+classname+']');
|
||||
End;
|
||||
|
||||
|
||||
@ -1326,6 +1326,9 @@ end;
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.26 2001/10/16 14:19:13 lazarus
|
||||
MG: added nvidia opengl support and a new opengl example from satan
|
||||
|
||||
Revision 1.25 2001/10/07 07:28:33 lazarus
|
||||
MG: fixed setpixel and TCustomForm.OnResize event
|
||||
|
||||
|
@ -465,7 +465,7 @@ function gtkclickedCB( widget: PGtkWidget; data: gPointer) : GBoolean; cdecl;
|
||||
var
|
||||
Mess : TLMessage;
|
||||
begin
|
||||
writeln('[gtkclickedCB] ',TObject(Data).ClassName);
|
||||
//writeln('[gtkclickedCB] ',TObject(Data).ClassName);
|
||||
EventTrace('clicked', data);
|
||||
Assert(False, Format('Trace:OBSOLETE: [gtkclickedCB] ', []));
|
||||
Mess.Msg := LM_CLICKED;
|
||||
@ -1156,8 +1156,8 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.37 2001/10/16 10:51:10 lazarus
|
||||
MG: added clicked event to TButton, MessageDialog reacts to return key
|
||||
Revision 1.38 2001/10/16 14:19:13 lazarus
|
||||
MG: added nvidia opengl support and a new opengl example from satan
|
||||
|
||||
Revision 1.35 2001/10/09 09:46:58 lazarus
|
||||
MG: added codetools, fixed synedit unindent, fixed MCatureHandle
|
||||
|
@ -2991,9 +2991,9 @@ begin
|
||||
|
||||
if MCaptureHandle <> 0
|
||||
then begin
|
||||
WriteLN(Format('[TgtkObject.SetCapture] Current widget 0x%p', [gtk_grab_get_current]));
|
||||
//WriteLN(Format('[TgtkObject.SetCapture] Current widget 0x%p', [gtk_grab_get_current]));
|
||||
gtk_grab_add(Pointer(MCaptureHandle));
|
||||
WriteLN(Format('[TgtkObject.SetCapture] handle: 0x%p gtk: 0x%p', [Pointer(MCaptureHandle), gtk_grab_get_current]));
|
||||
//WriteLN(Format('[TgtkObject.SetCapture] handle: 0x%p gtk: 0x%p', [Pointer(MCaptureHandle), gtk_grab_get_current]));
|
||||
|
||||
|
||||
// gtk_grab_add(pGTKWidget(FCaptureHandle));
|
||||
@ -3604,8 +3604,8 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.43 2001/10/16 10:51:10 lazarus
|
||||
MG: added clicked event to TButton, MessageDialog reacts to return key
|
||||
Revision 1.44 2001/10/16 14:19:13 lazarus
|
||||
MG: added nvidia opengl support and a new opengl example from satan
|
||||
|
||||
Revision 1.41 2001/09/30 08:34:52 lazarus
|
||||
MG: fixed mem leaks and fixed range check errors
|
||||
|
Loading…
Reference in New Issue
Block a user