You've already forked lazarus-ccr
recreated documentation
some fixes in glfreetype, for small font sizes and mem leak fixes (http://www.cs.northwestern.edu/~sco590/fonts_tutorial.html) added new widget_test example.compiled started implementation of FreeType support in nvglwidgets.pas git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2224 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
and distributed as part of a tutorial for nehe.gamedev.net.
|
||||
Sven Olsen, 2003
|
||||
*)
|
||||
unit glFreeType;
|
||||
unit GLFreeType;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
@@ -44,7 +44,7 @@ function next_p2(a: integer): integer; inline;
|
||||
var
|
||||
rval: integer;
|
||||
begin
|
||||
rval := 1;
|
||||
rval := 2;
|
||||
while rval < a do
|
||||
rval := rval shl 1;
|
||||
Result := rval;
|
||||
@@ -100,23 +100,17 @@ begin
|
||||
//We use the ?: operator so that value which we use
|
||||
//will be 0 if we are in the padding zone, and whatever
|
||||
//is the the Freetype bitmap otherwise.
|
||||
for j := 0 to Height - 1 do
|
||||
begin
|
||||
for i := 0 to Width - 1 do
|
||||
for j:=0 to height -1 do
|
||||
for i:=0 to width - 1 do
|
||||
begin
|
||||
if (i >= bitmap.Width) or (j >= bitmap.rows) then
|
||||
expanded_data[2 * (i + j * Width)] := 0
|
||||
else
|
||||
expanded_data[2 * (i + j * Width)] := byte((bitmap.buffer + (i + bitmap.Width * j))^);
|
||||
expanded_data[2*(i+j*width)] := 255;
|
||||
|
||||
//write(expanded_data[2 * (i + j * Width)]:3, ' ');
|
||||
|
||||
expanded_data[2 * (i + j * Width) + 1] := expanded_data[2 * (i + j * Width)];
|
||||
if (i>=bitmap.width) or (j>=bitmap.rows) then
|
||||
expanded_data[2*(i+j*width)+1] := 0
|
||||
else
|
||||
expanded_data[2*(i+j*width)+1] := byte((bitmap.buffer + (i + bitmap.Width * j))^);
|
||||
end;
|
||||
|
||||
//writeln;
|
||||
end;
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, tex_base[Ord(ch)]);
|
||||
|
||||
//Now we just setup some texture paramaters.
|
||||
@@ -162,16 +156,15 @@ begin
|
||||
//so we need to link the texture to the quad
|
||||
//so that the result will be properly aligned.
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2d(0, 0);
|
||||
glVertex2f(0, bitmap.rows);
|
||||
glTexCoord2d(0, y);
|
||||
glVertex2f(0, 0);
|
||||
glTexCoord2d(x, y);
|
||||
glVertex2f(bitmap.Width, 0);
|
||||
glTexCoord2d(x, 0);
|
||||
glVertex2f(bitmap.Width, bitmap.rows);
|
||||
glTexCoord2d(0, 0);
|
||||
glVertex2f(0, bitmap.rows);
|
||||
glTexCoord2d(0, y);
|
||||
glVertex2f(0, 0);
|
||||
glTexCoord2d(x, y);
|
||||
glVertex2f(bitmap.Width, 0);
|
||||
glTexCoord2d(x, 0);
|
||||
glVertex2f(bitmap.Width, bitmap.rows);
|
||||
glEnd;
|
||||
|
||||
glPopMatrix;
|
||||
glTranslatef(face^.glyph^.advance.x shr 6, 0, 0);
|
||||
|
||||
@@ -181,6 +174,8 @@ begin
|
||||
|
||||
//Finish the display list
|
||||
glEndList;
|
||||
|
||||
FT_Done_Glyph(glyph);
|
||||
end;
|
||||
|
||||
procedure TGLFreeTypeFont.Init(const fname: string; AHeight: cardinal);
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<Unit5>
|
||||
<Filename Value="..\..\gl\glfreetype.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="glFreeType"/>
|
||||
<UnitName Value="GLFreeType"/>
|
||||
</Unit5>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
|
||||
@@ -5,7 +5,7 @@ program example;
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
GLut, GL, GLu, glFreeType,
|
||||
GLut, GL, GLu,
|
||||
nvWidgets, nvGlutWidgets;
|
||||
|
||||
type
|
||||
@@ -26,12 +26,10 @@ var
|
||||
compressionRate: double = 1;
|
||||
texture: GLuint = 0;
|
||||
let: string = 'linedit test';
|
||||
glFont: TGLFreeTypeFont;
|
||||
|
||||
procedure closeapp;
|
||||
begin
|
||||
FreeAndNil(ui);
|
||||
glFont.clean;
|
||||
halt(0);
|
||||
end;
|
||||
|
||||
@@ -85,9 +83,6 @@ var
|
||||
|
||||
c: integer;
|
||||
begin
|
||||
glColor3ub(0, $ff, 0);
|
||||
glFont.Print(10, 200, 'The quick brown fox jumps over the lazy dog');
|
||||
|
||||
none.Rect(0, 0);
|
||||
|
||||
ui._begin;
|
||||
@@ -175,8 +170,6 @@ begin
|
||||
glutInitDisplayMode(GLUT_DOUBLE or GLUT_DEPTH or GLUT_RGB);
|
||||
glutCreateWindow('UI example');
|
||||
|
||||
glFont.Init('Ubuntu-R.ttf', 26); //Build the freetype font
|
||||
|
||||
ui := GlutUIContext.Create;
|
||||
|
||||
if not ui.init(win_w, win_h) then
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
<UseDefaultCompilerOptions Value="True"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<Units Count="1">
|
||||
<Unit0>
|
||||
<Filename Value="widget_test.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="widget_test"/>
|
||||
</Unit0>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="widget_test"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value="..\..\nvglutils;.."/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<MsgFileName Value=""/>
|
||||
</CompilerMessages>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
||||
223
components/nvidia-widgets/src/nvwidgets/examples/widget_test.pp
Normal file
223
components/nvidia-widgets/src/nvwidgets/examples/widget_test.pp
Normal file
@@ -0,0 +1,223 @@
|
||||
program widget_test;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
GLut, GL, GLu,
|
||||
nvWidgets, nvGlutWidgets;
|
||||
|
||||
var
|
||||
ui: GlutUIContext;
|
||||
win_w: integer = 512;
|
||||
win_h: integer = 512;
|
||||
texture: GLuint = 0;
|
||||
|
||||
procedure closeapp;
|
||||
begin
|
||||
FreeAndNil(ui);
|
||||
halt(0);
|
||||
end;
|
||||
|
||||
procedure idle; cdecl;
|
||||
begin
|
||||
glutPostRedisplay;
|
||||
end;
|
||||
|
||||
procedure key(k: byte; x: integer; y: integer); cdecl;
|
||||
begin
|
||||
ui.keyboard(k, x, y);
|
||||
|
||||
case k of
|
||||
27, Ord('q'):
|
||||
closeapp;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure special(key: integer; x: integer; y: integer); cdecl;
|
||||
begin
|
||||
ui.specialKeyboard(key, x, y);
|
||||
end;
|
||||
|
||||
procedure resize(w: integer; h: integer); cdecl;
|
||||
begin
|
||||
ui.reshape(w, h);
|
||||
glViewport(0, 0, w, h);
|
||||
|
||||
win_w := w;
|
||||
win_h := h;
|
||||
end;
|
||||
|
||||
procedure mouse(button: integer; state: integer; x: integer; y: integer); cdecl;
|
||||
begin
|
||||
ui.mouse(button, state, x, y);
|
||||
end;
|
||||
|
||||
procedure motion(x: integer; y: integer); cdecl;
|
||||
begin
|
||||
ui.mouseMotion(x, y);
|
||||
end;
|
||||
|
||||
procedure doUI;
|
||||
const
|
||||
formatLabel: array [0..1] of string = ('Combobox item 1', 'Combobox item 2');
|
||||
lbOptions: array [0..2] of string = ('Listbox item 1', 'Listbox item 2', 'Listbox item 2');
|
||||
var
|
||||
none: Rect;
|
||||
formatIdx: integer = 1;
|
||||
Text: string = 'line edit widget';
|
||||
textureRect: Rect;
|
||||
state_false: boolean = false;
|
||||
state_true: boolean = true;
|
||||
val: integer = 1;
|
||||
dval: double = 75;
|
||||
begin
|
||||
none.Rect(0, 0);
|
||||
|
||||
ui._begin;
|
||||
|
||||
//here follows the UI widget test code
|
||||
//each of these tests, will demonstrate the visual of a widget
|
||||
|
||||
ui.beginGroup(GroupFlags_GrowDownFromLeft);
|
||||
|
||||
//label
|
||||
ui.doLabel(none, 'Simple label (style=0)', 0);
|
||||
ui.doLabel(none, 'Simple label (style=1)', 1);
|
||||
|
||||
//button
|
||||
ui.beginGroup(GroupFlags_GrowRightFromTop);
|
||||
ui.doButton(none, 'button up', state_false);
|
||||
ui.doButton(none, 'button down', state_true);
|
||||
ui.endGroup;
|
||||
|
||||
//checkbutton
|
||||
ui.beginGroup(GroupFlags_GrowRightFromTop);
|
||||
ui.doCheckButton(none, 'checkbutton up (style=0)', state_false, 0);
|
||||
ui.doCheckButton(none, 'checkbutton down (style=0)', state_true, 0);
|
||||
ui.endGroup;
|
||||
ui.beginGroup(GroupFlags_GrowRightFromTop);
|
||||
ui.doCheckButton(none, 'checkbutton up (style=1)', state_false, 1);
|
||||
ui.doCheckButton(none, 'checkbutton down (style=1)', state_true, 1);
|
||||
ui.endGroup;
|
||||
|
||||
//radio button
|
||||
ui.beginGroup(GroupFlags_GrowRightFromTop);
|
||||
ui.doRadioButton(2, none, 'radiobutton up (style=0)', val, 0);
|
||||
ui.doRadioButton(1, none, 'radiobutton down (style=0)', val, 0);
|
||||
ui.endGroup;
|
||||
ui.beginGroup(GroupFlags_GrowRightFromTop);
|
||||
ui.doRadioButton(2, none, 'radiobutton up (style=1)', val, 1);
|
||||
ui.doRadioButton(1, none, 'radiobutton down (style=1)', val, 1);
|
||||
ui.endGroup;
|
||||
|
||||
//horizontal slider
|
||||
ui.doHorizontalSlider(none, 0, 100, dval, 0);
|
||||
|
||||
ui.beginGroup(GroupFlags_GrowRightFromTop);
|
||||
//listbox
|
||||
val := 1;
|
||||
ui.doListBox(none, 3, lbOptions, val);
|
||||
|
||||
//combobox
|
||||
ui.doComboBox(none, 2, formatLabel, formatIdx);
|
||||
ui.endGroup;
|
||||
|
||||
//line edit
|
||||
val := 1;
|
||||
ui.beginGroup(GroupFlags_GrowRightFromTop);
|
||||
ui.doLineEdit(none, Text, 100, val);
|
||||
ui.doLineEdit(none, Text, 100, val);
|
||||
ui.endGroup;
|
||||
|
||||
//panel
|
||||
ui.beginGroup(GroupFlags_GrowRightFromTop);
|
||||
ui.beginPanel(none, 'A folding panel', state_true);
|
||||
ui.beginGroup(GroupFlags_GrowRightFromTop);
|
||||
Text := './nvidia-widgets/trunk/src';
|
||||
ui.doLineEdit(none, Text, 100, val);
|
||||
ui.doButton(none, 'Browse', state_false);
|
||||
ui.endGroup;
|
||||
ui.endPanel;
|
||||
|
||||
//ui.beginPanel(none, 'Same panel but now folded', state_false);
|
||||
// ui.beginGroup(GroupFlags_GrowRightFromTop);
|
||||
// ui.doLabel(none, './nvidia-widgets/trunk/src', 1);
|
||||
// ui.doButton(none, 'Browse', state_true, 0);
|
||||
// ui.endGroup;
|
||||
//ui.endPanel;
|
||||
ui.endGroup;
|
||||
|
||||
//frame
|
||||
ui.beginGroup(GroupFlags_GrowDownFromLeft);
|
||||
ui.doLabel(none, 'This is a frame');
|
||||
ui.beginFrame(GroupFlags_GrowRightFromTop, none);
|
||||
ui.beginGroup(GroupFlags_GrowRightFromTop);
|
||||
Text := './nvidia-widgets/trunk/src';
|
||||
ui.doLineEdit(none, Text, 100, val);
|
||||
ui.doButton(none, 'Browse', state_false);
|
||||
ui.endGroup;
|
||||
ui.endFrame;
|
||||
ui.endGroup;
|
||||
|
||||
//listitem
|
||||
ui.doListItem(1, none, 'List item 1', 1, 0);
|
||||
ui.doListItem(2, none, 'List item 2', 1, 1);
|
||||
ui.doListItem(3, none, 'List item 3', 1, 0);
|
||||
ui.doListItem(4, none, 'List item 4', 1, 0);
|
||||
|
||||
//textureview
|
||||
textureRect.Rect(0, 0, 100, 100);
|
||||
ui.doTextureView(textureRect, texture, textureRect);
|
||||
|
||||
ui.endGroup;
|
||||
|
||||
ui._end;
|
||||
end;
|
||||
|
||||
procedure display; cdecl;
|
||||
begin
|
||||
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
glLoadIdentity;
|
||||
doUI;
|
||||
glutSwapBuffers;
|
||||
end;
|
||||
|
||||
var
|
||||
texture_data: array [0..3] of cardinal = ($FFFF0000, $FF0000FF, $FF00FF00, $FF00FF00);
|
||||
|
||||
begin
|
||||
glutInit(@argc, argv);
|
||||
glutInitWindowSize(win_w, win_h);
|
||||
glutInitDisplayMode(GLUT_DOUBLE or GLUT_DEPTH or GLUT_RGB);
|
||||
glutCreateWindow('UI example');
|
||||
|
||||
ui := GlutUIContext.Create;
|
||||
|
||||
if not ui.init(win_w, win_h) then
|
||||
begin
|
||||
writeln('UI initialization failed');
|
||||
closeapp;
|
||||
end;
|
||||
|
||||
glutReportErrors;
|
||||
|
||||
glGenTextures(1, @texture);
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, @texture_data);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glClearColor(0, 0, 0, 1);
|
||||
glutDisplayFunc(@display);
|
||||
|
||||
glutMouseFunc(@mouse);
|
||||
glutMotionFunc(@motion);
|
||||
glutPassiveMotionFunc(@motion);
|
||||
glutIdleFunc(@idle);
|
||||
glutKeyboardFunc(@key);
|
||||
glutSpecialFunc(@special);
|
||||
glutReshapeFunc(@resize);
|
||||
glutMainLoop;
|
||||
end.
|
||||
|
||||
@@ -12,7 +12,8 @@ unit nvGLWidgets;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, nvWidgets, GL;
|
||||
Classes, nvWidgets,
|
||||
GL, ftFont, FPCanvas, GLFreeType;
|
||||
|
||||
const
|
||||
cBase = 0;
|
||||
@@ -123,6 +124,7 @@ type
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy;
|
||||
|
||||
procedure _begin(const window: Rect); override;
|
||||
procedure _end; override;
|
||||
@@ -192,9 +194,10 @@ type
|
||||
|
||||
procedure init; override;
|
||||
private
|
||||
Font: TGLFreeTypeFont;
|
||||
|
||||
m_setupStateDL: integer;
|
||||
m_restoreStateDL: integer;
|
||||
m_textListBase: integer;
|
||||
m_foregroundDL: integer;
|
||||
m_widgetProgram: integer;
|
||||
m_originUniform: integer;
|
||||
@@ -241,7 +244,6 @@ begin
|
||||
inherited;
|
||||
m_setupStateDL := 0;
|
||||
m_restoreStateDL := 0;
|
||||
m_textListBase := 0;
|
||||
m_foregroundDL := 0;
|
||||
m_widgetProgram := 0;
|
||||
m_fillColorUniform := 0;
|
||||
@@ -252,6 +254,13 @@ begin
|
||||
m_texelScaleUniform := 0;
|
||||
m_texelOffsetUniform := 0;
|
||||
m_texelSwizzlingUniform := 0;
|
||||
|
||||
Font.Init('Ubuntu-R.ttf', 10);
|
||||
end;
|
||||
|
||||
destructor GLUIPainter.Destroy;
|
||||
begin
|
||||
Font.Clean;
|
||||
end;
|
||||
|
||||
procedure GLUIPainter._begin(const window: Rect);
|
||||
@@ -785,6 +794,8 @@ end;
|
||||
|
||||
function GLUIPainter.getFontHeight: integer;
|
||||
begin
|
||||
Result := Font.Height;
|
||||
exit;
|
||||
Result := 12 + 4;
|
||||
end;
|
||||
|
||||
@@ -918,26 +929,8 @@ begin
|
||||
end;
|
||||
|
||||
procedure GLUIPainter.drawString(x: integer; y: integer; Text: string; nbLines: integer);
|
||||
var
|
||||
s: TStrings;
|
||||
t: string;
|
||||
i: Integer;
|
||||
begin
|
||||
glListBase(m_textListBase);
|
||||
|
||||
s := TStringList.Create;
|
||||
try
|
||||
s.Text := Text;
|
||||
|
||||
for i := 0 to s.Count - 1 do
|
||||
begin
|
||||
t := s[s.Count - 1 - i];
|
||||
glRasterPos2i(x + 1, y + 4 + i * getFontHeight);
|
||||
glCallLists(Length(t), GL_UNSIGNED_BYTE, @t[1]);
|
||||
end;
|
||||
finally
|
||||
s.Free;
|
||||
end;
|
||||
Font.Print(x, y, Text);
|
||||
end;
|
||||
|
||||
procedure GLUIPainter.drawRect(aRect: Rect; fillColorId: integer; borderColorId: integer);
|
||||
@@ -1099,67 +1092,71 @@ begin
|
||||
y3 := aRect.y + aRect.h;
|
||||
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glTexCoord2f(xb, yb);
|
||||
glVertex2f(x0, y0);
|
||||
glTexCoord2f(0, yb);
|
||||
glVertex2f(x1, y0);
|
||||
glTexCoord2f(xb, 0);
|
||||
glTexCoord2f(xb, yb);
|
||||
glVertex2f(x0, y0);
|
||||
glTexCoord2f(0, yb);
|
||||
glVertex2f(x1, y0);
|
||||
glTexCoord2f(xb, 0);
|
||||
|
||||
glVertex2f(x0, y1);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2f(x1, y1);
|
||||
glTexCoord2f(xb, 0);
|
||||
glVertex2f(x0, y1);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2f(x1, y1);
|
||||
glTexCoord2f(xb, 0);
|
||||
|
||||
glVertex2f(x0, y2);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2f(x1, y2);
|
||||
glTexCoord2f(xb, yb);
|
||||
glVertex2f(x0, y2);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2f(x1, y2);
|
||||
glTexCoord2f(xb, yb);
|
||||
|
||||
glVertex2f(x0, y3);
|
||||
glTexCoord2f(0, yb);
|
||||
glVertex2f(x1, y3);
|
||||
glVertex2f(x0, y3);
|
||||
glTexCoord2f(0, yb);
|
||||
glVertex2f(x1, y3);
|
||||
glEnd;
|
||||
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glTexCoord2f(0, yb);
|
||||
glVertex2f(x2, y0);
|
||||
glTexCoord2f(xb, yb);
|
||||
glVertex2f(x3, y0);
|
||||
glTexCoord2f(0, 0);
|
||||
glTexCoord2f(0, yb);
|
||||
glVertex2f(x2, y0);
|
||||
glTexCoord2f(xb, yb);
|
||||
glVertex2f(x3, y0);
|
||||
glTexCoord2f(0, 0);
|
||||
|
||||
glVertex2f(x2, y1);
|
||||
glTexCoord2f(xb, 0);
|
||||
glVertex2f(x3, y1);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2f(x2, y1);
|
||||
glTexCoord2f(xb, 0);
|
||||
glVertex2f(x3, y1);
|
||||
glTexCoord2f(0, 0);
|
||||
|
||||
glVertex2f(x2, y2);
|
||||
glTexCoord2f(xb, 0);
|
||||
glVertex2f(x3, y2);
|
||||
glTexCoord2f(0, yb);
|
||||
glVertex2f(x2, y3);
|
||||
glTexCoord2f(xb, yb);
|
||||
glVertex2f(x3, y3);
|
||||
glVertex2f(x2, y2);
|
||||
glTexCoord2f(xb, 0);
|
||||
glVertex2f(x3, y2);
|
||||
glTexCoord2f(0, yb);
|
||||
glVertex2f(x2, y3);
|
||||
glTexCoord2f(xb, yb);
|
||||
glVertex2f(x3, y3);
|
||||
glEnd;
|
||||
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glTexCoord2f(0, yb);
|
||||
glVertex2f(x1, y0);
|
||||
glTexCoord2f(0, yb);
|
||||
glVertex2f(x2, y0);
|
||||
glTexCoord2f(0, 0);
|
||||
glTexCoord2f(0, yb);
|
||||
glVertex2f(x1, y0);
|
||||
glTexCoord2f(0, yb);
|
||||
glVertex2f(x2, y0);
|
||||
glTexCoord2f(0, 0);
|
||||
|
||||
glVertex2f(x1, y1);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2f(x2, y1);
|
||||
glVertex2f(x1, y1);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2f(x2, y1);
|
||||
glEnd;
|
||||
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2f(x1, y2);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2f(x2, y2);
|
||||
glTexCoord2f(0, yb);
|
||||
glVertex2f(x1, y3);
|
||||
glTexCoord2f(0, yb);
|
||||
glVertex2f(x2, y3);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2f(x1, y2);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2f(x2, y2);
|
||||
glTexCoord2f(0, yb);
|
||||
glVertex2f(x1, y3);
|
||||
glTexCoord2f(0, yb);
|
||||
glVertex2f(x2, y3);
|
||||
glEnd;
|
||||
|
||||
glUseProgram(0);
|
||||
end;
|
||||
|
||||
@@ -1185,15 +1182,16 @@ begin
|
||||
y1 := aRect.y + aRect.h;
|
||||
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glTexCoord2f(-xb, -yb);
|
||||
glVertex2f(x0, y0);
|
||||
glTexCoord2f(xb, -yb);
|
||||
glVertex2f(x1, y0);
|
||||
glTexCoord2f(-xb, yb);
|
||||
glVertex2f(x0, y1);
|
||||
glTexCoord2f(xb, yb);
|
||||
glVertex2f(x1, y1);
|
||||
glTexCoord2f(-xb, -yb);
|
||||
glVertex2f(x0, y0);
|
||||
glTexCoord2f(xb, -yb);
|
||||
glVertex2f(x1, y0);
|
||||
glTexCoord2f(-xb, yb);
|
||||
glVertex2f(x0, y1);
|
||||
glTexCoord2f(xb, yb);
|
||||
glVertex2f(x1, y1);
|
||||
glEnd;
|
||||
|
||||
glUseProgram(0);
|
||||
end;
|
||||
|
||||
@@ -1219,27 +1217,28 @@ begin
|
||||
glUniform4fv(m_fillColorUniform, 1, @s_colors[fillColorId]);
|
||||
glUniform4fv(m_borderColorUniform, 1, @s_colors[borderColorId]);
|
||||
glUniform2f(m_zonesUniform, (xb) - 1, (xb) - 2);
|
||||
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glTexCoord3f(-xb, -yb, 0);
|
||||
glVertex2f(x0, y1 + yoff);
|
||||
glTexCoord3f(xb, -yb, 0);
|
||||
glVertex2f(x0, y1 - yoff);
|
||||
glTexCoord3f(-xb, 0, 0);
|
||||
glVertex2f(x0 + xoff, y1 + yoff);
|
||||
glTexCoord3f(xb, 0, 0);
|
||||
glVertex2f(x0 + xoff, y1 - yoff);
|
||||
glTexCoord3f(-xb, 0, 0);
|
||||
|
||||
glTexCoord3f(-xb, -yb, 0);
|
||||
glVertex2f(x0, y1 + yoff);
|
||||
glTexCoord3f(xb, -yb, 0);
|
||||
glVertex2f(x0, y1 - yoff);
|
||||
glTexCoord3f(-xb, 0, 0);
|
||||
glVertex2f(x0 + xoff, y1 + yoff);
|
||||
glTexCoord3f(xb, 0, 0);
|
||||
glVertex2f(x0 + xoff, y1 - yoff);
|
||||
glTexCoord3f(-xb, 0, 0);
|
||||
glVertex2f(x1 - xoff, y1 + yoff);
|
||||
glTexCoord3f(xb, 0, 0);
|
||||
glVertex2f(x1 - xoff, y1 - yoff);
|
||||
glTexCoord3f(-xb, -yb, 0);
|
||||
|
||||
glVertex2f(x1 - xoff, y1 + yoff);
|
||||
glTexCoord3f(xb, 0, 0);
|
||||
glVertex2f(x1 - xoff, y1 - yoff);
|
||||
glTexCoord3f(-xb, -yb, 0);
|
||||
|
||||
glVertex2f(x1, y1 + yoff);
|
||||
glTexCoord3f(xb, -yb, 0);
|
||||
glVertex2f(x1, y1 - yoff);
|
||||
glVertex2f(x1, y1 + yoff);
|
||||
glTexCoord3f(xb, -yb, 0);
|
||||
glVertex2f(x1, y1 - yoff);
|
||||
glEnd;
|
||||
|
||||
glUseProgram(0);
|
||||
end;
|
||||
|
||||
@@ -1355,6 +1354,7 @@ begin
|
||||
glTexCoord3f(xb, -yb, 0);
|
||||
glVertex2f(x1 - yoff, y2);
|
||||
glEnd;
|
||||
|
||||
glUseProgram(0);
|
||||
end;
|
||||
|
||||
@@ -1390,44 +1390,44 @@ begin
|
||||
glUniform4fv(m_fillColorUniform, 1, @s_colors[fillColorId]);
|
||||
glUniform4fv(m_borderColorUniform, 1, @s_colors[borderColorId]);
|
||||
glUniform2f(m_zonesUniform, (xb) - 1, (xb) - 2);
|
||||
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glTexCoord3f(-xb, -yb, 0);
|
||||
glVertex2f(x0, y1 + yoff2);
|
||||
glTexCoord3f(xb, -yb, 0);
|
||||
glVertex2f(x0 - xoff2, y1);
|
||||
glTexCoord3f(-xb, 0, 0);
|
||||
glVertex2f(x0 + xoff, y1 + yoff);
|
||||
glTexCoord3f(xb, 0, 0);
|
||||
glVertex2f(x0 - xoff, y1 - yoff);
|
||||
glTexCoord3f(-xb, 0, xb);
|
||||
|
||||
glTexCoord3f(-xb, -yb, 0);
|
||||
glVertex2f(x0, y1 + yoff2);
|
||||
glTexCoord3f(xb, -yb, 0);
|
||||
glVertex2f(x0 - xoff2, y1);
|
||||
glTexCoord3f(-xb, 0, 0);
|
||||
glVertex2f(x0 + xoff, y1 + yoff);
|
||||
glTexCoord3f(xb, 0, 0);
|
||||
glVertex2f(x0 - xoff, y1 - yoff);
|
||||
glTexCoord3f(-xb, 0, xb);
|
||||
glVertex2f(x1, y0 + yoff2);
|
||||
glTexCoord3f(xb, 0, xb);
|
||||
glVertex2f(x1 - xoff2, y0);
|
||||
glTexCoord3f(xb, 2 * yb, xb);
|
||||
|
||||
glVertex2f(x1, y0 + yoff2);
|
||||
glTexCoord3f(xb, 0, xb);
|
||||
glVertex2f(x1 - xoff2, y0);
|
||||
glTexCoord3f(xb, 2 * yb, xb);
|
||||
|
||||
glVertex2f(x1, y0 - yoff2);
|
||||
glVertex2f(x1, y0 - yoff2);
|
||||
glEnd;
|
||||
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glTexCoord3f(xb, -yb, 0);
|
||||
glVertex2f(x2 + xoff2, y1);
|
||||
glTexCoord3f(-xb, -yb, 0);
|
||||
glVertex2f(x2, y1 + yoff2);
|
||||
glTexCoord3f(xb, 0, xb);
|
||||
glTexCoord3f(xb, -yb, 0);
|
||||
glVertex2f(x2 + xoff2, y1);
|
||||
glTexCoord3f(-xb, -yb, 0);
|
||||
glVertex2f(x2, y1 + yoff2);
|
||||
glTexCoord3f(xb, 0, xb);
|
||||
|
||||
glVertex2f(x2 + xoff, y1 - yoff);
|
||||
glTexCoord3f(-xb, 0, xb);
|
||||
glVertex2f(x2 - xoff, y1 + yoff);
|
||||
glTexCoord3f(xb, 0, xb);
|
||||
glVertex2f(x2 + xoff, y1 - yoff);
|
||||
glTexCoord3f(-xb, 0, xb);
|
||||
glVertex2f(x2 - xoff, y1 + yoff);
|
||||
glTexCoord3f(xb, 0, xb);
|
||||
|
||||
glVertex2f(x1 + xoff2, y0);
|
||||
glTexCoord3f(-xb, 0, xb);
|
||||
glVertex2f(x1, y0 + yoff2);
|
||||
glTexCoord3f(xb, 2 * yb, xb);
|
||||
glVertex2f(x1 + xoff2, y0);
|
||||
glTexCoord3f(-xb, 0, xb);
|
||||
glVertex2f(x1, y0 + yoff2);
|
||||
glTexCoord3f(xb, 2 * yb, xb);
|
||||
|
||||
glVertex2f(x1, y0 - yoff2);
|
||||
glVertex2f(x1, y0 - yoff2);
|
||||
glEnd;
|
||||
|
||||
glUseProgram(0);
|
||||
@@ -1465,44 +1465,44 @@ begin
|
||||
glUniform4fv(m_fillColorUniform, 1, @s_colors[fillColorId]);
|
||||
glUniform4fv(m_borderColorUniform, 1, @s_colors[borderColorId]);
|
||||
glUniform2f(m_zonesUniform, (xb) - 1, (xb) - 2);
|
||||
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glTexCoord3f(-xb, -yb, 0);
|
||||
glVertex2f(x0, y1 + yoff2);
|
||||
glTexCoord3f(xb, -yb, 0);
|
||||
glVertex2f(x0 - xoff2, y1);
|
||||
glTexCoord3f(-xb, 0, 0);
|
||||
glVertex2f(x0 + xoff, y1 + yoff);
|
||||
glTexCoord3f(xb, 0, 0);
|
||||
glVertex2f(x0 - xoff, y1 - yoff);
|
||||
glTexCoord3f(-xb, 0, xb);
|
||||
|
||||
glTexCoord3f(-xb, -yb, 0);
|
||||
glVertex2f(x0, y1 + yoff2);
|
||||
glTexCoord3f(xb, -yb, 0);
|
||||
glVertex2f(x0 - xoff2, y1);
|
||||
glTexCoord3f(-xb, 0, 0);
|
||||
glVertex2f(x0 + xoff, y1 + yoff);
|
||||
glTexCoord3f(xb, 0, 0);
|
||||
glVertex2f(x0 - xoff, y1 - yoff);
|
||||
glTexCoord3f(-xb, 0, xb);
|
||||
glVertex2f(x1, y0 + yoff2);
|
||||
glTexCoord3f(xb, 0, xb);
|
||||
glVertex2f(x1 - xoff2, y0);
|
||||
glTexCoord3f(xb, 2 * yb, xb);
|
||||
|
||||
glVertex2f(x1, y0 + yoff2);
|
||||
glTexCoord3f(xb, 0, xb);
|
||||
glVertex2f(x1 - xoff2, y0);
|
||||
glTexCoord3f(xb, 2 * yb, xb);
|
||||
|
||||
glVertex2f(x1, y0 - yoff2);
|
||||
glVertex2f(x1, y0 - yoff2);
|
||||
glEnd;
|
||||
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glTexCoord3f(xb, -yb, 0);
|
||||
glVertex2f(x2 + xoff2, y1);
|
||||
glTexCoord3f(-xb, -yb, 0);
|
||||
glVertex2f(x2, y1 + yoff2);
|
||||
glTexCoord3f(xb, 0, xb);
|
||||
glTexCoord3f(xb, -yb, 0);
|
||||
glVertex2f(x2 + xoff2, y1);
|
||||
glTexCoord3f(-xb, -yb, 0);
|
||||
glVertex2f(x2, y1 + yoff2);
|
||||
glTexCoord3f(xb, 0, xb);
|
||||
|
||||
glVertex2f(x2 + xoff, y1 - yoff);
|
||||
glTexCoord3f(-xb, 0, xb);
|
||||
glVertex2f(x2 - xoff, y1 + yoff);
|
||||
glTexCoord3f(xb, 0, xb);
|
||||
glVertex2f(x2 + xoff, y1 - yoff);
|
||||
glTexCoord3f(-xb, 0, xb);
|
||||
glVertex2f(x2 - xoff, y1 + yoff);
|
||||
glTexCoord3f(xb, 0, xb);
|
||||
|
||||
glVertex2f(x1 + xoff2, y0);
|
||||
glTexCoord3f(-xb, 0, xb);
|
||||
glVertex2f(x1, y0 + yoff2);
|
||||
glTexCoord3f(xb, 2 * yb, xb);
|
||||
glVertex2f(x1 + xoff2, y0);
|
||||
glTexCoord3f(-xb, 0, xb);
|
||||
glVertex2f(x1, y0 + yoff2);
|
||||
glTexCoord3f(xb, 2 * yb, xb);
|
||||
|
||||
glVertex2f(x1, y0 - yoff2);
|
||||
glVertex2f(x1, y0 - yoff2);
|
||||
glEnd;
|
||||
|
||||
glUseProgram(0);
|
||||
@@ -1593,19 +1593,6 @@ begin
|
||||
end;
|
||||
glEndList;
|
||||
end;
|
||||
|
||||
if m_textListBase = 0 then
|
||||
begin
|
||||
//just doing 7-bit ascii
|
||||
m_textListBase := glGenLists(128);
|
||||
|
||||
for ii := 0 to 127 do
|
||||
begin
|
||||
glNewList(m_textListBase + ii, GL_COMPILE);
|
||||
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, ii);
|
||||
glEndList;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user