[SOLVED] Problems with dglOpenGL on Windows lazarus / 70-OpenGL ---------------------------------------------------------------------- soerensen3 · 2017-12-05 14:47 I have a problem with dglOpenGL on Windows. When I try to initialize it doesn't find some of the functions. I am usually working on Linux, where everything is working fine. It used to work on Windows as well but for some reason it does not work anymore. I have an NVidia discrete display adapter and an Intel adapter which supports GL up to 4.5 so it is not a hardware related issue. This minimal example fails on Windows but works on Linux: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program Project1; uses dglOpenGL; begin  InitOpenGL();  ReadExtensions;  WriteLn( Assigned( glGenerateMipmap )); // Returns False ..  it is not the only function not working  ReadLn;end.  I use Lazarus 1.8 RC 5 with FPC 3.0.4 (32 Bit) and the latest dglOpenGL.pas. Is it a drivers problem, maybe? ---------------------------------------------------------------------- marcov · 2017-12-05 14:56 Try in a lazarus app, maybe it only works with GUI apps. ---------------------------------------------------------------------- soerensen3 · 2017-12-05 15:08 That didn't help. Besides, I'm not talking about creating a context. InitOpenGL/ReadExtensions just dynamically loads all the pointers to the functions, which in my case does not work. I can however run other programs using OpenGL. It might point to the wrong dll? According to dependency walker "OpenGL32.dll" does indeed not have the functions I was looking for. ---------------------------------------------------------------------- marcov · 2017-12-05 15:22 Well, my dglopengl apps initialize opengl the same way, but in a lazarus application, and that works fine. Note to reach opengl3+ functions more is needed (see below) opengl32.dll is afaik a windows DLL, but the driver must provide the relevant implementation. In the past the windows default driver was sometimes a shell, without much 3d, but afaik that doesn't happen anymore since Windows 8. My code is like: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i    if FirstTime then   begin // used to do one time init stuff    InitOpenGL;    ReadExtensions;  end;   OnResize := PanelResize; // let's control our own resize, I have no idea which protected method is below this so...  FBrightness := 10.0;   FDC := GetDC(Handle);   pfd.nSize := SizeOf(pfd);  pfd.nVersion := 1;  pfd.dwFlags := PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER;  pfd.iPixelType := PFD_TYPE_RGBA;  pfd.cColorBits := 32;   pf := ChoosePixelFormat(FDC, @pfd);  b:=SetPixelFormat(FDC, pf, @pfd);   FRC := wglCreateContext(FDC);  b:=wglMakeCurrent(FDC, FRC);   if FirstTime then begin // reread for opengl 3+ (?) properties.    ReadImplementationProperties;    ReadExtensions;  end;  b:=wglMakeCurrent(FDC, FRC); ---------------------------------------------------------------------- KemBill · 2017-12-05 15:51 Quote from: soerensen3 on December 05, 2017, 03:47:03 pmI have a problem with dglOpenGL on Windows. When I try to initialize it doesn't find some of the functions. I am usually working on Linux, where everything is working fine. It used to work on Windows as well but for some reason it does not work anymore. I have an NVidia discrete display adapter and an Intel adapter which supports GL up to 4.5 so it is not a hardware related issue. This minimal example fails on Windows but works on Linux: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program Project1; uses dglOpenGL; begin  InitOpenGL();  ReadExtensions;  WriteLn( Assigned( glGenerateMipmap )); // Returns False ..  it is not the only function not working  ReadLn;end.  I use Lazarus 1.8 RC 5 with FPC 3.0.4 (32 Bit) and the latest dglOpenGL.pas. Is it a drivers problem, maybe? you miss ReadImplementationProperties after ReadExtensions; but glGenerateMipmap  is loaded during the call of ReadExtensions i'm in the same case, try : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i WriteLn(  dglCheckExtension('GL_ARB_framebuffer_object') ); ---------------------------------------------------------------------- KemBill · 2017-12-05 16:51 this is related to the way you test. In a real window if i check for extension GL_ARB_framebuffer_object, it's loaded ---------------------------------------------------------------------- soerensen3 · 2017-12-05 16:55 Thank you both! It works now! The solution was to call ReadExtensions again after the Context is initialized! Quoteif FirstTime then begin // reread for opengl 3+ (?) properties.     ReadImplementationProperties;     ReadExtensions;   end; So the order is like this. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i InitOpenGL();//CreateContextReadExtensions(); //Here the order does not seem to matterReadImplementationProperties();//This might or might not be necessary, I still have to find out what the procedure does exactly ---------------------------------------------------------------------- Akira1364 · 2017-12-08 07:00 Your issue is likely related to the fact that there's no actual window present, to be honest. OpenGL isn't a command-line API...