PDA

View Full Version : frontend for emulators in opengl



azrael11
05-10-2010, 05:01 PM
I started a new project a frontend for emulators in opengl .

I use the dglopengl.pas header for opengl and bass.pas for music.
I made the fonts with the great font studio by nitrogen but i have a little problem.

I get the fonts upside down

Do you have any simple code that i can load mulptiple fonts and display correctly?

I found a Font4.pas but i get access violation so ....

i am waiting for your help.....

here is a screenshot but the fonts is from windows directly and i want to use the cool bitmap fonts...

http://img375.imageshack.us/img375/4846/extrafe.gif

WILL
05-10-2010, 07:18 PM
I think I know what you might be doing. :)

Double check your code for the order in which you set your vectors after you set to draw with QUADS. You must start with the top-left, then go to the top-right, bottom-right, bottom-left. If you don't do this for both, you can get flipped or rotated drawing.

chronozphere
05-10-2010, 09:31 PM
So, you tried to make it work with bitmap fonts, but they were rendered upside down?

In most image formats, the first pixel is the top-left most. However, OpenGL reads the image upside down, so the first pixel is the bottom-left pixel. To solve this, you could just flip the w-axis of your texture coordinates when you are rendering.

More info can be found here: http://www.opengl.org/resources/features/KilgardTechniques/oglpitfall/ (Section 12).

Good luck!

azrael11
07-10-2010, 04:08 AM
i thought my brain i blurry...
I try but my limited knowledge in opengl cant help me to find the problem so i need your help again...
here is the code of the two units i use



unit main;

interface

uses
Windows, Messages, SysUtils, Variants,
Classes, Graphics, Controls, Forms,Font2,dglOpenGL;

type

Rec = object
X,Y: single;
Txt: string;
Fade, HW, Scale: single;
Stage, StageTime, LastTime: integer;
Font: integer;
PRocedure Init(xx,yy: single;fn: integer;tt: string);
Procedure QuickInit;
Procedure Draw;
end;


TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
procedure StartOpenGl;
procedure EndOpenGl;
procedure FullScreen(pWidth, pHeight, pBPP, pFrequency : Word);
procedure ApplicationEventsIdle(Sender: TObject; var Done: Boolean);
end;

var
Form1: TForm1;
RC : HGLRC;
DC : HDC;
h_Wnd : HWND; // Global window handle
h_DC : HDC; // Global device context
h_RC : HGLRC; // OpenGL rendering context
glWidth, glHeight: integer;
keys : Array[0..255] of Boolean; // Holds keystrokes
FPSCount : Integer = 0; // Counter for FPS
ElapsedTime : Integer; // Elapsed time between frames
fnt: array[0..3] of TFontObj;
R: Array[0..50] of Rec;

Messages2: array[0..10] of string = ( 'Free'
, 'Fast Rendering'
, 'Alpha Channel'
, 'Crisp and Clear'
, 'Infinite Variety'
, 'Flexible Studio'
, 'Small File Sizes'
, 'Cool Fonts'
, 'Simple Intergration'
, 'Supports Internation Character Sets.'
, 'C++ and Delphi Support.');


StartTick : Cardinal;
Frames : Integer;
FPS : Single;
MyFont : TFontObj;
FontBase: GLUInt;
i: Single;
xAngle,yAngle,zAngle,xSpeed,ySpeed,zSpeed: Single;

implementation

{$R *.dfm}

{ TForm1 }


procedure TForm1.ApplicationEventsIdle(Sender: TObject; var Done: Boolean);
var
intFPS,l: Integer;
begin
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glLoadIdentity();
glOrtho(0,1024,768,0,-700,700);
intFPS := Trunc(FPS);
glPushMatrix;
gltranslatef(0,0, 0);
{for l := 0 to high(R) do
begin
R[l].Draw;
end;}
fnt[1].Draw(10,50,'simple time',0);
fnt[0].Draw(10,100,'simple time');
fnt[2].Draw(10,150,'simple time');
fnt[3].Draw(10,200,'simple time');
{fnt[1].Draw(400,500,'Y = '+FloatToStr(yAngle));
fnt[1].Draw(10,110,'Z = '+FloatToStr(zAngle));
fnt[1].Draw(100,400,'you');
fnt[3].Draw(100,100,'you');
fnt[2].Draw(0,200,0,0,0,'you');
fnt[1].Draw(0,-60,0,0,0,'you');
fnt[1].Draw(0,0,xAngle,0,0,IntToStr(intFPS)+' Frames per second');}

