How to connect opengl_glad 4.6 and glfw to Lazarus free pascal?

101 Views Asked by At

I completely redid the code from the last question.It works, but with the standard opengl lazarus and with the glfw library, when glad_gl 4.6 is connected, it issues an external access violation error with the message access violation executing address $000000000000000000

Attempt to connect glad to free pascal opengl 4 6 Error at startup Wrong number of parameters specified for call to gladLoadGL

glfw.pas was taken from github https://github.com/Blueicaro/GLFW/blob/master/Glfw33/glfw.pas

program project1;


uses
gl, glad_gl, glfw;

var
  window: PGLFWwindow;

begin
  if glfwInit() = 0 then
  ExitCode := -1;

  window := glfwCreateWindow(640, 480, 'Hello World', nil, nil);
  if window = nil then
  begin
    glfwTerminate();
    ExitCode := -1;
  end;

  glfwMakeContextCurrent(window);

  while glfwWindowShouldClose(window) = 0 do
  begin
    glClear(GL_COLOR_BUFFER_BIT);
                      glBegin(GL_TRIANGLES);

                      glColor3d(1,0,0);


 glVertex2f(-1, -1);
 glColor3d(1,1,0);
 glVertex2f(1, -1);
 glColor3d(1,0,1);
 glVertex2f(0, 1);

 glEnd;
    glfwSwapBuffers(window);

    glfwPollEvents();
  end;

  glfwTerminate();
   ExitCode := 0;
end.            


connect opengl glad 4.6

0

There are 0 best solutions below