Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support using Glad instead of GLEW #642

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft

Conversation

rpavlik
Copy link
Contributor

@rpavlik rpavlik commented Apr 14, 2020

WIP

cc @xinyazhang

There is a few small changes needed to vcglib (remove a glew include or wrap the glew include in #ifndef __gl_h_), and a handful of other changes still needed, but this should be helpful.

also getting this error, despite including gl_defs first:

In file included from /extra/ryan/srcbig/third-party/meshlab/vcglib/wrap/gui/trackball.h:86,
                 from /extra/ryan/srcbig/third-party/meshlab/vcglib/wrap/gl/shot.h:87,
                 from /extra/ryan/srcbig/third-party/meshlab/src/meshlabplugins/filter_img_patch_param/filter_img_patch_param.cpp:27:
/extra/ryan/srcbig/third-party/meshlab/vcglib/wrap/gui/view.h: In member function ‘void vcg::View<T>::GetView()’:
/extra/ryan/srcbig/third-party/meshlab/vcglib/wrap/gui/view.h:148:5: error: there are no arguments to ‘glGetIntegerv’ that depend on a template parameter, so a declaration of ‘glGetIntegerv’ must be available [-fpermissive]
     glGetIntegerv(GL_VIEWPORT, (GLint*)viewport);

@rpavlik rpavlik marked this pull request as draft April 14, 2020 22:16
@alemuntoni
Copy link
Member

Hi @rpavlik, thank you very much for this!
About removing glew include, do you mean the one in this PR?

I could merge it, but since vcglib is fully owned by the CNR, all the vcglib contributors that do not work at CNR must first sign the contributor license agreement. Sorry about this bureaucracy, but I can't really do nothing about it.
If you don't want to sign it, tell me and I'll manually apply all the changes.

@rpavlik
Copy link
Contributor Author

rpavlik commented Apr 15, 2020

That's one of them, but it turns out there's a few more: one in vcglib/wrap/glw/glheaders.h and one in vcglib/wrap/gl/gl_surface.h. I'd suggest wrapping the glheaders one in the ifdefs and removing the include (or switching it to use wrap/glw/glheaders) from wrap/gl/camera.h and wrap/gl/gl_surface.h

I don't really want to sign that agreement right now, I don't have the bandwidth to get it reviewed, etc. Everything I submit is available "inbound == outbound", as is traditional in open source, but right now I'm not going to bother to get lawyers involved for <5 line patches.

This isn't a complete pull request, I just submitted it as a "draft" as a way to have a place to put notes to help @xinyazhang besides commenting on the other, merged/closed pull request. (Though, it does build and run now.) I had originally started this work in my attempt to get it to build with OpenGL-ES.

As I worked on this, I kept finding additional opengl extensions that needed to be added to the GLAD build. If anybody picks up this and continues with it, note that there's a link in glad.h that can be clicked to set up the GLAD generator web site to the right state and then you can easily add more extensions.

Additionally, it looks like a bunch of the extensions used are promoted to inclusion in mainline opengl, so it might be possible to modernize (and thus ease porting to gles, additionally): see https://www.khronos.org/opengl/wiki/History_of_OpenGL for details and https://opengl.gpuinfo.org/listextensions.php for lists of devices/drivers that support or don't support various extensions.

  • GL_ARB_draw_buffers - in 2.0
  • GL_ARB_fragment_program - part of the old ARB assembly language - is it actually being used anywhere in the codebase? https://en.wikipedia.org/wiki/ARB_assembly_language
  • GL_ARB_fragment_shader - in 2.0, "heavily modified" per that history page
  • GL_ARB_occlusion_query - in 1.5
  • GL_ARB_shader_objects - in 2.0, "heavily modified" per that history page
  • GL_ARB_shading_language_100 - in 2.0, "heavily modified" per that history page
  • GL_ARB_texture_cube_map - in 1.3
  • GL_ARB_texture_float - in 3.0, though looks like it's not available in opengl es perhaps?
  • GL_ARB_texture_non_power_of_two - in 2.0
  • GL_ARB_uniform_buffer_object - in 3.1
  • GL_ARB_vertex_buffer_object - in 1.5
  • GL_ARB_vertex_program - part of the old ARB assembly language - is it actually being used?
  • GL_ARB_vertex_shader - in 2.0, "heavily modified" per that history page
  • GL_EXT_framebuffer_object - ARB_framebuffer_object is "core extension" in 3.0
  • GL_EXT_transform_feedback - in 3.0, though some devices don't appear to support it
  • GL_EXT_vertex_shader - presumably replaced by ARB_vertex_shader

These are the ones that aren't promoted and that actually appear to be variable in their support: links go to lists of reports for devices that don't support it.

These are the ones that some code is actively checking for:

  • ARB_draw_buffers
  • ARB_fragment_program
  • ARB_fragment_shader
  • ARB_shader_objects
  • ARB_shading_language_100
  • ARB_texture_cube_map
  • ARB_texture_float
  • ARB_texture_non_power_of_two
  • ARB_vertex_buffer_object
  • ARB_vertex_program
  • ARB_vertex_shader
  • EXT_framebuffer_object
  • EXT_gpu_shader4
  • EXT_vertex_shader

This pull request makes all those checks take the form glExtensionsHas + the extension name without the GL_ prefix, so should be easy to grep.

(vcglib parts used by meshlab explicitly check for EXT_transform_feedback and ARB_uniform_buffer_object)

@stale
Copy link

stale bot commented Jun 19, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 19, 2020
@stale
Copy link

stale bot commented Aug 23, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants