Recent

Author Topic: GLUT in Lazarus  (Read 10387 times)

Sergey KN

  • Newbie
  • Posts: 4
GLUT in Lazarus
« on: November 13, 2012, 09:34:10 am »
learn Glut, this the example here:

1. put the file in system32 glut32.dll
2. added to the uses GLUT, GL, GLU
3. added a procedure to initialize the GLUT:

Code: [Select]
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;

The result: could not load Glut from glut32.dll

what am I doing wrong?
« Last Edit: November 13, 2012, 10:10:03 am by Sergey KN »

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: GLUT in Lazarus
« Reply #1 on: November 13, 2012, 10:36:39 am »
You have dynamic array. Try this:
Code: [Select]
glutInit(@CmdCount, @Cmd[0]);

Sergey KN

  • Newbie
  • Posts: 4
Re: GLUT in Lazarus
« Reply #2 on: November 13, 2012, 11:08:34 am »
No, the error does not change

Laksen

  • Hero Member
  • *****
  • Posts: 743
    • J-Software
Re: GLUT in Lazarus
« Reply #3 on: November 13, 2012, 12:52:22 pm »
Make sure you are using a correct dll. You can't use a 32bit dll in a 64bit program, and vice versa

Sergey KN

  • Newbie
  • Posts: 4
Re: GLUT in Lazarus
« Reply #4 on: November 13, 2012, 07:49:31 pm »
I downloaded 64 bit dll. the error does not change

I often see references to the file glut.pas 

where to put it and where to get? perhaps this is the case
« Last Edit: November 13, 2012, 07:51:05 pm by Sergey KN »

Laksen

  • Hero Member
  • *****
  • Posts: 743
    • J-Software
Re: GLUT in Lazarus
« Reply #5 on: November 13, 2012, 08:33:56 pm »
It should work with the default glut unit of FPC.

Try glutInit(@argc, argv);
argc and argv are system variables, so you don't need anything special

BlueIcaro

  • Hero Member
  • *****
  • Posts: 792
    • Blog personal
Re: GLUT in Lazarus
« Reply #6 on: November 14, 2012, 03:34:35 pm »
Hello, this code works fine for me , I have "glut32.dll" in th same folder where is the executable.
Code: Pascal  [Select][+][-]
  1. Var
  2.   CmdCount : Integer;
  3.   Cmd : Array of Pchar;
  4.   I: Integer;  
  5. begin
  6.   CmdCount := Paramcount+1;
  7.   SetLength(Cmd,CmdCount);
  8.   for I := 0 to CmdCount - 1 do
  9.      Cmd[I] := PChar(ParamStr(I));
  10.   //Inicializa la libreria OpenGL
  11.   glutInit (@CmdCount,@Cmd);
  12.   glutInitDisplayMode (GLUT_DOUBLE OR GLUT_RGB OR GLUT_DEPTH);
  13.   glutInitWindowSize (640,480);
  14.   glutInitWindowPosition(100,100);
  15.   glutCreateWindow('OpenGl Tutorial 1');
  16. (...)
  17.  
May be can help you.
/BlueIcaro

Sergey KN

  • Newbie
  • Posts: 4
Re: GLUT in Lazarus
« Reply #7 on: November 16, 2012, 01:02:15 pm »
thank you very much

 

TinyPortal © 2005-2018