ich fange gerade mit dem Lazarus programmieren an.
Beim kompilieren eines einfachen Glut/OpenGL programmes erhalte ich keinerlei Fehler,...
das direkte Ausführen der Anwendung klappt auch.
Bei "normalen" Projekten mit Formen funktioniert der Debugger einwandfrei.
Aber wenn ich bei meinen OpenGL Programm auf Run klicke startet das Programm nicht, ich erhalte ich im Terminal, aus dem ich Lazarus gestartet habe, folgende Meldungen:
Bin für jeden Tipp dankbar.[...]
[TCompiler.Compile] end
[TCmdLineDebugger] Debug PID: 2498
TGDBMIDebugger.ProcessResult Error: ,msg="No symbol table is loaded. Use the \"file\" command."
[Debugger] Running GDB version: GDB
[TDebugger.SetFileName] "/home/eshat/Desktop/opengl/Light_fp/light"
[TMainIDE.DoRunProject] B TGDBMIDebugger
TGDBMIDebugger.StartDebugging WorkingDir="/home/eshat/Desktop/opengl/Light_fp/"
TGDBMIDebugger.ProcessResult Error: ,msg="No symbol \"FPC_THREADVAR_RELOCATE_PROC\" in current context."
[Debugger] Log output: &"info functions FPC_CPUINIT\n"
[Debugger] Log output: &"info address main\n"
[Debugger] Log output: &"info file\n"
[Debugger] File type: elf32-i386
[Debugger] Entry point: 0x8082cc0
[WARNING] Debugger: Unexpected async-record: =thread-group-created,id="2500"
[WARNING] Debugger: Unexpected async-record: =thread-created,id="1",group-id="2500"
[WARNING] Debugger: Unexpected async-record: *running,thread-id="all"
[Debugger] Notify output: ,id="/lib/ld-linux.so.2",target-name="/lib/ld-linux.so.2",host-name="/lib/ld-linux.so.2",symbols-loaded="0"
[Debugger] Notify output: ,id="/lib/i686/cmov/libdl.so.2",target-name="/lib/i686/cmov/libdl.so.2",host-name="/lib/i686/cmov/libdl.so.2",symbols-loaded="0"
[Debugger] Notify output: ,id="/lib/i686/cmov/libc.so.6",target-name="/lib/i686/cmov/libc.so.6",host-name="/lib/i686/cmov/libc.so.6",symbols-loaded="0"
[Debugger] Log output: &"info program\n"
[Debugger] Target PID: 2500
[WARNING] Debugger: Unexpected async-record: *running,thread-id="all"
[WARNING] Debugger: Unexpected async-record: *running,thread-id="all"
[Debugger] Notify output: ,id="/usr/lib/libGL.so.1",target-name="/usr/lib/libGL.so.1",host-name="/usr/lib/libGL.so.1",symbols-loaded="0"
[...]
[Debugger] Notify output: ,id="/usr/lib/libXdmcp.so.6",target-name="/usr/lib/libXdmcp.so.6",host-name="/usr/lib/libXdmcp.so.6",symbols-loaded="0"
[Debugger] Console output: ~"[Thread debugging using libthread_db enabled]\n"
[WARNING] Debugger: unexpected result-record: ^error,msg="Cannot find new threads: generic error"
Hier noch der Source des Projektes.
Code: Alles auswählen
program light;
{$mode objfpc}{$H+}
uses
gl, glu, glut, utils, sysutils;
const
AppWidth = 640;
AppHeight = 480;
var
objectXRot: Single = 0;
objectYRot: Single = 0;
objectZRot: Single = 0;
procedure InitializeGL;
const
DiffuseLight: array[0..3] of GLfloat = (0.8, 0.8, 0.8, 1);
begin
glClearColor(0.18, 0.20, 0.66, 0);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glLightfv(GL_LIGHT0, GL_DIFFUSE, DiffuseLight);
glEnable(GL_LIGHT0);
glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
end;
procedure DrawGLScene; cdecl;
var
DeltaTime: Single;
begin
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
DeltaTime := GetDeltaTime;
glLoadIdentity;
glTranslatef(0, 0, -5);
glRotatef(objectXRot, 1, 0, 0);
glRotatef(objectYRot, 0, 1, 0);
glRotatef(objectZRot, 0, 0, 1);
glColor3f(1, 1, 1);
glutSolidCube(2);
objectXRot := objectXRot + 50 * DeltaTime;
objectYRot := objectYRot + 100 * DeltaTime;
objectZRot := objectZRot + 50 * DeltaTime;
glutSwapBuffers;
FrameRendered;
end;
procedure ReSizeGLScene(Width, Height: Integer); cdecl;
begin
if Height = 0 then
Height := 1;
glViewport(0, 0, Width, Height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity;
gluPerspective(45, Width / Height, 0.1, 1000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity;
end;
procedure GLKeyboard(Key: Byte; X, Y: Longint); cdecl;
begin
if Key = 27 then
Halt(0);
end;
procedure GLFPSTimer(Value: Integer); cdecl;
var
FPS: Single;
FPSText: String;
begin
FPS := GetFPS;
FPSText := Format('OpenGL Tutorial :: Light - %.2f FPS', [FPS]);
glutSetWindowTitle(PChar(FPSText));
glutTimerFunc(1000, @GLFPSTimer, 0);
end;
procedure glutInitPascal(ParseCmdLine: Boolean);
var
Cmd: array of PChar;
CmdCount, I: Integer;
begin
if ParseCmdLine then
CmdCount := ParamCount + 1
else
CmdCount := 1;
SetLength(Cmd, CmdCount);
for I := 0 to CmdCount - 1 do
Cmd[I] := PChar(ParamStr(I));
glutInit(@CmdCount, @Cmd);
end;
var
ScreenWidth, ScreenHeight: Integer;
begin
glutInitPascal(True);
glutInitDisplayMode(GLUT_DOUBLE or GLUT_RGB or GLUT_DEPTH);
glutInitWindowSize(AppWidth, AppHeight);
ScreenWidth := glutGet(GLUT_SCREEN_WIDTH);
ScreenHeight := glutGet(GLUT_SCREEN_HEIGHT);
glutInitWindowPosition((ScreenWidth - AppWidth) div 2, (ScreenHeight - AppHeight) div 2);
glutCreateWindow('OpenGL Tutorial :: Light');
InitializeGL;
glutDisplayFunc(@DrawGLScene);
glutReshapeFunc(@ReSizeGLScene);
glutKeyboardFunc(@GLKeyboard);
glutIdleFunc(@DrawGLScene);
glutTimerFunc(1000, @GLFPSTimer, 0);
glutMainLoop;
end.