Changeset 211 for GraphicTest


Ignore:
Timestamp:
Mar 20, 2011, 12:23:08 PM (13 years ago)
Author:
george
Message:
  • Added: OpenGL method to display bitmap as texture on top of 2D rectangle.
Location:
GraphicTest
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest/GraphicTest.lpi

    r210 r211  
    3030      </local>
    3131    </RunParams>
    32     <RequiredPackages Count="2">
     32    <RequiredPackages Count="3">
    3333      <Item1>
     34        <PackageName Value="lazopenglcontext"/>
     35      </Item1>
     36      <Item2>
    3437        <PackageName Value="LCLBase"/>
    3538        <MinVersion Major="1" Release="1" Valid="True"/>
    36       </Item1>
    37       <Item2>
     39      </Item2>
     40      <Item3>
    3841        <PackageName Value="LCL"/>
    39       </Item2>
     42      </Item3>
    4043    </RequiredPackages>
    41     <Units Count="36">
     44    <Units Count="47">
    4245      <Unit0>
    4346        <Filename Value="GraphicTest.lpr"/>
    4447        <IsPartOfProject Value="True"/>
    4548        <UnitName Value="GraphicTest"/>
     49        <EditorIndex Value="4"/>
    4650        <WindowIndex Value="0"/>
    4751        <TopLine Value="1"/>
    48         <CursorPos X="17" Y="3"/>
    49         <UsageCount Value="37"/>
     52        <CursorPos X="30" Y="8"/>
     53        <UsageCount Value="43"/>
     54        <Loaded Value="True"/>
    5055      </Unit0>
    5156      <Unit1>
     
    5762        <EditorIndex Value="0"/>
    5863        <WindowIndex Value="0"/>
    59         <TopLine Value="109"/>
    60         <CursorPos X="23" Y="126"/>
    61         <UsageCount Value="37"/>
     64        <TopLine Value="67"/>
     65        <CursorPos X="29" Y="71"/>
     66        <UsageCount Value="43"/>
    6267        <Loaded Value="True"/>
    6368        <LoadedDesigner Value="True"/>
     
    6974        <TopLine Value="1"/>
    7075        <CursorPos X="42" Y="22"/>
    71         <UsageCount Value="17"/>
     76        <UsageCount Value="16"/>
    7277      </Unit2>
    7378      <Unit3>
     
    7580        <IsPartOfProject Value="True"/>
    7681        <UnitName Value="UPlatform"/>
    77         <EditorIndex Value="7"/>
     82        <EditorIndex Value="13"/>
    7883        <WindowIndex Value="0"/>
    7984        <TopLine Value="43"/>
    8085        <CursorPos X="1" Y="1"/>
    81         <UsageCount Value="37"/>
     86        <UsageCount Value="43"/>
    8287        <Loaded Value="True"/>
    8388      </Unit3>
     
    8893        <TopLine Value="244"/>
    8994        <CursorPos X="49" Y="262"/>
    90         <UsageCount Value="11"/>
     95        <UsageCount Value="10"/>
    9196      </Unit4>
    9297      <Unit5>
     
    96101        <TopLine Value="121"/>
    97102        <CursorPos X="57" Y="142"/>
    98         <UsageCount Value="11"/>
     103        <UsageCount Value="10"/>
    99104      </Unit5>
    100105      <Unit6>
     
    103108        <TopLine Value="85"/>
    104109        <CursorPos X="10" Y="102"/>
    105         <UsageCount Value="11"/>
     110        <UsageCount Value="10"/>
    106111      </Unit6>
    107112      <Unit7>
     
    110115        <TopLine Value="153"/>
    111116        <CursorPos X="1" Y="160"/>
    112         <UsageCount Value="11"/>
     117        <UsageCount Value="10"/>
    113118      </Unit7>
    114119      <Unit8>
     
    118123        <TopLine Value="1282"/>
    119124        <CursorPos X="15" Y="1299"/>
    120         <UsageCount Value="11"/>
     125        <UsageCount Value="10"/>
    121126      </Unit8>
    122127      <Unit9>
     
    125130        <TopLine Value="546"/>
    126131        <CursorPos X="11" Y="553"/>
    127         <UsageCount Value="11"/>
     132        <UsageCount Value="10"/>
    128133      </Unit9>
    129134      <Unit10>
     
    132137        <TopLine Value="389"/>
    133138        <CursorPos X="1" Y="411"/>
    134         <UsageCount Value="8"/>
     139        <UsageCount Value="7"/>
    135140      </Unit10>
    136141      <Unit11>
     
    139144        <TopLine Value="444"/>
    140145        <CursorPos X="1" Y="461"/>
    141         <UsageCount Value="11"/>
     146        <UsageCount Value="10"/>
    142147      </Unit11>
    143148      <Unit12>
     
    146151        <TopLine Value="14"/>
    147152        <CursorPos X="24" Y="21"/>
    148         <UsageCount Value="11"/>
     153        <UsageCount Value="10"/>
    149154      </Unit12>
    150155      <Unit13>
     
    153158        <TopLine Value="313"/>
    154159        <CursorPos X="24" Y="316"/>
    155         <UsageCount Value="11"/>
     160        <UsageCount Value="10"/>
    156161      </Unit13>
    157162      <Unit14>
     
    160165        <TopLine Value="149"/>
    161166        <CursorPos X="3" Y="151"/>
    162         <UsageCount Value="11"/>
     167        <UsageCount Value="10"/>
    163168      </Unit14>
    164169      <Unit15>
     
    168173        <TopLine Value="171"/>
    169174        <CursorPos X="3" Y="188"/>
    170         <UsageCount Value="10"/>
     175        <UsageCount Value="9"/>
    171176      </Unit15>
    172177      <Unit16>
    173178        <Filename Value="/usr/share/fpcsrc/2.4.0/rtl/inc/systemh.inc"/>
    174179        <WindowIndex Value="0"/>
    175         <TopLine Value="300"/>
    176         <CursorPos X="3" Y="317"/>
    177         <UsageCount Value="8"/>
     180        <TopLine Value="243"/>
     181        <CursorPos X="3" Y="260"/>
     182        <UsageCount Value="10"/>
    178183      </Unit16>
    179184      <Unit17>
     
    182187        <UnitName Value="UDrawMethod"/>
    183188        <IsVisibleTab Value="True"/>
    184         <EditorIndex Value="2"/>
    185         <WindowIndex Value="0"/>
    186         <TopLine Value="126"/>
    187         <CursorPos X="57" Y="135"/>
    188         <UsageCount Value="31"/>
     189        <EditorIndex Value="3"/>
     190        <WindowIndex Value="0"/>
     191        <TopLine Value="157"/>
     192        <CursorPos X="22" Y="168"/>
     193        <UsageCount Value="37"/>
    189194        <Loaded Value="True"/>
    190195      </Unit17>
     
    193198        <IsPartOfProject Value="True"/>
    194199        <UnitName Value="UFastBitmap"/>
    195         <EditorIndex Value="1"/>
    196         <WindowIndex Value="0"/>
    197         <TopLine Value="32"/>
    198         <CursorPos X="41" Y="18"/>
    199         <UsageCount Value="31"/>
     200        <EditorIndex Value="2"/>
     201        <WindowIndex Value="0"/>
     202        <TopLine Value="33"/>
     203        <CursorPos X="37" Y="66"/>
     204        <UsageCount Value="37"/>
    200205        <Loaded Value="True"/>
    201206      </Unit18>
     
    205210        <TopLine Value="292"/>
    206211        <CursorPos X="1" Y="308"/>
    207         <UsageCount Value="14"/>
     212        <UsageCount Value="13"/>
    208213      </Unit19>
    209214      <Unit20>
    210215        <Filename Value="bgrabitmap/bgradefaultbitmap.pas"/>
    211216        <UnitName Value="BGRADefaultBitmap"/>
    212         <EditorIndex Value="3"/>
    213217        <WindowIndex Value="0"/>
    214218        <TopLine Value="279"/>
    215219        <CursorPos X="57" Y="292"/>
    216         <UsageCount Value="12"/>
    217         <Loaded Value="True"/>
     220        <UsageCount Value="11"/>
    218221      </Unit20>
    219222      <Unit21>
    220223        <Filename Value="bgrabitmap/bgrawinbitmap.pas"/>
    221224        <UnitName Value="BGRAWinBitmap"/>
    222         <EditorIndex Value="5"/>
    223225        <WindowIndex Value="0"/>
    224226        <TopLine Value="133"/>
    225227        <CursorPos X="1" Y="146"/>
    226         <UsageCount Value="12"/>
    227         <Loaded Value="True"/>
     228        <UsageCount Value="11"/>
    228229      </Unit21>
    229230      <Unit22>
     
    233234        <TopLine Value="584"/>
    234235        <CursorPos X="3" Y="597"/>
    235         <UsageCount Value="11"/>
     236        <UsageCount Value="10"/>
    236237      </Unit22>
    237238      <Unit23>
     
    240241        <TopLine Value="32"/>
    241242        <CursorPos X="10" Y="45"/>
    242         <UsageCount Value="13"/>
     243        <UsageCount Value="12"/>
    243244      </Unit23>
    244245      <Unit24>
     
    247248        <TopLine Value="51"/>
    248249        <CursorPos X="3" Y="53"/>
    249         <UsageCount Value="13"/>
     250        <UsageCount Value="12"/>
    250251      </Unit24>
    251252      <Unit25>
     
    255256        <TopLine Value="1314"/>
    256257        <CursorPos X="31" Y="1327"/>
    257         <UsageCount Value="13"/>
     258        <UsageCount Value="12"/>
    258259      </Unit25>
    259260      <Unit26>
     
    262263        <TopLine Value="1883"/>
    263264        <CursorPos X="10" Y="1896"/>
    264         <UsageCount Value="13"/>
     265        <UsageCount Value="12"/>
    265266      </Unit26>
    266267      <Unit27>
     
    269270        <TopLine Value="75"/>
    270271        <CursorPos X="31" Y="88"/>
    271         <UsageCount Value="11"/>
     272        <UsageCount Value="10"/>
    272273      </Unit27>
    273274      <Unit28>
     
    276277        <TopLine Value="309"/>
    277278        <CursorPos X="3" Y="311"/>
    278         <UsageCount Value="10"/>
     279        <UsageCount Value="9"/>
    279280      </Unit28>
    280281      <Unit29>
    281282        <Filename Value="bgrabitmap/bgrabitmaptypes.pas"/>
    282283        <UnitName Value="BGRABitmapTypes"/>
    283         <EditorIndex Value="6"/>
    284284        <WindowIndex Value="0"/>
    285285        <TopLine Value="24"/>
    286286        <CursorPos X="3" Y="37"/>
    287         <UsageCount Value="12"/>
    288         <Loaded Value="True"/>
     287        <UsageCount Value="11"/>
    289288      </Unit29>
    290289      <Unit30>
     
    294293        <TopLine Value="271"/>
    295294        <CursorPos X="23" Y="292"/>
    296         <UsageCount Value="11"/>
     295        <UsageCount Value="10"/>
    297296      </Unit30>
    298297      <Unit31>
     
    302301        <TopLine Value="1"/>
    303302        <CursorPos X="41" Y="62"/>
    304         <UsageCount Value="20"/>
     303        <UsageCount Value="19"/>
    305304      </Unit31>
    306305      <Unit32>
     
    310309        <TopLine Value="23"/>
    311310        <CursorPos X="4" Y="35"/>
    312         <UsageCount Value="10"/>
     311        <UsageCount Value="9"/>
    313312      </Unit32>
    314313      <Unit33>
     
    317316        <TopLine Value="1456"/>
    318317        <CursorPos X="1" Y="1471"/>
    319         <UsageCount Value="10"/>
     318        <UsageCount Value="9"/>
    320319      </Unit33>
    321320      <Unit34>
     
    324323        <TopLine Value="780"/>
    325324        <CursorPos X="10" Y="793"/>
    326         <UsageCount Value="10"/>
     325        <UsageCount Value="9"/>
    327326      </Unit34>
    328327      <Unit35>
    329328        <Filename Value="bgrabitmap/bgrablend.pas"/>
    330329        <UnitName Value="BGRABlend"/>
    331         <EditorIndex Value="4"/>
    332330        <WindowIndex Value="0"/>
    333331        <TopLine Value="217"/>
    334332        <CursorPos X="3" Y="219"/>
    335         <UsageCount Value="10"/>
    336         <Loaded Value="True"/>
     333        <UsageCount Value="9"/>
    337334      </Unit35>
     335      <Unit36>
     336        <Filename Value="BGRABitmap/bgrabitmap.pas"/>
     337        <UnitName Value="BGRABitmap"/>
     338        <EditorIndex Value="9"/>
     339        <WindowIndex Value="0"/>
     340        <TopLine Value="52"/>
     341        <CursorPos X="23" Y="72"/>
     342        <UsageCount Value="13"/>
     343        <Loaded Value="True"/>
     344      </Unit36>
     345      <Unit37>
     346        <Filename Value="BGRABitmap/bgragtkbitmap.pas"/>
     347        <UnitName Value="BGRAGtkBitmap"/>
     348        <EditorIndex Value="10"/>
     349        <WindowIndex Value="0"/>
     350        <TopLine Value="29"/>
     351        <CursorPos X="36" Y="36"/>
     352        <UsageCount Value="13"/>
     353        <Loaded Value="True"/>
     354      </Unit37>
     355      <Unit38>
     356        <Filename Value="BGRABitmap/bgradefaultbitmap.pas"/>
     357        <UnitName Value="BGRADefaultBitmap"/>
     358        <EditorIndex Value="11"/>
     359        <WindowIndex Value="0"/>
     360        <TopLine Value="3503"/>
     361        <CursorPos X="31" Y="3506"/>
     362        <UsageCount Value="13"/>
     363        <Loaded Value="True"/>
     364      </Unit38>
     365      <Unit39>
     366        <Filename Value="BGRABitmap/bgraresample.pas"/>
     367        <UnitName Value="bgraresample"/>
     368        <EditorIndex Value="12"/>
     369        <WindowIndex Value="0"/>
     370        <TopLine Value="629"/>
     371        <CursorPos X="30" Y="638"/>
     372        <UsageCount Value="13"/>
     373        <Loaded Value="True"/>
     374      </Unit39>
     375      <Unit40>
     376        <Filename Value="../../../lazarus/components/opengl/glqtcontext.pas"/>
     377        <UnitName Value="GLQTContext"/>
     378        <EditorIndex Value="6"/>
     379        <WindowIndex Value="0"/>
     380        <TopLine Value="1"/>
     381        <CursorPos X="1" Y="1"/>
     382        <UsageCount Value="13"/>
     383        <Loaded Value="True"/>
     384      </Unit40>
     385      <Unit41>
     386        <Filename Value="../../../lazarus/components/opengl/openglcontext.pas"/>
     387        <UnitName Value="OpenGLContext"/>
     388        <EditorIndex Value="7"/>
     389        <WindowIndex Value="0"/>
     390        <TopLine Value="387"/>
     391        <CursorPos X="19" Y="389"/>
     392        <UsageCount Value="13"/>
     393        <Loaded Value="True"/>
     394      </Unit41>
     395      <Unit42>
     396        <Filename Value="../../../lazarus/components/opengl/glgtkglxcontext.pas"/>
     397        <UnitName Value="GLGtkGlxContext"/>
     398        <EditorIndex Value="8"/>
     399        <WindowIndex Value="0"/>
     400        <TopLine Value="694"/>
     401        <CursorPos X="3" Y="696"/>
     402        <UsageCount Value="13"/>
     403        <Loaded Value="True"/>
     404      </Unit42>
     405      <Unit43>
     406        <Filename Value="/usr/share/fpcsrc/2.4.0/packages/opengl/src/gl.pp"/>
     407        <UnitName Value="GL"/>
     408        <EditorIndex Value="1"/>
     409        <WindowIndex Value="0"/>
     410        <TopLine Value="821"/>
     411        <CursorPos X="3" Y="838"/>
     412        <UsageCount Value="12"/>
     413        <Loaded Value="True"/>
     414      </Unit43>
     415      <Unit44>
     416        <Filename Value="../../../lazarus/lcl/include/customform.inc"/>
     417        <EditorIndex Value="5"/>
     418        <WindowIndex Value="0"/>
     419        <TopLine Value="898"/>
     420        <CursorPos X="38" Y="928"/>
     421        <UsageCount Value="12"/>
     422        <Loaded Value="True"/>
     423      </Unit44>
     424      <Unit45>
     425        <Filename Value="/usr/share/fpcsrc/2.4.0/rtl/inc/heaph.inc"/>
     426        <WindowIndex Value="0"/>
     427        <TopLine Value="63"/>
     428        <CursorPos X="43" Y="80"/>
     429        <UsageCount Value="10"/>
     430      </Unit45>
     431      <Unit46>
     432        <Filename Value="../../../lazarus/lcl/include/custombitmap.inc"/>
     433        <WindowIndex Value="0"/>
     434        <TopLine Value="21"/>
     435        <CursorPos X="1" Y="38"/>
     436        <UsageCount Value="10"/>
     437      </Unit46>
    338438    </Units>
    339     <JumpHistory Count="22" HistoryIndex="18">
     439    <JumpHistory Count="29" HistoryIndex="28">
    340440      <Position1>
    341         <Filename Value="bgrabitmap/bgradefaultbitmap.pas"/>
    342         <Caret Line="3492" Column="1" TopLine="3479"/>
     441        <Filename Value="UDrawMethod.pas"/>
     442        <Caret Line="135" Column="3" TopLine="118"/>
    343443      </Position1>
    344444      <Position2>
    345         <Filename Value="bgrabitmap/bgradefaultbitmap.pas"/>
    346         <Caret Line="3493" Column="1" TopLine="3479"/>
     445        <Filename Value="UMainForm.pas"/>
     446        <Caret Line="48" Column="5" TopLine="31"/>
    347447      </Position2>
    348448      <Position3>
    349         <Filename Value="bgrabitmap/bgradefaultbitmap.pas"/>
    350         <Caret Line="1061" Column="1" TopLine="1048"/>
     449        <Filename Value="UMainForm.pas"/>
     450        <Caret Line="196" Column="39" TopLine="176"/>
    351451      </Position3>
    352452      <Position4>
    353         <Filename Value="bgrabitmap/bgrawinbitmap.pas"/>
    354         <Caret Line="135" Column="20" TopLine="119"/>
     453        <Filename Value="UMainForm.pas"/>
     454        <Caret Line="103" Column="23" TopLine="77"/>
    355455      </Position4>
    356456      <Position5>
    357         <Filename Value="bgrabitmap/bgrawinbitmap.pas"/>
    358         <Caret Line="127" Column="1" TopLine="119"/>
     457        <Filename Value="UMainForm.pas"/>
     458        <Caret Line="92" Column="7" TopLine="77"/>
    359459      </Position5>
    360460      <Position6>
    361         <Filename Value="bgrabitmap/bgrawinbitmap.pas"/>
    362         <Caret Line="128" Column="1" TopLine="119"/>
     461        <Filename Value="UDrawMethod.pas"/>
     462        <Caret Line="155" Column="7" TopLine="135"/>
    363463      </Position6>
    364464      <Position7>
    365         <Filename Value="bgrabitmap/bgrawinbitmap.pas"/>
    366         <Caret Line="135" Column="1" TopLine="119"/>
     465        <Filename Value="UMainForm.pas"/>
     466        <Caret Line="177" Column="41" TopLine="167"/>
    367467      </Position7>
    368468      <Position8>
    369         <Filename Value="bgrabitmap/bgrawinbitmap.pas"/>
    370         <Caret Line="136" Column="1" TopLine="128"/>
     469        <Filename Value="UMainForm.pas"/>
     470        <Caret Line="201" Column="25" TopLine="182"/>
    371471      </Position8>
    372472      <Position9>
    373         <Filename Value="bgrabitmap/bgrawinbitmap.pas"/>
    374         <Caret Line="137" Column="1" TopLine="128"/>
     473        <Filename Value="UDrawMethod.pas"/>
     474        <Caret Line="161" Column="72" TopLine="135"/>
    375475      </Position9>
    376476      <Position10>
    377         <Filename Value="bgrabitmap/bgrawinbitmap.pas"/>
    378         <Caret Line="136" Column="12" TopLine="128"/>
     477        <Filename Value="UDrawMethod.pas"/>
     478        <Caret Line="31" Column="23" TopLine="19"/>
    379479      </Position10>
    380480      <Position11>
    381         <Filename Value="bgrabitmap/bgrawinbitmap.pas"/>
    382         <Caret Line="137" Column="7" TopLine="113"/>
     481        <Filename Value="UDrawMethod.pas"/>
     482        <Caret Line="140" Column="1" TopLine="131"/>
    383483      </Position11>
    384484      <Position12>
    385         <Filename Value="bgrabitmap/bgrawinbitmap.pas"/>
    386         <Caret Line="146" Column="1" TopLine="133"/>
     485        <Filename Value="UDrawMethod.pas"/>
     486        <Caret Line="141" Column="3" TopLine="123"/>
    387487      </Position12>
    388488      <Position13>
    389         <Filename Value="bgrabitmap/bgradefaultbitmap.pas"/>
    390         <Caret Line="1069" Column="1" TopLine="1048"/>
     489        <Filename Value="UDrawMethod.pas"/>
     490        <Caret Line="179" Column="17" TopLine="153"/>
    391491      </Position13>
    392492      <Position14>
    393         <Filename Value="bgrabitmap/bgradefaultbitmap.pas"/>
    394         <Caret Line="1055" Column="25" TopLine="1048"/>
     493        <Filename Value="UMainForm.pas"/>
     494        <Caret Line="204" Column="26" TopLine="174"/>
    395495      </Position14>
    396496      <Position15>
    397         <Filename Value="bgrabitmap/bgradefaultbitmap.pas"/>
    398         <Caret Line="215" Column="27" TopLine="202"/>
     497        <Filename Value="UDrawMethod.pas"/>
     498        <Caret Line="184" Column="44" TopLine="168"/>
    399499      </Position15>
    400500      <Position16>
    401         <Filename Value="bgrabitmap/bgradefaultbitmap.pas"/>
    402         <Caret Line="299" Column="31" TopLine="281"/>
     501        <Filename Value="UMainForm.pas"/>
     502        <Caret Line="200" Column="88" TopLine="177"/>
    403503      </Position16>
    404504      <Position17>
    405         <Filename Value="bgrabitmap/bgradefaultbitmap.pas"/>
    406         <Caret Line="290" Column="39" TopLine="287"/>
     505        <Filename Value="UDrawMethod.pas"/>
     506        <Caret Line="188" Column="5" TopLine="167"/>
    407507      </Position17>
    408508      <Position18>
    409509        <Filename Value="UDrawMethod.pas"/>
    410         <Caret Line="146" Column="19" TopLine="133"/>
     510        <Caret Line="165" Column="29" TopLine="153"/>
    411511      </Position18>
    412512      <Position19>
    413         <Filename Value="UDrawMethod.pas"/>
    414         <Caret Line="133" Column="33" TopLine="121"/>
     513        <Filename Value="../../../lazarus/lcl/include/customform.inc"/>
     514        <Caret Line="914" Column="40" TopLine="898"/>
    415515      </Position19>
    416516      <Position20>
    417         <Filename Value="bgrabitmap/bgradefaultbitmap.pas"/>
    418         <Caret Line="292" Column="57" TopLine="279"/>
     517        <Filename Value="UDrawMethod.pas"/>
     518        <Caret Line="164" Column="31" TopLine="156"/>
    419519      </Position20>
    420520      <Position21>
    421         <Filename Value="bgrabitmap/bgradefaultbitmap.pas"/>
    422         <Caret Line="420" Column="26" TopLine="413"/>
     521        <Filename Value="UDrawMethod.pas"/>
     522        <Caret Line="197" Column="5" TopLine="176"/>
    423523      </Position21>
    424524      <Position22>
    425         <Filename Value="bgrabitmap/bgradefaultbitmap.pas"/>
    426         <Caret Line="407" Column="3" TopLine="405"/>
     525        <Filename Value="UMainForm.pas"/>
     526        <Caret Line="92" Column="8" TopLine="68"/>
    427527      </Position22>
     528      <Position23>
     529        <Filename Value="UMainForm.pas"/>
     530        <Caret Line="96" Column="7" TopLine="68"/>
     531      </Position23>
     532      <Position24>
     533        <Filename Value="UDrawMethod.pas"/>
     534        <Caret Line="168" Column="8" TopLine="139"/>
     535      </Position24>
     536      <Position25>
     537        <Filename Value="../../../lazarus/lcl/include/customform.inc"/>
     538        <Caret Line="919" Column="30" TopLine="898"/>
     539      </Position25>
     540      <Position26>
     541        <Filename Value="UDrawMethod.pas"/>
     542        <Caret Line="162" Column="18" TopLine="147"/>
     543      </Position26>
     544      <Position27>
     545        <Filename Value="UMainForm.pas"/>
     546        <Caret Line="96" Column="1" TopLine="78"/>
     547      </Position27>
     548      <Position28>
     549        <Filename Value="UDrawMethod.pas"/>
     550        <Caret Line="184" Column="15" TopLine="164"/>
     551      </Position28>
     552      <Position29>
     553        <Filename Value="UDrawMethod.pas"/>
     554        <Caret Line="194" Column="23" TopLine="177"/>
     555      </Position29>
    428556    </JumpHistory>
    429557  </ProjectOptions>
  • GraphicTest/GraphicTest.lpr

    r206 r211  
    88  {$ENDIF}{$ENDIF}
    99  Interfaces, // this includes the LCL widgetset
    10   Forms, UMainForm, UPlatform, UDrawMethod, UFastBitmap;
     10  Forms, lazopenglcontext, UMainForm, UPlatform, UDrawMethod, UFastBitmap;
    1111
    1212{$R *.res}
  • GraphicTest/UDrawMethod.pas

    r210 r211  
    88  Classes, SysUtils, StdCtrls, ExtCtrls, UPlatform, UFastBitmap, Graphics,
    99  LCLType, IntfGraphics, fpImage, GraphType, BGRABitmap, BGRABitmapTypes,
    10   LclIntf;
     10  LclIntf, GL, OpenGLContext;
    1111
    1212type
     
    2727    FrameDuration: TDateTime;
    2828    PaintObject: TPaintObject;
     29    OpenGLBitmap: Pointer;
     30    OpenGLControl: TOpenGLControl;
     31    TextureId: GLuint;
    2932    constructor Create; virtual;
    3033    destructor Destroy; override;
     
    9497  end;
    9598
     99  { TOpenGLMethod }
     100
     101  TOpenGLMethod = class(TDrawMethod)
     102    procedure SetBitmap(const AValue: TBitmap); override;
     103    constructor Create; override;
     104    destructor Destroy; override;
     105    procedure DrawFrame(FastBitmap: TFastBitmap); override;
     106  end;
     107
     108
    96109const
    97   DrawMethodClasses: array[0..6] of TDrawMethodClass = (
     110  DrawMethodClasses: array[0..7] of TDrawMethodClass = (
    98111    TCanvasPixels, TCanvasPixelsUpdateLock, TLazIntfImageColorsCopy,
    99112    TLazIntfImageColorsNoCopy, TBitmapRawImageData, TBitmapRawImageDataPaintBox,
    100     TBGRABitmapPaintBox);
     113    TBGRABitmapPaintBox, TOpenGLMethod);
    101114
    102115implementation
     116
     117{ TOpenGLMethod }
     118
     119procedure TOpenGLMethod.SetBitmap(const AValue: TBitmap);
     120begin
     121  inherited SetBitmap(AValue);
     122end;
     123
     124constructor TOpenGLMethod.Create;
     125begin
     126  inherited Create;
     127  Caption := 'OpenGL';
     128  PaintObject := poOpenGL;
     129end;
     130
     131destructor TOpenGLMethod.Destroy;
     132begin
     133  inherited Destroy;
     134end;
     135
     136procedure TOpenGLMethod.DrawFrame(FastBitmap: TFastBitmap);
     137var
     138  X, Y: Integer;
     139  P: PInteger;
     140  R: PInteger;
     141const
     142  GL_CLAMP_TO_EDGE = $812F;
     143begin
     144(*  glEnable(GL_TEXTURE_2D);          // enables 2d textures
     145    glClearColor(0.0,0.0,0.0,1.0);    // sets background color
     146    glClearDepth(1.0);
     147    glDepthFunc(GL_LEQUAL);           // the type of depth test to do
     148    glEnable(GL_DEPTH_TEST);          // enables depth testing
     149    glShadeModel(GL_SMOOTH);          // enables smooth color shading
     150    {blending}
     151    glColor4f(1.0,1.0,1.0,0.5);       // Full Brightness, 50% Alpha ( NEW )
     152    glBlendFunc(GL_SRC_ALPHA, GL_ONE);
     153    glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
     154*)
     155
     156  glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
     157  //glLoadIdentity;             { clear the matrix }
     158  //glTranslatef(0.0, 0.0, -3.0);  // -2.5); { viewing transformation }
     159
     160  //glLoadIdentity;             { clear the matrix }
     161
     162  P := OpenGLBitmap;
     163  with FastBitmap do
     164  for Y := 0 to Size.Y - 1 do begin
     165    R := P;
     166    for X := 0 to Size.X - 1 do begin
     167      //R^ := Round($ff * (Y / Size.Y)) or $ff000000;
     168      R^  := NoSwapBRComponent(Pixels[X, Y]) or $ff000000;
     169      Inc(R);
     170    end;
     171    Inc(P, Size.X);
     172  end;
     173
     174    glLoadIdentity;
     175    //glRotatef(30.0, 0, 0, 1.0);
     176    glTranslatef(-OpenGLControl.Width div 2, -OpenGLControl.Height div 2, 0.0);
     177
     178    glEnable(GL_TEXTURE_2D);
     179    glBindTexture(GL_TEXTURE_2D, TextureId);
     180      //glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
     181      //glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
     182      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
     183      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     184      glTexImage2D(GL_TEXTURE_2D, 0, 4, OpenGLControl.Width, OpenGLControl.Height,
     185        0, GL_RGBA, GL_UNSIGNED_BYTE, OpenGLBitmap);
     186      //glTexImage2D(GL_TEXTURE_2D, 0, 4, 512, 256,
     187      //0, GL_RGBA, GL_UNSIGNED_BYTE, OpenGLBitmap);
     188
     189    //Define how alpha blending will work and enable alpha blending.
     190    //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     191    //glEnable(GL_BLEND);
     192
     193    glBegin(GL_QUADS);
     194    //glBegin(GL_POLYGON);
     195      glColor3ub(255, 255, 255);
     196      glTexCoord2f(0, 0);
     197      glVertex3f(0, 0, 0);
     198      glTexCoord2f(OpenGLControl.Width div 2, 0);
     199      glVertex3f(OpenGLControl.Width, 0, 0);
     200      glTexCoord2f(OpenGLControl.Width div 2, OpenGLControl.Height div 2);
     201      glVertex3f(OpenGLControl.Width, OpenGLControl.Height, 0);
     202      glTexCoord2f(0, OpenGLControl.Height div 2);
     203      glVertex3f(0, OpenGLControl.Height, 0);
     204    glEnd();
     205
     206  OpenGLControl.SwapBuffers;
     207end;
    103208
    104209{ TBGRABitmapPaintBox }
  • GraphicTest/UMainForm.lfm

    r206 r211  
    1616    Top = 16
    1717    Width = 365
    18     ActivePage = TabSheet1
     18    ActivePage = TabSheet3
    1919    Anchors = [akTop, akLeft, akRight, akBottom]
    20     TabIndex = 0
     20    TabIndex = 2
    2121    TabOrder = 0
    2222    object TabSheet1: TTabSheet
    2323      Caption = 'TImage'
    24       ClientHeight = 292
    25       ClientWidth = 357
     24      ClientHeight = 291
     25      ClientWidth = 361
    2626      object Image1: TImage
    2727        Left = 6
    28         Height = 279
     28        Height = 278
    2929        Top = 7
    30         Width = 347
     30        Width = 351
    3131        Anchors = [akTop, akLeft, akRight, akBottom]
    3232      end
     
    3434    object TabSheet2: TTabSheet
    3535      Caption = 'TPaintBox'
    36       ClientHeight = 406
    37       ClientWidth = 408
     36      ClientHeight = 291
     37      ClientWidth = 361
    3838      object PaintBox1: TPaintBox
    3939        Left = 6
    40         Height = 394
     40        Height = 279
    4141        Top = 7
    42         Width = 397
     42        Width = 350
    4343        Anchors = [akTop, akLeft, akRight, akBottom]
    4444      end
     45    end
     46    object TabSheet3: TTabSheet
     47      Caption = 'OpenGL'
    4548    end
    4649  end
     
    5861    Height = 14
    5962    Top = 95
    60     Width = 23
     63    Width = 24
    6164    Caption = 'FPS:'
    6265    ParentColor = False
     
    8487    Height = 14
    8588    Top = 112
    86     Width = 74
     89    Width = 83
    8790    Caption = 'Frame duration'
    8891    ParentColor = False
     
    113116      item
    114117        Caption = 'FPS'
    115         Width = 60
     118        Width = 75
    116119      end>
    117120    TabOrder = 3
     
    129132  object ComboBox1: TComboBox
    130133    Left = 7
    131     Height = 21
     134    Height = 25
    132135    Top = 64
    133136    Width = 297
    134     ItemHeight = 13
     137    ItemHeight = 0
    135138    Style = csDropDownList
    136139    TabOrder = 5
     
    140143    Height = 14
    141144    Top = 47
    142     Width = 41
     145    Width = 46
    143146    Caption = 'Method:'
    144147    ParentColor = False
  • GraphicTest/UMainForm.pas

    r206 r211  
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
    99  ExtCtrls, StdCtrls, DateUtils, UPlatform, LCLType, IntfGraphics, fpImage,
    10   Math, GraphType, Contnrs, LclIntf, UFastBitmap, UDrawMethod;
     10  Math, GraphType, Contnrs, LclIntf, UFastBitmap, UDrawMethod, GL, OpenGLContext;
    1111
    1212const
     
    3434    TabSheet1: TTabSheet;
    3535    TabSheet2: TTabSheet;
     36    TabSheet3: TTabSheet;
    3637    Timer1: TTimer;
    3738    procedure ButtonBenchmarkClick(Sender: TObject);
     
    4344    procedure Timer1Timer(Sender: TObject);
    4445  private
     46    OpenGLControl1: TOpenGLControl;
     47    TextureId: GLuint;
     48    TextureData: Pointer;
     49    procedure OpenGLControl1Resize(Sender: TObject);
     50    procedure InitGL;
    4551  public
    4652    DrawMethods: TObjectList; // TObjectList<TDrawMethod>
     
    7985  Bitmap.SetSize(TFastBitmap(Scenes[0]).Size.X, TFastBitmap(Scenes[0]).Size.Y);
    8086
     87  OpenGLControl1 := TOpenGLControl.Create(Self);
     88  with OpenGLControl1 do begin
     89    Name := 'OpenGLControl1';
     90    Parent := TabSheet3;
     91    SetBounds(0, 0, 320, 240);
     92    InitGL;
     93    //OnPaint := OpenGLControl1Paint;
     94    OnResize := OpenGLControl1Resize;
     95  end;
     96  GetMem(TextureData, OpenGLControl1.Width * OpenGLControl1.Height * SizeOf(Integer));
     97
    8198  DrawMethods := TObjectList.Create;
    8299  ComboBox1.Clear;
     
    85102    NewDrawMethod.Bitmap := Image1.Picture.Bitmap;
    86103    NewDrawMethod.PaintBox := PaintBox1;
     104    NewDrawMethod.OpenGLBitmap := TextureData;
     105    NewDrawMethod.OpenGLControl := OpenGLControl1;
    87106    DrawMethods.Add(NewDrawMethod);
    88107    ComboBox1.Items.Add(NewDrawMethod.Caption);
    89108  end;
    90   ComboBox1.ItemIndex := 0;
     109  ComboBox1.ItemIndex := DrawMethods.Count - 1;
    91110end;
    92111
     
    148167procedure TMainForm.FormDestroy(Sender: TObject);
    149168begin
     169  FreeMem(TextureData, OpenGLControl1.Width * OpenGLControl1.Height);
    150170  DrawMethods.Free;
    151171  Scenes.Free;
     
    164184end;
    165185
     186procedure TMainForm.OpenGLControl1Resize(Sender: TObject);
     187begin
     188  glViewport(0, 0, OpenGLControl1.Width, OpenGLControl1.Height);
     189end;
     190
     191procedure TMainForm.InitGL;
     192begin
     193  glMatrixMode(GL_PROJECTION);
     194  glLoadIdentity;
     195  glOrtho(0, OpenGLControl1.Width, OpenGLControl1.Height, 0, 0, 1);
     196  glMatrixMode(GL_MODELVIEW);
     197  glLoadIdentity();
     198  glDisable(GL_DEPTH_TEST);
     199  glViewport(0, 0, OpenGLControl1.Width, OpenGLControl1.Height);
     200  //gluPerspective( 45.0, (GLfloat)(OpenGLControl1.Width)/(GLfloat)(OpenGLControl1.Height), 0.1f, 500.0 );
     201
     202    //glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
     203    //glTranslatef (0.0, 0.0,-3.0);
     204  //  glClearColor(0.0, 0.0, 0.0, 1.0);
     205
     206  glGenTextures(1, @TextureId);
     207  glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
     208end;
     209
    166210end.
    167211
Note: See TracChangeset for help on using the changeset viewer.