glPopMatrix;
if GetTickCount - StartTick >= 500 then
begin
FPS := Frames/(GetTickCount-StartTick)*1000;
Frames := 0;
StartTick := GetTickCount;
end;
SwapBuffers(DC);
Done := False;
inc(Frames);
xAngle :=xAngle + xSpeed;
yAngle :=yAngle + ySpeed;
zAngle :=zAngle + zSpeed;
end;

procedure TForm1.EndOpenGl;
begin
//DeactivateRenderingContext;
wglDeleteContext(RC);
ReleaseDC(Handle, DC);
ChangeDisplaySettings(devmode(nil^), 0);
end;

procedure TForm1.FullScreen(pWidth, pHeight, pBPP, pFrequency : Word);
var
dmScreenSettings : DevMode;
begin
WindowState := wsMaximized;
BorderStyle := bsNone;
ZeroMemory(@dmScreenSettings, SizeOf(dmScreenSettings));
with dmScreenSettings do
begin
dmSize := SizeOf(dmScreenSettings);
dmPelsWidth := pWidth;
dmPelsHeight := pHeight;
dmBitsPerPel := pBPP;
dmDisplayFrequency := pFrequency;
dmFields := DM_PELSWIDTH or DM_PELSHEIGHT or DM_BITSPERPEL or DM_DISPLAYFREQUENCY;
end;
if (ChangeDisplaySettings(dmScreenSettings, CDS_FULLSCREEN) = DISP_CHANGE_FAILED) then
begin
MessageBox(0, 'Fullscreen is inpossible!!! ', 'Error', MB_OK or MB_ICONERROR);
exit
end;
end;

procedure TForm1.StartOpenGl;
begin
Fullscreen(1024, 768, 32, 85);
InitOpenGL;
DC := GetDC(Handle);
RC := CreateRenderingContext(DC, [opDoubleBuffered], 32, 24, 0, 0, 0, 0);
ActivateRenderingContext(DC, RC);
glShadeModel(GL_SMOOTH); // Enables Smooth Color Shading
glClearDepth(1.0); // Depth Buffer Setup
glClearColor(0.1, 0.1, 0.1, 0.0); // Black Background
glColor4f(1,1,1,1);
glDisable(GL_DEPTH_TEST); // Enable Depth Buffer
glDepthFunc(GL_LEQUAL); // The Type Of Depth Test To Do
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glDisable(GL_LIGHTING);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); //Realy Nice perspective calculations
//LoadSelectPage;

StartTick := GetTickCount;
Application.OnIdle := ApplicationEventsIdle;
end;


procedure TForm1.FormCreate(Sender: TObject);
var
x: Integer;
begin
StartOpenGl;
xSpeed := 0.0;
ySpeed := 0.1;
zSpeed := 0.0;
for X := 0 to high(Fnt) do
fnt[X] := TFontObj.Create('font'+inttostr(x)+'.fnt');

for X := 0 to high(R) do
R[X].QuickInit;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
EndOpenGl;
end;

{ Rec }

Procedure Rec.QuickInit ;
begin
Init(random*glWidth, random*glHeight, random(length(fnt)), Messages2[random(length(messages2))]);
end;

PRocedure Rec.Init(xx,yy: single;fn: integer;tt: string);
begin
StageTime := random(2000)+1000;
Scale := random*1.5+0.2;
X := Xx;
Y := Yy;
Txt := Tt;
Font := fn;
HW := Fnt[Fn].TextLen(Txt)*0.5;
Stage := 0;
Fade := 0;
LAstTime := GetTickCount;
end;
Procedure Rec.Draw;
begin
glPushMatrix;
gltranslatef(x-Hw, y, 0);
glScalef(Scale, Scale, Scale);
Fade := (GetTickCount-LastTime)/StageTime;

