Ignore:
Timestamp:
Nov 22, 2012, 9:37:20 AM (12 years ago)
Author:
chronos
Message:
  • Modified: OpenGL methods could be disabled by compiler define opengl.
  • Fixed: Range check error in pixel assignment. Type Cardinal used instead of type Integer.
Location:
GraphicTest
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest

    • Property svn:ignore
      •  

        old new  
        77GraphicTest.rc
        88GraphicTest.lps
         9GraphicTest.dbg
  • GraphicTest/UMainForm.pas

    r338 r442  
    11unit UMainForm;
    22
    3 {$mode Delphi}{$H+}
     3{$mode delphi}{$H+}
    44
    55interface
     
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
    99  ExtCtrls, StdCtrls, DateUtils, UPlatform, LCLType, IntfGraphics, fpImage,
    10   Math, GraphType, Contnrs, LclIntf, Spin, UFastBitmap, UDrawMethod, GL,
    11   OpenGLContext;
     10  Math, GraphType, Contnrs, LclIntf, Spin, UFastBitmap, UDrawMethod
     11  {$IFDEF opengl}, GL, OpenGLContext{$ENDIF};
    1212
    1313const
     
    4646    procedure Timer1Timer(Sender: TObject);
    4747  private
     48    {$IFDEF opengl}
    4849    OpenGLControl1: TOpenGLControl;
    4950    TextureId: GLuint;
    5051    TextureData: Pointer;
     52    {$ENDIF}
    5153    MethodIndex: Integer;
    5254    SingleTestActive: Boolean;
    5355    AllTestActive: Boolean;
    5456    procedure OpenGLControl1Resize(Sender: TObject);
     57    {$IFDEF opengl}
    5558    procedure InitGL;
     59    {$ENDIF}
    5660    procedure UpdateMethodList;
    5761    procedure UpdateInterface;
     
    9397  Bitmap.SetSize(TFastBitmap(Scenes[0]).Size.X, TFastBitmap(Scenes[0]).Size.Y);
    9498
     99  {$IFDEF opengl}
    95100  OpenGLControl1 := TOpenGLControl.Create(Self);
    96101  with OpenGLControl1 do begin
     
    103108  end;
    104109  GetMem(TextureData, OpenGLControl1.Width * OpenGLControl1.Height * SizeOf(Integer));
     110  {$ENDIF}
    105111
    106112  DrawMethods := TObjectList.Create;
     
    109115    NewDrawMethod.Bitmap := Image1.Picture.Bitmap;
    110116    NewDrawMethod.PaintBox := PaintBox1;
     117    {$IFDEF opengl}
    111118    NewDrawMethod.OpenGLBitmap := TextureData;
    112119    NewDrawMethod.OpenGLControl := OpenGLControl1;
     120    {$ENDIF}
    113121    NewDrawMethod.Init;
    114122    DrawMethods.Add(NewDrawMethod);
     
    191199begin
    192200  ListViewMethods.Clear;
    193   FreeMem(TextureData, OpenGLControl1.Width * OpenGLControl1.Height);
    194   DrawMethods.Free;
    195   Scenes.Free;
    196   Bitmap.Free;
     201  {$IFDEF opengl}FreeMem(TextureData, OpenGLControl1.Width * OpenGLControl1.Height);{$ENDIF}
     202  FreeAndNil(DrawMethods);
     203  FreeAndNil(Scenes);
     204  FreeAndNil(Bitmap);
    197205end;
    198206
     
    232240procedure TMainForm.OpenGLControl1Resize(Sender: TObject);
    233241begin
     242  {$IFDEF opengl}
    234243  glViewport(0, 0, OpenGLControl1.Width, OpenGLControl1.Height);
    235 end;
    236 
     244  {$ENDIF}
     245end;
     246
     247{$IFDEF opengl}
    237248procedure TMainForm.InitGL;
    238249begin
     
    254265  glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
    255266end;
     267{$ENDIF}
    256268
    257269procedure TMainForm.UpdateMethodList;
Note: See TracChangeset for help on using the changeset viewer.