[Notice of Holidays]
Please note that our staff will not be available from 2024/Dec/28 - 2025/Jan/5 JST.
The Live2D Creators Forum will remain open during the holidays.
Submissions that require a response will be answered after we reopen for business.
Please note that it will take longer than usual to respond to your request.
Is that possible to use Glad instead of Glew ? (C++/OpenGL)
Hi people !
I try to add Cubism 4 R4 to my C++/OpenGL project.
I already use Glad, so I would like to use Cubism Core and Cubism Framework with Glad instead of Glew.
Must I rewrite Framework with Glad or is there another way to switch the lib to Glad ?
Is Core compatible with Glad or is that an obligation to use Glew ?
Thank you for reading me ~
0 ·
Comments
Here what I do to switch the OpenGL Demo sample from Glew to Glad :
1) Delete glew folder and add glad one in the project include directory.
2) Replace each
#include <GL/glew.h>
by#include <glad/glad.h>
in Framework andDemo project.
3) Write
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
in CubismRenderer_OpenGLES2.cpp. ( Normally this should be defined in glad.h but I don't know which extension to check in https://glad.dav1d.de to add it to the loader)4) In CubismRenderer_OpenGLES2.cpp I remove a part of the GL functions in
InitializeGLFunction()
Because some macros that begins with PFNGL wasn't found. Here below all the lines I deleted :My questions and worries :
A ) Why the function
InitializeGlFunctions()
is needed ? Isn't that the job of Glew or Glad to load and initialize the OpenGL function ?B ) Are
PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC
and other macros I deleted define by Glew, by Windows or by the GPU driver ? What happend if I don't intialize them withWinGlGetProcAddress("gl_function_name")
?C ) What are the extension I need to add to glad on the loader website to get
GL_TEXTURE_MAX_ANISOTROPY_EXT
? Is That the another name forARB_texture_filter_anisotropic
?Thank you for reading me !
Thank you for your continued use of our product.
Since we do not know the specifications of GLAD, please contact GLAD officials or developers for more information.
A ) Why the function InitializeGlFunctions() is needed ? Isn't that the job of Glew or Glad to load and initialize the OpenGL function ?
This is necessary because it specifies the setting values during initialization.
B ) Are PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC and other macros I deleted define by Glew, by Windows or by the GPU driver ? What happend if I don't intialize them with WinGlGetProcAddress("gl_function_name") ?
In GLEW, macros such as PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC are defined in glew.h.
If not initialized with WinGlGetProcAddress, the rendering process may fail.
https://docs.microsoft.com/ja-jp/windows/win32/api/wingdi/nf-wingdi-wglgetprocaddress
GLAD requires that you prepare the appropriate loader yourself.
C ) What are the extension I need to add to glad on the loader website to get GL_TEXTURE_MAX_ANISOTROPY_EXT ? Is That the another name for ARB_texture_filter_anisotropic ?
I think it is possible to use it by adding ARB_texture_filter_anisotropic, but please check the glad.c generated by you for details.
hope that helps!
Live2D Cubism Support