case Stage of
0: fnt[font].FadeIn(0,0, Txt, Fade, 8);
1: begin
glColor4f(255,1,255,1);
fnt[font].Draw(0,0, Txt, 0);
end;
2: fnt[font].FadeOut(0,0,Txt,Fade,8);
3: ;
end;


if (GetTickCount-LastTime) > StageTime then
begin
inc(Stage);
if Stage = 4 then
begin
Stage := 0;
QuickInit;
end;
LastTime := GetTickCount;
end;



glPopMatrix;

end;


end.

azrael11
07-10-2010, 04:20 AM
unit Font2;
interface
Uses dglOpenGL;
type
FontRect = Record
T1,U1,T2,U2, W, H, KernW: single;
end;
TFontObj = class
F: array of FontRect;
StartChar, FontLen, CharOffset: integer;
TexInd: glUInt;
SpaceWidth, AverageHeight: single;
constructor Create(filename: string); overload;
constructor Create; overload;
Procedure Load(const Path:string);
Procedure Draw(Const X,Y: single;Const Txt:string; Lev:single); Overload;
Procedure Draw(Const X,Y: single;Const Txt:string); overload;
Procedure DrawCentered(Const X,Y: single;Const Txt:string);
Procedure FadeIn(Const X,Y: single; Const Txt: string; Percent, Thres: single);
Procedure FadeOut(Const X,Y: single; Const Txt: string; Percent, Thres: single);
Function TextLen(Const Txt: string): single;
end;
Procedure DrawQuadRT(X, Y, Wid, Hgt, Lev, Tu, Tu2, Tv,Tv2: single);
implementation
Uses Classes, Windows, JPEG, Graphics, SysUtils,main;
constructor TFontObj.Create(filename: string);
begin
Inherited Create;
Load(filename);
end;
constructor TFontObj.Create;
begin
inherited Create;
end;
function CreateTexture(Width, Height, Format : Word; pData : Pointer; Mipmap: boolean) : Integer;
var
Texture : GLuint;
begin
glGenTextures(1, @Texture);
glBindTexture(GL_TEXTURE_2D, Texture);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
if Mipmap then
begin
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
end
else
begin
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
end;
if Format = GL_RGBA then
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, pData)
else
gluBuild2DMipmaps(GL_TEXTURE_2D, format, Width, Height, format, GL_UNSIGNED_BYTE, pData);

result :=Texture;
end;
function LoadJPGs(Filename1, Filename2: String; var Texture: GLuint): Boolean;
var
Data : Array of Byte;
W, Width : Integer;
H, Height : Integer;
BMP : TBitmap;
JPG: TJPEGImage;
C : LongWord;
Line : PByteArray;

MaxSize: integer;
TD: Array of LongWord;
ScaleF: single;
OldW, OldH, X, Y, I: integer;
begin
result :=FALSE;
JPG:=TJPEGImage.Create;

