unit bitmem1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  cOpenGL, OpenGL;

type
  TForm1 = class(TForm)
    OpenGL1: TOpenGL;
    procedure FormCreate(Sender: TObject);
    procedure FormPaint(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

type
  TBitRow=array[0..7] of byte;
  TCheckerBoard=array[0..63] of TBitRow;

var
  CheckerBoard: TCheckerBoard;

procedure MakeCheckerBoard;
var
  col,
  row: integer;
  square,
  start: byte;
begin
  fillchar(CheckerBoard,SizeOf(CheckerBoard),0);
  start := 0; {black}
  for row := 0 to 63 do
  begin
    if row mod 8 = 0 then
      start := not start; {alternate $00 $FF}
    square := start;
    for col := 0 to 7 do
    begin
      square := not square;
      CheckerBoard[row,col] := square;
    end; {for}
  end; {for}
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  glPixelStorei(GL_UNPACK_ALIGNMENT,1);
  MakeCheckerBoard;
end;

procedure TForm1.FormPaint(Sender: TObject);
begin
  glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
  glRasterPos3f(+0.0,+0.0,-2.0);
  glBitmap(64,64,32,32,0,0,@CheckerBoard);
  glFlush;
  OpenGL1.ErrorCheck('FormPaint');
end;

end.
