mupen64plus / mupen64plus-video-rice

Video plugin for the Mupen64Plus v2.0 project, using OpenGL. This plugin is based on the RiceVideoLinux plugin from earlier versions of Mupen64Plus.
31 stars 40 forks source link

Remove pgl prefix for gl ones investigation #27

Closed Narann closed 7 years ago

Narann commented 9 years ago

This ticket is to gather information on why we have to manually create function pointers on gl function with pgl prefix and not rely on the ones provided by SDL using GL_GLEXT_PROTOTYPES.

I already asked @richard42 about this and here is his answers:

I used the 'p' prefix to prevent name collisions on systems which do expose link-time visibility to these functions. I think they need to be there.

Regarding the OGLExtensions.cpp/.h, I recommend leaving it there because this is the most portable and fool-proof way of linking to the OpenGL functions across all platforms. In the past we had problems with the SDL headers even with the GL_GLEXT_PROTOTYPES macro.

The fact we have to manually create this functions is fine but the fact we name them with a pgl prefix to avoid those already here is weird.

I whould like to know which are the problematic platform.

richard42 commented 9 years ago

To dig further I would recommend looking in the old Hg and/or SVN repositories to see when this change was implemented, and what the commit log messages say.

Narann commented 9 years ago

Update just to mention: change pgl suffix to gl commit seems to fix GLES problems

I talk about it here and copy paste important infos about this problem:

As @richard42 point me, I will have to deal with rice repo history to know why we had to use other function pointer (pgl) and if we could fix it and rely _only on SDL's one. I've isolate two time step:

https://github.com/mupen64plus/mupen64plus-video-rice/blob/d1dd90e8fe984003261c2a1ddb26ecceacb0a437/src/OGLExtensions.h#L20 https://github.com/mupen64plus/mupen64plus-video-rice/blob/a20f82c2d8af47aa873dca4a7904e3c8f998807c/src/OGLExtensions.h#L30

First is from the original commit:

This is only necessary because Windows does not contain development support for OpenGL versions beyond 1.1

And second seems to blame Linux:

The function pointer types are defined here because as of 2009 some OpenGL drivers under Linux do 'incorrect' things which mess up the SDL_opengl.h header, resulting in no function pointer typedefs at all, and thus compilation errors.

@Richard42 gave some informations on the ML. Also here.

I need to investigate this. I'm surprised about how Linux driver could make SDL_opengl.h messing up. In general, if you only include SDL_opengl.h without gl.h or the rest you should be safe.

This fix_gles branch compile fine on my Linux Desktop OpenGL. It seems to compile fine on your GLES2 hardwares so now I need to test on Windows and Mac just to be sure. Then I will try to know why those function pointers were needed.

Narann commented 7 years ago

Closing this one as now we don't use pgl anymore.