try
JPG.LoadFromFile(Filename1);
except
MessageBox(0, PChar('Couldn''t load JPG - "'+ Filename1 +'"'), PChar('BMP Unit'), MB_OK);
Exit;
end;
// Create Bitmap
BMP:=TBitmap.Create;
BMP.pixelformat:=pf24bit;
BMP.width:=JPG.width;
BMP.height:=JPG.height;
BMP.canvas.draw(0,0,JPG); // Copy the JPEG onto the Bitmap
Width :=BMP.Width;
Height :=BMP.Height;
SetLength(Data, Width*Height*4);
For H:=0 to Height-1 do
Begin
Line :=BMP.scanline[Height-H-1]; // flip JPEG
For W:=0 to Width-1 do
Begin
Data[(W*4)+(H*Width*4)] := Line[W*3];
Data[(W*4)+1+(H*Width*4)] := Line[W*3+1];
Data[(W*4)+2+(H*Width*4)] := Line[W*3+2];
End;
End;
try
JPG.LoadFromFile(Filename2);
except
MessageBox(0, PChar('Couldn''t load JPG - "'+ Filename2 +'"'), PChar('BMP Unit'), MB_OK);
Exit;
end;
BMP.canvas.draw(0,0,JPG); // Copy the JPEG onto the Bitmap
For H:=0 to Height-1 do
Begin
Line :=BMP.scanline[Height-H-1]; // flip JPEG
For W:=0 to Width-1 do
Begin
Data[(W*4)+3+(H*Width*4)] := Line[W*3];
End;
End;
BMP.free;
JPG.free;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, @MaxSize);
OldW := -1;
if width > Height then
begin
if width > Maxsize then
begin
ScaleF := MaxSize / width;
OldW := width;
OldH := Height;
width := Maxsize;
Height := round(Height*ScaleF);
end;
end
else
begin
if height > Maxsize then
begin
ScaleF := MaxSize / height;
OldW := width;
OldH := Height;
height := Maxsize;
width := round(width*ScaleF);
end;
end;
if OldW > -1 then
begin
ScaleF := 1/ScaleF;
SetLength(TD, Width*Height);
For X := 0 to Width-1 do
For Y := 0 to Height-1 do
begin
TD[(Y*Width+X)] := data[
round(((Y*OldW)*ScaleF+(X*ScaleF)))];
end;
SetLength(Data, Width*Height);
For Y := 0 to high(Td) do
Data[Y] := Td[Y];
SetLength(TD, 0);
end;
Texture :=CreateTexture(Width, Height, GL_RGBA, addr(Data[0]), true);
result :=TRUE;
end;
Procedure DrawQuadRT(X, Y, Wid, Hgt, Lev, Tu, Tu2, Tv,Tv2: single);
begin
Tv := 1-Tv;
Tv2 := 1-Tv2;
glBegin(GL_QUADS);
glTexCoord2f(Tu, Tv); glVertex3f(X, Y, -lev);
glTexCoord2f(Tu2, Tv); glVertex3f(X+Wid, Y, -lev);
glTexCoord2f(Tu2,Tv2); glVertex3f(X+Wid, Y-Hgt, -lev);
glTexCoord2f(Tu, Tv2); glVertex3f(X, Y-Hgt, -lev);
glEnd;
end;

Procedure TFontObj.Load(Const Path:string);
Var Fi, F2: TfileStream;
I, Data: integer;
StPos, CtPos: longint;
Other: string;
begin
Setlength(F, 1);
FontLen := 0;
if Not FileExists(Path) then
begin
MessageBox(0, pchar(Path + ' was not found.'), 'Missing File', MB_OK or MB_ICONERROR);
exit;
end;
SpaceWidth := 5;
Other := Copy(Path, 1, length(Path)-3)+'jpg';
Fi := TFileStream.Create(Path, $0000);
F2 := Tfilestream.Create(Other, FmCreate or $0000);
Fi.Seek(-(sizeof(longint)*2), soFromEnd);
Fi.Read(Ctpos, sizeof(longint));
Fi.Read(Stpos, sizeof(longint));
Fi.Seek(Ctpos, soFromBeginning);
F2.CopyFrom(Fi, StPos-CtPos-1);
F2.Free;
Fi.Seek(Stpos, soFromBeginning);
Fi.Read(Data, Sizeof(integer));
FontLen := Data;
Fi.Read(Data, Sizeof(integer));
StartChar := Data;
Fi.Read(Data, Sizeof(integer));
CharOffset := Data;
Fi.Read(Data, Sizeof(integer));
SpaceWidth := Data;
Setlength(F, FontLen+1);
AverageHeight := 0;
For I := 0 to high(F) do
begin
Fi.Read(F[I], sizeof(FontRect));
AverageHeight := AverageHeight + F[I].H;
end;
AverageHeight := AverageHEight / (FontLen+1);
Fi.Free;
LoadJpgs(Path, Other, TexInd);
DeleteFile(Other);
end;

Function TFontObj.TextLen(Const Txt:string): single;
Var I, Let: integer;
Len: single;
begin
Len := 0;
For I := 0 to length(Txt) do
begin
if Txt[I] = ' ' then
Len := Len + SpaceWidth
else
begin
Let := Ord(Txt[I])-StartChar;
if (Let <> -1) then
begin
Len := Len + F[Let].KernW;
end
else
Len := Len + SpaceWidth;
end;
end;
Result := Len;
end;

Procedure TFontObj.DrawCentered(Const X,Y: single;Const Txt:string);
var Hw, Hh: single;
begin
Hw := TextLen(Txt)*0.5;
Hh := AverageHeight*0.5;
Draw(X-Hw, Y+Hh, Txt, 0);
end;

Procedure TFontObj.FadeIn(Const X,Y: single; Const Txt: string; Percent, Thres: single);
Var I, Let, Len: integer;
Xx, Fr, Cutoff: Single;
begin
if txt = '' then exit;
Len := Length(Txt);
Percent := Percent*(1+(Thres/Len));
if Percent < 0.001 then exit;
Xx := X;
Fr := Len*Percent;
glBindTexture(GL_TEXTURE_2D, TexInd);
For I := 1 to len do
begin
Cutoff := (Fr-I);
if Cutoff >= 0 then
begin
if Cutoff > Thres then
glColor4f(1,1,1,1)
else
glColor4f(1,1,1,Cutoff/Thres);
end
else
begin
glColor4f(1,1,1,0);
end;

if Txt[I] = ' ' then
Xx := Xx + SpaceWidth
else
begin
Let := Ord(Txt[I])-StartChar;
if ((Let > -1) and not (let > FontLen)) {and (not (Let+StartChar) = 32)} then
begin
DrawQuadRT(Xx,Y, F[Let].W,F[Let].H,0,F[Let].T1,F[Let].T2,F[Let].U1,F[Let].U2);
Xx := Xx + F[Let].KernW;
end
else
Xx := Xx + SpaceWidth;
end;
end;
glColor4f(1,1,1,1);
end;
Procedure TFontObj.FadeOut(Const X,Y: single; Const Txt: string; Percent, Thres: single);
Var I, Let, Len: integer;
Xx, Fr, Cutoff: Single;
begin
if txt = '' then exit;
Len := Length(Txt);
Percent := Percent*(1+(Thres/Len));
Xx := X;
Fr := Len*Percent;
glBindTexture(GL_TEXTURE_2D, TexInd);
For I := 1 to len do
begin
Cutoff := (Fr-I);
if Cutoff >= 0 then
begin
if Cutoff > Thres then
glColor4f(1,1,1,0)
else
glColor4f(1,1,1,1-(Cutoff/Thres));
end
else
begin
glColor4f(1,1,1,1);
end;
if Txt[I] = ' ' then
Xx := Xx + SpaceWidth
else
begin
Let := Ord(Txt[I])-StartChar;
if ((Let > -1) and not (let > FontLen)) {and (not (Let+StartChar) = 32)} then
begin
DrawQuadRT(Xx,Y, F[Let].W,F[Let].H,0,F[Let].T1,F[Let].T2{+0.005},F[Let].U1,F[Let].U2{+0.005});
Xx := Xx + F[Let].KernW;
end
else
Xx := Xx + SpaceWidth;
end;
end;
end;


Procedure TFontObj.Draw(Const X,Y: single;Const Txt:string; Lev:single);
Var I, Let: integer;
Xx: Single;
begin
if txt = '' then exit;
glBindTexture(GL_TEXTURE_2D, TexInd);
For I := 1 to length(Txt) do
begin
if Txt[I] = ' ' then
Xx := Xx + SpaceWidth
else
begin
Let := Ord(Txt[I])-StartChar;
if ((Let > -1) and not (let > FontLen)) {and (not (Let+StartChar) = 32)} then
begin
DrawQuadRT(Xx,Y, F[Let].W,F[Let].H,Lev,F[Let].T1,F[Let].T2{-0.005},F[Let].U1,F[Let].U2{-0.005});
Xx := Xx + F[Let].KernW;
end
else
Xx := Xx + SpaceWidth;
end;
end;
end;

Procedure TFontObj.Draw(Const X,Y: single;Const Txt:string);
begin
Draw(X,Y, Txt, 0);
end;
end.

and some other thing
You see in the code i try to write four lines with text the result i get is
something like this...
text
text
___text
______text
Thank you

