Commit 55f46a92 authored by Laurent Aimar's avatar Laurent Aimar

Used opengl.h HasExtension() when applicable.

parent abe86edd
...@@ -154,12 +154,10 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt, ...@@ -154,12 +154,10 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
} }
const char *extensions = (const char *)glGetString(GL_EXTENSIONS); const char *extensions = (const char *)glGetString(GL_EXTENSIONS);
if (!extensions)
extensions = "";
/* Load extensions */ /* Load extensions */
bool supports_fp = false; bool supports_fp = false;
if (strstr(extensions, "GL_ARB_fragment_program")) { if (HasExtension(extensions, "GL_ARB_fragment_program")) {
vgl->GenProgramsARB = (PFNGLGENPROGRAMSARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glGenProgramsARB"); vgl->GenProgramsARB = (PFNGLGENPROGRAMSARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glGenProgramsARB");
vgl->BindProgramARB = (PFNGLBINDPROGRAMARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glBindProgramARB"); vgl->BindProgramARB = (PFNGLBINDPROGRAMARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glBindProgramARB");
vgl->ProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glProgramStringARB"); vgl->ProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glProgramStringARB");
...@@ -175,7 +173,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt, ...@@ -175,7 +173,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
bool supports_multitexture = false; bool supports_multitexture = false;
GLint max_texture_units = 0; GLint max_texture_units = 0;
if (strstr(extensions, "GL_ARB_multitexture")) { if (HasExtension(extensions, "GL_ARB_multitexture")) {
vgl->ActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glActiveTextureARB"); vgl->ActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glActiveTextureARB");
vgl->MultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glMultiTexCoord2fARB"); vgl->MultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glMultiTexCoord2fARB");
...@@ -253,8 +251,8 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt, ...@@ -253,8 +251,8 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
#elif defined(MACOS_OPENGL) #elif defined(MACOS_OPENGL)
supports_npot = true; supports_npot = true;
#else #else
supports_npot |= strstr(extensions, "GL_APPLE_texture_2D_limited_npot") != NULL || supports_npot |= HasExtension(extensions, "GL_APPLE_texture_2D_limited_npot") ||
strstr(extensions, "GL_ARB_texture_non_power_of_two"); HasExtension(extensions, "GL_ARB_texture_non_power_of_two");
#endif #endif
/* Texture size */ /* Texture size */
......
...@@ -364,14 +364,14 @@ static int Open (vlc_object_t *obj) ...@@ -364,14 +364,14 @@ static int Open (vlc_object_t *obj)
bool is_swap_interval_set = false; bool is_swap_interval_set = false;
#ifdef GLX_SGI_swap_control #ifdef GLX_SGI_swap_control
if (strstr (glx_extensions, "GLX_SGI_swap_control")) { if (HasExtension (glx_extensions, "GLX_SGI_swap_control")) {
PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)GetProcAddress (NULL, "glXSwapIntervalSGI"); PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)GetProcAddress (NULL, "glXSwapIntervalSGI");
if (!is_swap_interval_set && SwapIntervalSGI) if (!is_swap_interval_set && SwapIntervalSGI)
is_swap_interval_set = !SwapIntervalSGI (1); is_swap_interval_set = !SwapIntervalSGI (1);
} }
#endif #endif
#ifdef GLX_EXT_swap_control #ifdef GLX_EXT_swap_control
if (strstr (glx_extensions, "GLX_EXT_swap_control")) { if (HasExtension (glx_extensions, "GLX_EXT_swap_control")) {
PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)GetProcAddress (NULL, "glXSwapIntervalEXT"); PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)GetProcAddress (NULL, "glXSwapIntervalEXT");
if (!is_swap_interval_set && SwapIntervalEXT) if (!is_swap_interval_set && SwapIntervalEXT)
is_swap_interval_set = !SwapIntervalEXT (dpy, sys->glwin, 1); is_swap_interval_set = !SwapIntervalEXT (dpy, sys->glwin, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment