Glaux.pas

Top  Previous  Next

unit Glaux;

 

interface

 

uses Windows,Opengl;

 

type

_AUX_EVENTREC=record

  event:GLint;

  data:array [0..3] of Glint;

end;

AUX_EVENTREC=_AUX_EVENTREC;

PAUX_EVENTREC=^AUX_EVENTREC;

TAUX_RGBImageRec= record

  sizeX, sizeY: GLint;

  data: pointer;

end;

PTAUX_RGBImageRec= ^TAUX_RGBImageRec;

AUXMAINPROC=procedure;

AUXEXPOSEPROC=procedure(value,value1:Integer);

AUXRESHAPEPROC=procedure(value,value1:GLsizei);

AUXIDLEPROC=procedure;

AUXKEYPROC=procedure;

AUXMOUSEPROC=procedure(value:PAUX_EVENTREC);

 

const AUX_RGB=0;

     AUX_RGBA=AUX_RGB;

     AUX_INDEX=1;

     AUX_SINGLE=0;

     AUX_DOUBLE=2;

     AUX_DIRECT=0;

     AUX_INDIRECT=4;

 

     AUX_ACCUM=8;

     AUX_ALPHA=16;

     AUX_DEPTH24=32;

     AUX_STENCIL=64;

     AUX_AUX=128;

     AUX_DEPTH16=256;

     AUX_FIXED_332_PAL=512;

     AUX_DEPTH=AUX_DEPTH16;

     //ToolKit Event Types

     AUX_EXPOSE=1;

     AUX_CONFIG=2;

     AUX_DRAW=4;

     AUX_KEYEVENT=8;

     AUX_MOUSEDOWN=16;

     AUX_MOUSEUP=32;

     AUX_MOUSELOC=64;

     //Toolkit Event Data Indices

     AUX_WINDOWX=0;

     AUX_WINDOWY=1;

     AUX_MOUSEX=0;

     AUX_MOUSEY=1;

     AUX_MOUSESTATUS=3;

     AUX_KEY=0;

     AUX_KEYSTATUS=3;

     //ToolKit Event Status Messages

     AUX_LEFTBUTTON=1;

     AUX_RIGHTBUTTON=2;

     AUX_MIDDLEBUTTON=4;

     AUX_SHIFT=1;

     AUX_CONTROL=2;

     //ToolKit Key Codes

     //译者MXY注:AUX_A译为AUX_BA,AUX_a译为AUX_SA,大写加B,小写加S,其他类同

     AUX_RETURN=$0D;

     AUX_ESCAPE=$1B;

     AUX_SPACE=$20;

     AUX_LEFT=$25;

     AUX_UP=$26;

     AUX_RIGHT=$27;

     AUX_DOWN=$28;

     AUX_BA='A';

     AUX_BB='B';

     AUX_BC='C';

     AUX_BD='D';

     AUX_BE='E';

     AUX_BF='F';

     AUX_BG='G';

     AUX_BH='H';

     AUX_BI='I';

     AUX_BJ='J';

     AUX_BK='K';

     AUX_BL='L';

     AUX_BM='M';

     AUX_BN='N';

     AUX_BO='O';

     AUX_BP='P';

     AUX_BQ='Q';

     AUX_BR='R';

     AUX_BS='S';

     AUX_BT='T';

     AUX_BU='U';

     AUX_BV='V';

     AUX_BW='W';

     AUX_BX='X';

     AUX_BY='Y';

     AUX_BZ='Z';

     AUX_SA='a';

     AUX_SB='b';

     AUX_SC='c';

     AUX_SD='d';

     AUX_SE='e';

     AUX_SF='f';

     AUX_SG='g';

     AUX_SH='h';

     AUX_SI='i';

     AUX_SJ='j';

     AUX_SK='k';

     AUX_SL='l';

     AUX_SM='m';

     AUX_SN='n';

     AUX_SO='o';

     AUX_SP='p';

     AUX_SQ='q';

     AUX_SR='r';

     AUX_SS='s';

     AUX_ST='t';

     AUX_SU='u';

     AUX_SV='v';

     AUX_SW='w';

     AUX_SX='x';

     AUX_SY='y';

     AUX_SZ='z';

     AUX_0='0';

     AUX_1='1';

     AUX_2='2';

     AUX_3='3';

     AUX_4='4';

     AUX_5='5';

     AUX_6='6';

     AUX_7='7';

     AUX_8='8';

     AUX_9='9';

     //ToolKit Gets and Sets

     AUX_FD=1;//return fd (long)

     AUX_COLORMAP=3;//pass buf of r, g and b (unsigned char)

     AUX_GREYSCALEMAP=4;

     AUX_FOGMAP=5;//pass fog and color bits (long)

     AUX_ONECOLOR=6;//pass index, r, g, and b (long)

     //Color Macros

     AUX_BLACK=0;

     AUX_RED=13;

     AUX_GREEN=14;

     AUX_YELLOW=15;

     AUX_BLUE=16;

     AUX_MAGENTA=17;

     AUX_CYAN=18;

     AUX_WHITE=19;

     //enum

     AUX_USE_ID=1;

     AUX_EXACT_MATCH=2;

     AUX_MINIMUM_CRITERIA=3;

 

function auxDIBImageLoadA(const dibfile: PAnsiChar): PTAUX_RGBImageRec; stdcall;

procedure auxWireSphere(value: GLdouble);stdcall;

procedure auxSolidSphere(value: GLdouble);stdcall;

procedure auxWireCube(value: GLdouble);stdcall;

procedure auxSolidCube(value: GLdouble);stdcall;

procedure auxWireBox(value,value1,value2: GLdouble);stdcall;

procedure auxSolidBox(value,value1,value2: GLdouble);stdcall;

procedure auxWireTorus(value,value1: GLdouble);stdcall;

procedure auxSolidTorus(value,value1: GLdouble);stdcall;

procedure auxWireCylinder(value,value1: GLdouble);stdcall;

procedure auxSolidCylinder(value,value1: GLdouble);stdcall;

procedure auxWireIcosahedron(value: GLdouble);stdcall;

procedure auxSolidIcosahedron(value: GLdouble);stdcall;

procedure auxWireOctahedron(value: GLdouble);stdcall;

procedure auxSolidOctahedron(value: GLdouble);stdcall;

procedure auxWireTetrahedron(value: GLdouble);stdcall;

procedure auxSolidTetrahedron(value: GLdouble);stdcall;

procedure auxWireDodecahedron(value: GLdouble);stdcall;

procedure auxSolidDodecahedron(value: GLdouble);stdcall;

procedure auxWireCone(value,value1: GLdouble);stdcall;

procedure auxSolidCone(value,value1: GLdouble);stdcall;

procedure auxWireTeapot(value: GLdouble);stdcall;

procedure auxSolidTeapot(value: GLdouble);stdcall;

 

//Window Masks

function AUX_WIND_IS_RGB(x:Variant):Boolean;

function AUX_WIND_IS_INDEX(x:Variant):Boolean;

function AUX_WIND_IS_SINGLE(x:Variant):Boolean;

function AUX_WIND_IS_DOUBLE(x:Variant):Boolean;

function AUX_WIND_IS_INDIRECT(x:Variant):Boolean;

function AUX_WIND_IS_DIRECT(x:Variant):Boolean;

function AUX_WIND_HAS_ACCUM(x:Variant):Boolean;

function AUX_WIND_HAS_ALPHA(x:Variant):Boolean;

function AUX_WIND_HAS_DEPTH(x:Variant):Boolean;

function AUX_WIND_HAS_STENCIL(x:Variant):Boolean;

function AUX_WIND_USES_FIXED_332_PAL(x:Variant):Boolean;

 

procedure AUX_SETCOLOR(x:Variant;y:Integer);

////////////

procedure auxInitDisplayMode(value:GLenum);stdcall;

procedure auxInitPosition(value,value1,value2,value3:integer);stdcall;

function auxInitWindowA(value:PAnsiChar):GLenum;stdcall;

function auxInitWindowW(value:PWideChar):GLenum;stdcall;

procedure auxCloseWindow;stdcall;

procedure auxQuit;stdcall;

procedure auxSwapBuffers;stdcall;

procedure auxMainLoop(value:AUXMAINPROC);stdcall;

procedure auxReshapeFunc(value:AUXRESHAPEPROC);stdcall;

procedure auxIdleFunc(value:AUXIDLEPROC);stdcall;

procedure auxKeyFunc(value:Integer;value1:AUXKEYPROC);stdcall;

procedure auxMouseFunc(value,value1:Integer;value2:AUXMOUSEPROC);stdcall;

function auxGetColorMapSize:Integer;stdcall;

procedure auxGetMouseLoc(value,value1:PInteger);stdcall;

procedure auxSetOneColor(value:integer; value1,value2,value3:GLfloat);stdcall;

procedure auxSetFogRamp(value,value1:PInteger);stdcall;

procedure auxSetGreyRamp;stdcall;

procedure auxSetRGBMap(value:integer; value1:PGLfloat);stdcall;

function auxDIBImageLoadW(const dibfile: PWideChar): PTAUX_RGBImageRec; stdcall;

procedure auxCreateFont;stdcall;

procedure auxDrawStrA(value:PAnsiChar);stdcall;

procedure auxDrawStrW(value:PWideChar);stdcall;

function auxGetHWND:HWND;stdcall;

function auxGetHDC:HDC;stdcall;

function auxGetHGLRC:HGLRC;stdcall;

procedure auxInitDisplayModePolicy(value:GLenum);stdcall;

function auxInitDisplayModeID(value:GLint):GLenum;stdcall;

function auxGetDisplayModePolicy:GLenum;stdcall;

function auxGetDisplayModeID:GLint;stdcall;

function auxGetDisplayMode:GLenum;stdcall;

////////////

const

glaux1 = 'glaux.dll';

 

var auxRGBMap:array [0..19,0..2]of GLfloat;

 

implementation

 

function auxDIBImageLoadA; external glaux1;

procedure auxWireSphere;external glaux1;

procedure auxSolidSphere;external glaux1;

procedure auxWireCube;external glaux1;

procedure auxSolidCube;external glaux1;

procedure auxWireBox;external glaux1;

procedure auxSolidBox;external glaux1;

procedure auxWireTorus;external glaux1;

procedure auxSolidTorus;external glaux1;

procedure auxWireCylinder;external glaux1;

procedure auxSolidCylinder;external glaux1;

procedure auxWireIcosahedron;external glaux1;

procedure auxSolidIcosahedron;external glaux1;

procedure auxWireOctahedron;external glaux1;

procedure auxSolidOctahedron;external glaux1;

procedure auxWireTetrahedron;external glaux1;

procedure auxSolidTetrahedron;external glaux1;

procedure auxWireDodecahedron;external glaux1;

procedure auxSolidDodecahedron;external glaux1;

procedure auxWireCone;external glaux1;

procedure auxSolidCone;external glaux1;

procedure auxWireTeapot;external glaux1;

procedure auxSolidTeapot;external glaux1;

 

 

function AUX_WIND_IS_RGB(x:Variant):Boolean;

Begin

Result:=(x and AUX_INDEX)=0;

End;

 

function AUX_WIND_IS_INDEX(x:Variant):Boolean;

Begin

Result:=(x and AUX_INDEX)<>0;

End;

 

function AUX_WIND_IS_SINGLE(x:Variant):Boolean;

Begin

Result:=(x and AUX_DOUBLE)=0;

End;

 

function AUX_WIND_IS_DOUBLE(x:Variant):Boolean;

Begin

Result:=(x and AUX_DOUBLE)<>0;

End;

 

function AUX_WIND_IS_INDIRECT(x:Variant):Boolean;

Begin

Result:=(x and AUX_INDIRECT)<>0;

End;

 

function AUX_WIND_IS_DIRECT(x:Variant):Boolean;

Begin

Result:=(x and AUX_INDIRECT)=0;

End;

 

function AUX_WIND_HAS_ACCUM(x:Variant):Boolean;

Begin

Result:=(x and AUX_ACCUM)<>0;

End;

 

function AUX_WIND_HAS_ALPHA(x:Variant):Boolean;

Begin

Result:=(x and AUX_ALPHA)<>0;

End;

 

function AUX_WIND_HAS_DEPTH(x:Variant):Boolean;

Begin

Result:=(x and (AUX_DEPTH24 or AUX_DEPTH16))<>0;

End;

 

function AUX_WIND_HAS_STENCIL(x:Variant):Boolean;

Begin

Result:=(x and AUX_STENCIL)<>0;

End;

 

function AUX_WIND_USES_FIXED_332_PAL(x:Variant):Boolean;

Begin

Result:=(x and AUX_FIXED_332_PAL)<>0;

End;

 

procedure AUX_SETCOLOR(x:Variant;y:Integer);

Begin

if AUX_WIND_IS_RGB(x) then glColor3fv(@auxRGBMap[y]) else glIndexf(y);

End;

///////////

procedure auxInitDisplayMode;external glaux1;

procedure auxInitPosition;external glaux1;

function auxInitWindowA;external glaux1;

function auxInitWindowW;external glaux1;

procedure auxCloseWindow;external glaux1;

procedure auxQuit;external glaux1;

procedure auxSwapBuffers;external glaux1;

procedure auxMainLoop;external glaux1;

procedure auxReshapeFunc;external glaux1;

procedure auxIdleFunc;external glaux1;

procedure auxKeyFunc;external glaux1;

procedure auxMouseFunc;external glaux1;

function auxGetColorMapSize:Integer;external glaux1;

procedure auxGetMouseLoc;external glaux1;

procedure auxSetOneColor;external glaux1;

procedure auxSetFogRamp;external glaux1;

procedure auxSetGreyRamp;external glaux1;

procedure auxSetRGBMap;external glaux1;

function auxDIBImageLoadW; external glaux1;

procedure auxCreateFont;external glaux1;

procedure auxDrawStrA;external glaux1;

procedure auxDrawStrW;external glaux1;

function auxGetHWND;external glaux1;

function auxGetHDC;external glaux1;

function auxGetHGLRC;external glaux1;

procedure auxInitDisplayModePolicy;external glaux1;

function auxInitDisplayModeID;external glaux1;

function auxGetDisplayModePolicy;external glaux1;

function auxGetDisplayModeID;external glaux1;

function auxGetDisplayMode;external glaux1;

///////////

 

end.

.