chronozphere
07-10-2010, 07:16 AM
First of all, PLEASE put empty lines between your procedures/functions. Without them, the code is quite hard to read (for me atleast).

You should be looking here:


Procedure DrawQuadRT(X, Y, Wid, Hgt, Lev, Tu, Tu2, Tv,Tv2: single);
begin
Tv := 1-Tv; //<< comment this line and the next one
Tv2 := 1-Tv2;
glBegin(GL_QUADS);
glTexCoord2f(Tu, Tv); glVertex3f(X, Y, -lev);
glTexCoord2f(Tu2, Tv); glVertex3f(X+Wid, Y, -lev);
glTexCoord2f(Tu2,Tv2); glVertex3f(X+Wid, Y-Hgt, -lev);
glTexCoord2f(Tu, Tv2); glVertex3f(X, Y-Hgt, -lev);
glEnd;
end;


The calls to glTexcoord2f() are used to specify texture coordinates. If your text is upside down, you should flip the coordinates to make it work. Play arround with this. Try to remove the first two lines, or swap Tv by Tv2.

Good luck!

User137
07-10-2010, 11:37 AM
I think what sometimes causes confusion with OpenGL is difference to perspective and ortho coordinates. Perspective is the default way to render, with positive side going up and ortho positive is to down side.

I don't know if you use perspective but same draw function is usually not good for both. It is possible to play around with:
glScale(1,-1,1) // You can flip the coordinate system around if you want
glRotate(180,1,0,0)
glCullFace // You can rotate the image 180 around X axis and draw only the back face
glDisable(GL_CULL_FACE) // Or you can use this to simply draw both sides
(and enable back when needed for example 3D models)

azrael11
07-10-2010, 12:49 PM
First of all, PLEASE put empty lines between your procedures/functions. Without them, the code is quite hard to read (for me atleast).

You should be looking here:


Procedure DrawQuadRT(X, Y, Wid, Hgt, Lev, Tu, Tu2, Tv,Tv2: single);
begin
Tv := 1-Tv; //<< comment this line and the next one
Tv2 := 1-Tv2;
glBegin(GL_QUADS);
glTexCoord2f(Tu, Tv); glVertex3f(X, Y, -lev);
glTexCoord2f(Tu2, Tv); glVertex3f(X+Wid, Y, -lev);
glTexCoord2f(Tu2,Tv2); glVertex3f(X+Wid, Y-Hgt, -lev);
glTexCoord2f(Tu, Tv2); glVertex3f(X, Y-Hgt, -lev);
glEnd;
end;


The calls to glTexcoord2f() are used to specify texture coordinates. If your text is upside down, you should flip the coordinates to make it work. Play arround with this. Try to remove the first two lines, or swap Tv by Tv2.

Good luck!

Thank you my friend as you say i change the Tv by Tv2 and the opposite and it works...

I still have the problem with the text position from different fonts but i think i found and awnser...

Thank you all of you for helping me.

Soon i'll post the the .exe file if you want to try it .... ;)

Nitrogen
07-10-2010, 08:45 PM
If you are using Font4.pas to render out the Font Studio fonts (that procedure above comes from / was derived from Font4.pas) then it will draw the bitmap font characters upside down by default because of this line:



const
USE_INVERTED = true; //Use this if you use inverted GL coordinates
//where (0,0) is the top left corner.


I see you've just fixed it manually, but setting that to false may have fixed it too.

chronozphere
07-10-2010, 08:53 PM
Interesting. I faced this problem a long time ago, but I probably overlooked that constant. Thanks for the heads up. ;)

azrael11
09-10-2010, 04:05 PM
If you are using Font4.pas to render out the Font Studio fonts (that procedure above comes from / was derived from Font4.pas) then it will draw the bitmap font characters upside down by default because of this line:



const
USE_INVERTED = true; //Use this if you use inverted GL coordinates
//where (0,0) is the top left corner.


I see you've just fixed it manually, but setting that to false may have fixed it too.

Oh my god so simply so simply
Thanks nitrogen...

azrael11
09-10-2010, 04:06 PM
Interesting. I faced this problem a long time ago, but I probably overlooked that constant. Thanks for the heads up. ;)

What can i say me too ;)