if not VisDataThread.UseOpenGL
then
begin
if SoInfo.Title <> '
'
then
begin
BassSoVis1.DrawSongName(VisCanvas);
BassSoVis1.DrawTime(VisCanvas);
GetFramesInSec;
BassSoVis1.DrawFramesPerSecond(VisCanvas, FPS);
end;
if (
not BitBlt(canvas, VisInfo^.x, VisInfo^.y, VisInfo^.w, VisInfo^.h, VisInfo^.VisDC, 0,
0, SRCCOPY))
then
begin
asm
FNCLEX
end;
Set8087CW(FPWord);
VisInfo^.Rendering := False;
BassFuncs^.SetError(BASS_ERROR_DEVICE);
Exit;
end;
end else
begin
// OpenGL-Funtionen initialisieren
if glDC = 0
then
begin
LastWidth := 0;
LastHeight := 0;
// Gdi initialisieren
if InitGDI = 0
then
Halt;
if not InitOpenGL
then
Halt;
glDC := canvas;
// Renderkontext erstellen (32 Bit Farbtiefe,
// 32 Bit Tiefenpuffer, Doublebuffering)
h_RC := CreateRenderingContext(glDc,
[opDoubleBuffered], 32, 32, 0, 0, 0, 0);
// Erstellten Renderkontext aktivieren
ActivateRenderingContext(glDc, h_RC, True);
// initialize TextSuite
Init_TextSuite;
VBL2(vsmSync);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear (GL_COLOR_BUFFER_BIT);
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, VisInfo^.w, VisInfo^.h, 0,
GL_BGRA_EXT, GL_UNSIGNED_BYTE, VisInfo^.VisBuf);
end;
w := VisInfo^.w;
h := VisInfo^.h;
if(LastWidth <> w)
and (LastHeight <> h)
then
begin
LastWidth := w;
LastHeight := h;
SetRect(NextVisRect,
w - (64 + 16),
h - (64 + 16),
w - (64 + 16) + 64,
h - (64 + 16) + 64);
SetRect(PrevVisRect,
(16),
h - (64 + 16),
(16) + 64,
h - (64 + 16) + 64);
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, w, h, 0.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
end;
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear (GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, VisInfo^.w, VisInfo^.h,
GL_BGRA_EXT, GL_UNSIGNED_BYTE, VisInfo^.VisBuf);
glColor4f(1, 1, 1, 1);
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
glTexCoord2d(0.0, 0.0);
glVertex2f( 0.0, 0.0);
glTexCoord2d(0.0, 1.0);
glVertex2f( 0.0, LastHeight);
glTexCoord2d(1.0, 1.0);
glVertex2f( LastWidth, LastHeight);
glTexCoord2d(1.0, 0.0);
glVertex2f(LastWidth, 0.0);
glEnd();
if Length(SoInfo.Title) > 0
then
begin
SongRender;
GetFramesInSec;
end;
glFlush();
SwapBuffers(glDC);
end;