Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

If you have any questions, reports, suggestions, or requests about Live2D, please send them to this community.
※We cannot guarantee statements or answers from Live2D staff. Thank you for your understanding in advance.
 
Live2D Cubism
Cubism Products and Downloads
Cubism product manuals and tutorials
Cubism Editor Manual    Cubism Editor Tutorial    Cubism SDK Manual    Cubism SDK Tutorial
Live2D user has created a tutorial video(unoffilcial) in English. SEE ALSO.
Thank you, brian_tsui!
[Live2D Tutorial 2020] Introduction to Tools and Technical Concepts
[NOTICE]
About the support for Mac models
Cubism Editor is not supported with Apple M1 processors.
Please refer to System Requirements for details.
We will not respond to any related inquiries with this message.

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 ~

Comments

  • edited August 13
    Okay, so this night I tried to modify the Native SDK Sample Demo for OpenGL (with CSM_TARGET_WIN_GL i.e. for Windows) and it works, but there are some things I don't understand and I'm afraid it will cause problems later. I am a beginner in OpenGL so maybe my questions are stupid.

    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 and
    Demo 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 :
     glGenFramebuffers = (PFNGLGENFRAMEBUFFERSEXTPROC)WinGlGetProcAddress("glGenFramebuffers");
        glGenRenderbuffers = (PFNGLGENRENDERBUFFERSEXTPROC)WinGlGetProcAddress("glGenRenderbuffers");
        glBindFramebuffer = (PFNGLBINDFRAMEBUFFEREXTPROC)WinGlGetProcAddress("glBindFramebuffer");
        glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)WinGlGetProcAddress("glFramebufferTexture2D");
        glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSEXTPROC)WinGlGetProcAddress("glDeleteFramebuffers");
        glBindRenderbuffer = (PFNGLBINDRENDERBUFFEREXTPROC)WinGlGetProcAddress("glBindRenderbuffer");
        glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSEXTPROC)WinGlGetProcAddress("glDeleteRenderbuffers");
    
        glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEEXTPROC)WinGlGetProcAddress("glRenderbufferStorage");
        glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)WinGlGetProcAddress("glFramebufferRenderbuffer");
        glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)WinGlGetProcAddress("glCheckFramebufferStatus");


    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 with WinGlGetProcAddress("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 for ARB_texture_filter_anisotropic ?

    Thank you for reading me !
  • @KrankerApfel_
    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
Sign In or Register to comment.