#include <../arch/arch.h>

/*
 * TODO: fall back to dlopen() if there is no glXGetProcAddress().
 */

#include <GL/glx.h>

V_LOCAL vboolean
vgl_load_proc(char *proc_name,void **ptr_ret,vboolean *terminate)
{
	ARCH_CALLER_NAME(vgl_load_proc);
	void *proc = (void*)glXGetProcAddressARB((const GLubyte *)proc_name);
	if(*ptr_ret && *ptr_ret != proc)
	{
		/*
		 * This should never happen under X11 + GLX.
		 */
		ARCH_ERROR("different retval of glXGetProcAddressARB(): GLX broken ?");
		*terminate = true;
		return false;
	}
	if(proc)
	{
		*ptr_ret = (void*)proc;
		return true;
	}
	return false;
}
