Is the OpenGL version 4.6 in Lazarus as support ? lazarus / 70-OpenGL ---------------------------------------------------------------------- threedslider · 2025-08-11 14:02 Hi I may ask if the OpenGL is the last version 4.6 in Lazarus ? Thanks ---------------------------------------------------------------------- H₂SO₄ · 2025-08-12 05:53 Yesn't  Support for any OpenGL version depends on the graphics driver, which usually comes in the form of a dynamic library that exposes  glClear, glViewport  etc. It doesn't matter which programming language is used when calling these functions. In theory, you could manually resolve each function you need by name (e.g.  glSpecializeShaderARB  as an example for an OpenGL 4.6 function), or you could choose the path of least resistance and rely on the language's OpenGL bindings (which do just that, but for all functions). Now, FPC's OpenGL bindings leave much to be desired; they are incomplete. Currently the highest  Load_GL_Version_X  function is  Load_GL_Version_4_3_CORE,  but even that doesn't include all functionality for 4.3 (e.g.  glInvalidateFramebuffer  is missing). So in essence - yes, you can use OpenGL 4.6 in Lazarus (provided your graphics driver supports it), but you'll have to manually resolve "newer" functions like this, using  wglGetProcAddress  from the  GLext  unit: 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 unit GL_Missing_Functions; {$mode objfpc}{$H+}{$macro on} interface uses  GL, GLext; {$ifdef WINDOWS}  {$define extdecl := stdcall}{$else}  {$define extdecl := cdecl}{$endif} var  glInvalidateFramebuffer: procedure (target: GLenum; numAttachments: GLsizei; attachments: PGLenum); extdecl; procedure LoadMissingFunctions(); implementation procedure LoadMissingFunctions();begin  Pointer(glInvalidateFramebuffer) := wglGetProcAddress('glInvalidateFramebuffer');end; end. ---------------------------------------------------------------------- marcov · 2025-08-12 10:17 (Or if you are windows only just use dglopengl) ---------------------------------------------------------------------- threedslider · 2025-08-12 11:37 Ok thanks to all ! But as other programming language, is it needed to use glew for OpenGL 4.6 ? Has Lazarus the glew lib wrapper ? ---------------------------------------------------------------------- marcov · 2025-08-12 11:44 Quote from: threedslider on August 12, 2025, 01:37:41 pmOk thanks to all ! But as other programming language, is it needed to use glew for OpenGL 4.6 ? Has Lazarus the glew lib wrapper ? You don't need them perse.  Most of those are just to give multiplatform abstractions for window creation and/or embedding on forms, originally made to distribute platform independent opengl examples. I never used them, as I mainly use opengl on windows, and it is only a few calls that need abstracting anyway, not worth bothering with an additional library for. ---------------------------------------------------------------------- Seenkao · 2025-08-12 20:53 В ZenGL реализованы все последние привязки на 2022-й год (изменений вроде сильных позже не было). Можете протестировать и попробовать demo01, demo17, demo19 и demo20. Так же вы можете для себя использовать файлы со всеми привязками - "zgl_pasOpenGL.pas" и константами - "zgl_gltypeconst.pas". Но вам понадобится файл конфигурации для них "GLdefine.cfg" - в нём я указал все необходимые определения, которые вы можете включить или выключить. Если вы решите использовать сам ZenGL, то для включения необходимой версии смотрите demo01. Что именно надо сделать. В проекте зайти в файл "zgl_config.cfg" и выставить там определение "USE_GL_46" (раздел "Defines for OpenGL or OpenGL ES"). Как использовать ZenGL с LCL смотрите в demo17. ------------------------------------------ Google translate: In ZenGL all the latest bindings for 2022 have been implemented (there were no major changes later). You can test and try demo01, demo17, demo19 and demo20. You can also use files with all the bindings - "zgl_pasOpenGL.pas" and constants - "zgl_gltypeconst.pas" for yourself. But you will need a configuration file for them "GLdefine.cfg" - in it I specified all the necessary definitions that you can enable or disable. If you decide to use ZenGL itself, then see demo01 to enable the required version. What exactly needs to be done. In the project, go to the "zgl_config.cfg" file and set the definition "USE_GL_46" there (section "Defines for OpenGL or OpenGL ES"). How to use ZenGL with LCL see demo17. ---------------------------------------------------------------------- threedslider · 2025-08-13 19:07 Quote from: Seenkao on August 12, 2025, 10:53:21 pmВ ZenGL реализованы все последние привязки на 2022-й год (изменений вроде сильных позже не было). Можете протестировать и попробовать demo01, demo17, demo19 и demo20. Так же вы можете для себя использовать файлы со всеми привязками - "zgl_pasOpenGL.pas" и константами - "zgl_gltypeconst.pas". Но вам понадобится файл конфигурации для них "GLdefine.cfg" - в нём я указал все необходимые определения, которые вы можете включить или выключить. Если вы решите использовать сам ZenGL, то для включения необходимой версии смотрите demo01. Что именно надо сделать. В проекте зайти в файл "zgl_config.cfg" и выставить там определение "USE_GL_46" (раздел "Defines for OpenGL or OpenGL ES"). Как использовать ZenGL с LCL смотрите в demo17. ------------------------------------------ Google translate: In ZenGL all the latest bindings for 2022 have been implemented (there were no major changes later). You can test and try demo01, demo17, demo19 and demo20. You can also use files with all the bindings - "zgl_pasOpenGL.pas" and constants - "zgl_gltypeconst.pas" for yourself. But you will need a configuration file for them "GLdefine.cfg" - in it I specified all the necessary definitions that you can enable or disable. If you decide to use ZenGL itself, then see demo01 to enable the required version. What exactly needs to be done. In the project, go to the "zgl_config.cfg" file and set the definition "USE_GL_46" there (section "Defines for OpenGL or OpenGL ES"). How to use ZenGL with LCL see demo17. Wow ! Very cool thanks a lot for sharing ! ---------------------------------------------------------------------- Mathias · 2025-09-05 15:17 I've created a few bindings for OpenGL, including the glew lib. The advantage of glew is that the Lazarus EXE remains very lean, since everything is in glew.so or glew.dll. It's very up-to-date; in addition to the entire OpenGL 4.6, almost all extensions are supported. The disadvantage for Window users is that it requires the glw.dll. Linux already has it anyway. glad and dglopengl compile everything into the EXE, which bloats the EXE and only supports a small portion of the extensions. The advantage is that you don't need a DLL. The packages can be found here: https://github.com/sechshelme/Lazarus- OpenGL-3.3-Tutorial/tree/master/clib_packages By the way, I also have many OpenGL examples for Lazarus here, although the 4.6 ones are a bit hidden. https://github.com/sechshelme/Lazarus-OpenGL-3.3-Tutorial https://github.com/sechshelme/Lazarus- OpenGL-3.3-Tutorial/tree/master/Versuche/80_-_OpenGL_4.x ---------------------------------------------------------------------- marcov · 2025-09-05 15:33 Quote from: Mathias on September 05, 2025, 05:17:57 pmglad and dglopengl compile everything into the EXE, which bloats the EXE and only supports a small portion of the extensions. The advantage is that you don't need a DLL. And what magnitude is that "bloat"?   Hardly care about a few hundred bytes on a multimegabyte GUI app. ---------------------------------------------------------------------- 440bx · 2025-09-05 16:35 Quote from: Mathias on September 05, 2025, 05:17:57 pmI've created a few bindings for OpenGL, including the glew lib. Thank you for sharing your work. ---------------------------------------------------------------------- Mathias · 2025-09-05 17:17 Quote from: marcov on September 05, 2025, 05:33:16 pmQuote from: Mathias on September 05, 2025, 05:17:57 pmglad and dglopengl compile everything into the EXE, which bloats the EXE and only supports a small portion of the extensions. The advantage is that you don't need a DLL. And what magnitude is that "bloat"?   Hardly care about a few hundred bytes on a multimegabyte GUI app. GLEW: Linux = 445B Win = 58KB GLAD: Linux = 1200KB Win = 330KB It should be noted that GLAD or dglopengl only provide the basic functions of OpenGL 4.6, while glew provides almost all of the new extensions. Okay, you can also have GLAD built that supports these functions, but then the EXE will be at least twice as large if you include everything. I find an EXE of over 1.2MB quite large for a simple triangle. ---------------------------------------------------------------------- marcov · 2025-09-05 19:42 I don't care about GLAD, I use DGLOPENGL, which FPC can partially smartlink. My applications are not a simple triangle (and are LCL based to begin with). In that context 250k IMHO is not worth distributing and managing version of a DLL for. I assume Linux has some smartlinking problem, otherwise the problems wouldn't be this big.