예제 #1
0
 //-------------------------------------------------------------------------------------------------//
 void GLXWindow::setVSyncEnabled(bool vsync)
 {
     mVSync = vsync;
     // we need to make our context current to set vsync
     // store previous context to restore when finished.
     ::GLXDrawable oldDrawable = glXGetCurrentDrawable();
     ::GLXContext  oldContext  = glXGetCurrentContext();
     
     mContext->setCurrent();
     
     if (! mIsExternalGLControl)
     {
         if (GLXEW_MESA_swap_control)
             glXSwapIntervalMESA (vsync ? mVSyncInterval : 0);
         else if (GLXEW_EXT_swap_control)
             glXSwapIntervalEXT (mGLSupport->getGLDisplay(), glXGetCurrentDrawable(),
                                 vsync ? mVSyncInterval : 0);
         else if (GLXEW_SGI_swap_control)
             if (vsync && mVSyncInterval)
                 glXSwapIntervalSGI (mVSyncInterval);
     }
     
     mContext->endCurrent();
     
     glXMakeCurrent (mGLSupport->getGLDisplay(), oldDrawable, oldContext);
 }
예제 #2
0
void ContextGL_X11::set_use_vsync(bool p_use) {
	static bool setup = false;
	static PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT = NULL;
	static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalMESA = NULL;
	static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = NULL;

	if (!setup) {
		setup = true;
		String extensions = glXQueryExtensionsString(x11_display, DefaultScreen(x11_display));
		if (extensions.find("GLX_EXT_swap_control") != -1)
			glXSwapIntervalEXT  = (PFNGLXSWAPINTERVALEXTPROC) glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalEXT");
		if (extensions.find("GLX_MESA_swap_control") != -1)
			glXSwapIntervalMESA = (PFNGLXSWAPINTERVALSGIPROC) glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalMESA");
		if (extensions.find("GLX_SGI_swap_control") != -1)
			glXSwapIntervalSGI  = (PFNGLXSWAPINTERVALSGIPROC) glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalSGI");
	}
	int val = p_use ? 1:0;
	if (glXSwapIntervalMESA) {
		glXSwapIntervalMESA(val);
	}
	else if (glXSwapIntervalSGI) {
		glXSwapIntervalSGI(val);
	}
	else if (glXSwapIntervalEXT) {
		GLXDrawable drawable = glXGetCurrentDrawable();
		glXSwapIntervalEXT(x11_display, drawable, val);
	}
	else return;
	use_vsync = p_use;
}
예제 #3
0
void
_gdk_gl_window_destroy (GdkGLWindow *glwindow)
{
  GdkGLWindowImplX11 *impl = GDK_GL_WINDOW_IMPL_X11 (glwindow);
  Display *xdisplay;
  GdkGL_GLX_MESA_release_buffers *mesa_ext;

  GDK_GL_NOTE_FUNC_PRIVATE ();

  if (impl->is_destroyed)
    return;

  xdisplay = GDK_GL_CONFIG_XDISPLAY (impl->glconfig);

  if (impl->glxwindow == glXGetCurrentDrawable ())
    {
      glXWaitGL ();

      GDK_GL_NOTE_FUNC_IMPL ("glXMakeCurrent");
      glXMakeCurrent (xdisplay, None, NULL);
    }

  /* If GLX_MESA_release_buffers is supported. */
  mesa_ext = gdk_gl_get_GLX_MESA_release_buffers (impl->glconfig);
  if (mesa_ext)
    {
      GDK_GL_NOTE_FUNC_IMPL ("glXReleaseBuffersMESA");
      mesa_ext->glXReleaseBuffersMESA (xdisplay, impl->glxwindow);
    }

  impl->glxwindow = None;

  impl->is_destroyed = TRUE;
}
예제 #4
0
bool run_gl_swap_interval(Display *display) {
  PFNGLXSWAPINTERVALMESAPROC glXSwapIntervalMESA;
  PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT;
  PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI;

  glXSwapIntervalMESA=(PFNGLXSWAPINTERVALMESAPROC)
    glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalMESA");
  glXSwapIntervalEXT=(PFNGLXSWAPINTERVALEXTPROC)
    glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalEXT");
  glXSwapIntervalSGI=(PFNGLXSWAPINTERVALSGIPROC)
    glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalSGI");


  //
  if(glXSwapIntervalMESA) {
    glXSwapIntervalMESA(1);
  } else if(glXSwapIntervalEXT) {
    glXSwapIntervalEXT(display,glXGetCurrentDrawable(),1);
  } else if(glXSwapIntervalSGI) {
    glXSwapIntervalSGI(1);
  } else {
    return false;
  }

  return true;
}
예제 #5
0
void set_synchronization(bool enable) {
    // General notes:
    // Setting swapping on and off is platform-dependent and requires platform-specific extensions.
    // Platform-specific extensions are even more bothersome than regular extensions.
    // What functions and features to use depends on which version of OpenGL is used.
    // For more information, see the following pages:
    // http://www.opengl.org/wiki/Load_OpenGL_Functions
    // http://www.opengl.org/wiki/OpenGL_Loading_Library
    // http://www.opengl.org/wiki/Swap_Interval
    // http://en.wikipedia.org/wiki/GLX
    // Also note that OpenGL version >= 3.0 does not use glGetString for getting extensions.

    if (enigma::x11::disp != 0) {
        GLXDrawable drawable = glXGetCurrentDrawable();

        int interval = enable ? 1 : 0;

        if (enigma::is_ext_swapcontrol_supported()) {
            glXSwapIntervalEXT(enigma::x11::disp, drawable, interval);
        }
        else if (enigma::is_mesa_swapcontrol_supported()) {
            glXSwapIntervalMESA(interval);
        }
        // NOTE: GLX_SGI_swap_control, which is not used here, does not seem
        // to support disabling of synchronization, since its argument may not
        // be zero or less, so therefore it is not used here.
        // See http://www.opengl.org/registry/specs/SGI/swap_control.txt for more information.
    }
}
예제 #6
0
void setSwapInterval(int interval) {
    if (glxewIsSupported("GLX_EXT_swap_control")) {
        Display *dpy = glXGetCurrentDisplay();
        GLXDrawable drawable = glXGetCurrentDrawable();
        glXSwapIntervalEXT(dpy, drawable, interval);
    }
}
예제 #7
0
 void makeCurrent()
 {
     m_detachedContext = glXGetCurrentContext();
     m_detachedSurface = glXGetCurrentDrawable();
     if (m_surface && m_glContext)
         glXMakeCurrent(m_display, m_surface, m_glContext);
 }
예제 #8
0
void
_gdk_gl_pixmap_destroy (GdkGLPixmap *glpixmap)
{
  GdkGLPixmapImplX11 *impl = GDK_GL_PIXMAP_IMPL_X11 (glpixmap);
  Display *xdisplay;

  GDK_GL_NOTE_FUNC_PRIVATE ();

  if (impl->is_destroyed)
    return;

  xdisplay = GDK_GL_CONFIG_XDISPLAY (impl->glconfig);

  if (impl->glxpixmap == glXGetCurrentDrawable ())
    {
      glXWaitGL ();

      GDK_GL_NOTE_FUNC_IMPL ("glXMakeCurrent");
      glXMakeCurrent (xdisplay, None, NULL);
    }

  GDK_GL_NOTE_FUNC_IMPL ("glXDestroyGLXPixmap");
  glXDestroyGLXPixmap (xdisplay, impl->glxpixmap);

  impl->glxpixmap = None;

  impl->is_destroyed = TRUE;
}
예제 #9
0
void
glx_ctx_push_thread_local(VdpDeviceData *deviceData)
{
    glx_ctx_lock();
    Display *dpy = deviceData->display;
    const Window wnd = deviceData->root;
    thread_id_t thread_id = get_current_thread_id();

    ctx_stack.dpy = glXGetCurrentDisplay();
    if (!ctx_stack.dpy)
        ctx_stack.dpy = dpy;
    ctx_stack.wnd =     glXGetCurrentDrawable();
    ctx_stack.glc =     glXGetCurrentContext();
    ctx_stack.element_count ++;

    struct val_s *val = g_hash_table_lookup(glc_hash_table, GSIZE_TO_POINTER(thread_id));
    if (!val) {
        GLXContext glc = glXCreateContext(dpy, root_vi, root_glc, GL_TRUE);
        assert(glc);
        val = make_val(dpy, glc);
        g_hash_table_insert(glc_hash_table, GSIZE_TO_POINTER(thread_id), val);

        // try cleanup expired entries
        g_hash_table_foreach_remove(glc_hash_table, is_thread_expired, NULL);
    }
    assert(val->dpy == dpy);

    glXMakeCurrent(dpy, wnd, val->glc);
}
void
glitz_glx_destroy (void *abstract_drawable)
{
    glitz_glx_drawable_t *drawable = (glitz_glx_drawable_t *)
                                     abstract_drawable;

    drawable->screen_info->drawables--;
    if (drawable->screen_info->drawables == 0) {
        /*
         * Last drawable? We have to destroy all fragment programs as this may
         * be our last chance to have a context current.
         */
        glitz_glx_push_current (abstract_drawable, NULL,
                                GLITZ_CONTEXT_CURRENT, NULL);
        glitz_program_map_fini (drawable->base.backend->gl,
                                &drawable->screen_info->program_map);
        glitz_program_map_init (&drawable->screen_info->program_map);
        glitz_glx_pop_current (abstract_drawable);
    }

    if (glXGetCurrentDrawable () == drawable->drawable)
        glXMakeCurrent (drawable->screen_info->display_info->display,
                        None, NULL);

    if (drawable->pbuffer)
        glitz_glx_pbuffer_destroy (drawable->screen_info, drawable->pbuffer);

    free (drawable);
}
예제 #11
0
GarchGLXContextState::GarchGLXContextState() :
    display(glXGetCurrentDisplay()),
    drawable(glXGetCurrentDrawable()),
    context(glXGetCurrentContext()),
    _defaultCtor(true)
{
    // Do nothing
}
예제 #12
0
	xdl_int XdevLOpenGLContextGLX::setVSync(xdl_bool enableVSync) {
		xdl_int state = enableVSync ? 1 : 0;
		if(glXSwapIntervalEXT) {
			GLXDrawable drawable = glXGetCurrentDrawable();
			glXSwapIntervalEXT(m_display, drawable, state);
		}
		return RET_SUCCESS;
	}
예제 #13
0
파일: PBuffer.cpp 프로젝트: Jackovic/Gem
void PBuffer::enable() {
  data->old_pbuffer = glXGetCurrentDrawable();
  data->old_context = glXGetCurrentContext();

  if(!glXMakeCurrent(data->display,data->pbuffer,data->context)) {
    error("PBuffer::enable(): glXMakeCurrent() failed");
  }
}
예제 #14
0
JNIEXPORT jint JNICALL GLX_NATIVE(glXGetCurrentDrawable)
	(JNIEnv *env, jclass that)
{
	jint rc = 0;
	GLX_NATIVE_ENTER(env, that, glXGetCurrentDrawable_FUNC);
	rc = (jint)glXGetCurrentDrawable();
	GLX_NATIVE_EXIT(env, that, glXGetCurrentDrawable_FUNC);
	return rc;
}
예제 #15
0
파일: main.cpp 프로젝트: davll/ICG_SSAO
int main(int argc, char** argv){
  glutInit(&argc, argv);
  
#if defined(OS_MAC)
  {
    char* p = strrchr(argv[0], '/');
    *p = 0;
    chdir(argv[0]);
    //puts(getcwd(NULL, 0));
  }
#endif
#if defined(OS_WIN)
  OutputDebugString(TEXT("Boot up!\n"));
#endif
  
  glutInitWindowPosition(0, 0);
  glutInitWindowSize(1280, 720);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
#if defined(OS_WIN)
  glutCreateWindow_ATEXIT_HACK("ICG SSAO");
#else
  glutCreateWindow("ICG SSAO");
#endif
  
  glutDisplayFunc(onDisplay);
  glutIdleFunc(onIdle);
  glutReshapeFunc(onReshape);
  glutKeyboardFunc(onKeyDown);
  glutSpecialFunc(onSpecialDown);
  glutMotionFunc(onMouseMotion);
  glutPassiveMotionFunc(onMousePassiveMotion);
  
  glewInit();
  
  /* ENABLE V-SYNC */
  int vsync = 1;
#if defined(OS_MAC)
  CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &vsync);
#elif defined(OS_WIN)
  if(WGLEW_EXT_swap_control)
    wglSwapIntervalEXT(vsync);
#else
  if(GLXEW_EXT_swap_control)
    glXSwapIntervalEXT(glXGetCurrentDisplay(), glXGetCurrentDrawable(), vsync);
#endif
  
  onInitialization();
#if !defined(__MINGW32__)
  atexit(onShutdown);
#endif
  
  /* NO RETURN */
  glutMainLoop();
  
  return 0;
}
//----------------------------------------------------------------------------//
void OpenGLGLXPBTextureTarget::enablePBuffer() const
{
    // switch to using the pbuffer
    d_prevDisplay = glXGetCurrentDisplay();
    d_prevDrawable = glXGetCurrentDrawable();
    d_prevContext = glXGetCurrentContext();

    if (!glXMakeCurrent(d_dpy, d_pbuffer, d_context))
        std::cerr << "Failed to switch to pbuffer for rendering" << std::endl;
}
예제 #17
0
void
piglit_glx_set_no_input(void)
{
	Display *d;
	GLXDrawable win;

	d = glXGetCurrentDisplay();
	win = glXGetCurrentDrawable();

	piglit_glx_window_set_no_input(d, win);
}
예제 #18
0
void GLXPBuffer::select(void)
{
	if (m_pOldDisplay || m_glxOldDrawable || m_glxOldContext)
		return;
	m_pOldDisplay = glXGetCurrentDisplay();
	m_glxOldDrawable = glXGetCurrentDrawable();
	m_glxOldContext = glXGetCurrentContext();
	if (!glXMakeCurrent(m_pDisplay, m_glxPbuffer, m_glxContext)) {
		m_pOldDisplay = 0;
		m_glxOldDrawable = 0;
		m_glxOldContext = 0;
	}
}
예제 #19
0
int 
gl_context_push(void)
{
	CLEAR_ERROR;
	if ( stack_ptr >= CONTEXT_STACK_SIZE ) {
		SET_ERROR( ERROR_STACK_OVERFLOW );
		return 0;
	}
	stack[stack_ptr].context  = glXGetCurrentContext();
	stack[stack_ptr].drawable = glXGetCurrentDrawable();
	stack_ptr++;
	return 1;
}
예제 #20
0
static void
_glx_query_current_state (cairo_glx_context_t * ctx)
{
    ctx->previous_drawable = glXGetCurrentDrawable ();
    ctx->previous_context = glXGetCurrentContext ();

    /* If any of the values were none, assume they are all none. Not all
       drivers seem well behaved when it comes to using these values across
       multiple threads. */
    if (ctx->previous_drawable == None ||
	ctx->previous_context == None) {
	ctx->previous_drawable = None;
	ctx->previous_context = None;
    }
}
예제 #21
0
void
glx_ctx_push_global(Display *dpy, Drawable wnd, GLXContext glc)
{
    glx_ctx_lock();
    assert(0 == ctx_stack.element_count);

    ctx_stack.dpy = glXGetCurrentDisplay();
    if (!ctx_stack.dpy)
        ctx_stack.dpy = dpy;
    ctx_stack.wnd =     glXGetCurrentDrawable();
    ctx_stack.glc =     glXGetCurrentContext();
    ctx_stack.element_count ++;

    glXMakeCurrent(dpy, wnd, glc);
}
예제 #22
0
int wzGetSwapInterval()
{
	if (swapInterval >= 0)
	{
		return swapInterval;
	}

	typedef void (* PFNGLXQUERYDRAWABLEPROC)(Display *, GLXDrawable, int, unsigned int *);
	typedef int (* PFNGLXGETSWAPINTERVALMESAPROC)(void);
	typedef int (* PFNGLXSWAPINTERVALSGIPROC)(int);
	PFNGLXQUERYDRAWABLEPROC glXQueryDrawable;
	PFNGLXGETSWAPINTERVALMESAPROC glXGetSwapIntervalMESA;
	PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI;

#if GLX_VERSION_1_2
	// Hack-ish, but better than not supporting GLX_SWAP_INTERVAL_EXT?
	GLXDrawable drawable = glXGetCurrentDrawable();
	Display *display =  glXGetCurrentDisplay();
	glXQueryDrawable = (PFNGLXQUERYDRAWABLEPROC) SDL_GL_GetProcAddress("glXQueryDrawable");

	if (glXQueryDrawable && drawable)
	{
		unsigned interval;
		glXQueryDrawable(display, drawable, GLX_SWAP_INTERVAL_EXT, &interval);
		swapInterval = interval;
		return swapInterval;
	}
#endif

	glXGetSwapIntervalMESA = (PFNGLXGETSWAPINTERVALMESAPROC) SDL_GL_GetProcAddress("glXGetSwapIntervalMESA");
	if (glXGetSwapIntervalMESA)
	{
		swapInterval = glXGetSwapIntervalMESA();
		return swapInterval;
	}

	glXSwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC) SDL_GL_GetProcAddress("glXSwapIntervalSGI");
	if (glXSwapIntervalSGI)
	{
		swapInterval = 1;
	}
	else
	{
		swapInterval = 0;
	}
	return swapInterval;
}
예제 #23
0
/**
 * Display the refresh rate of the display using the GLX_OML_sync_control
 * extension.
 */
static void
show_refresh_rate( Display * dpy )
{
#if defined(GLX_OML_sync_control) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
   PFNGLXGETMSCRATEOMLPROC  get_msc_rate;
   int32_t  n;
   int32_t  d;

   get_msc_rate = (PFNGLXGETMSCRATEOMLPROC) glXGetProcAddressARB( (const GLubyte *) "glXGetMscRateOML" );
   if ( get_msc_rate != NULL ) {
      (*get_msc_rate)( dpy, glXGetCurrentDrawable(), &n, &d );
      printf( "refresh rate: %.1fHz\n", (float) n / d );
      return;
   }
#endif
   printf( "glXGetMscRateOML not supported.\n" );
}
//--------------------------------------
void ofSetVerticalSync(bool bSync){
	//----------------------------
	#ifdef TARGET_WIN32
	//----------------------------
		if (bSync) {
			if (WGL_EXT_swap_control) wglSwapIntervalEXT (1);
		} else {
			if (WGL_EXT_swap_control) wglSwapIntervalEXT (0);
		}
	//----------------------------
	#endif
	//----------------------------

	//--------------------------------------
	#ifdef TARGET_OSX
	//--------------------------------------
		GLint sync = bSync == true ? 1 : 0;
		CGLSetParameter (CGLGetCurrentContext(), kCGLCPSwapInterval, &sync);
	//--------------------------------------
	#endif
	//--------------------------------------

	//--------------------------------------
	#ifdef TARGET_LINUX
	//--------------------------------------
		void (*swapIntervalExt)(Display *,GLXDrawable, int)  = (void (*)(Display *,GLXDrawable, int)) glXGetProcAddress((const GLubyte*) "glXSwapIntervalEXT");
		if(swapIntervalExt){
			Display *dpy = glXGetCurrentDisplay();
			GLXDrawable drawable = glXGetCurrentDrawable();
			if (drawable) {
				swapIntervalExt(dpy, drawable, bSync ? 1 : 0);
				return;
			}
		}
		void (*swapInterval)(int)  = (void (*)(int)) glXGetProcAddress((const GLubyte*) "glXSwapIntervalSGI");
		if(!swapInterval)
			swapInterval = (void (*)(int)) glXGetProcAddress((const GLubyte*) "glXSwapIntervalMESA");

		if(swapInterval)
			swapInterval(bSync ? 1 : 0);

	//--------------------------------------
	#endif
	//--------------------------------------

}
예제 #25
0
/*! Just call the standard OpenGL setup.
 */
void PassiveWindow::init(GLInitFunctor oFunc)
{
#if defined(WIN32)
    Inherited::setHdc  (wglGetCurrentDC     ());
    Inherited::setHglrc(wglGetCurrentContext());
#elif defined(__APPLE__)
    //Inherited::setContext(cocoaWrapperCurrentContext());
    Inherited::setContext(carbonWrapperCurrentContext());
#else
    Inherited::setDisplay(glXGetCurrentDisplay ());
    Inherited::setContext(glXGetCurrentContext ());
    Inherited::setWindow (glXGetCurrentDrawable());
#endif

    this->doActivate();

    Window::init(oFunc);
}
예제 #26
0
Bool
glamor_glx_screen_init(struct glamor_context *glamor_ctx)
{
    glamor_ctx->ctx = glXGetCurrentContext();
    if (!glamor_ctx->ctx)
        return False;

    glamor_ctx->display = glXGetCurrentDisplay();
    if (!glamor_ctx->display)
        return False;

    glamor_ctx->drawable_xid = glXGetCurrentDrawable();

    glamor_ctx->get_context = glamor_glx_get_context;
    glamor_ctx->put_context = glamor_glx_put_context;

    return True;
}
bool HSWDisplay::Initialize(const ovrRenderAPIConfig* apiConfig)
{
    const ovrGLConfig* config = (const ovrGLConfig*)apiConfig;

    if(config)
    {
        // The following is essentially copied from CAPI_GL_DistortionRender.cpp's 
        // Initialize function. To do: Merge this to a central location.
        RenderParams.Multisample = config->OGL.Header.Multisample;
        RenderParams.RTSize      = config->OGL.Header.RTSize;

        #if defined(OVR_OS_WIN32)
            RenderParams.Window = (config->OGL.Window) ? config->OGL.Window : GetActiveWindow();
            RenderParams.DC     = config->OGL.DC;
        #elif defined(OVR_OS_LINUX)
            if (config->OGL.Disp)
                RenderParams.Disp = config->OGL.Disp;
            if (!RenderParams.Disp)
                RenderParams.Disp = XOpenDisplay(NULL);
            if (!RenderParams.Disp)
            {
                OVR_DEBUG_LOG(("XOpenDisplay failed."));
                return false;
            }

            if (config->OGL.Win)
                RenderParams.Win= config->OGL.Win;
            if (!RenderParams.Win)
                RenderParams.Win = glXGetCurrentDrawable();

            if (!RenderParams.Win)
            {
                OVR_DEBUG_LOG(("XGetInputFocus failed."));
                return false;
            }
        #endif
    }
    else
    {
        UnloadGraphics();
    }

    return true;
}
예제 #28
0
SDL_GLContext SDL_GL_GetCurrentContext( void )
{
#if MACOS_X
	glInfo.ctx = CGLGetCurrentContext();
#elif SDL_VIDEO_DRIVER_X11
	glInfo.ctx = glXGetCurrentContext();
	glInfo.dpy = glXGetCurrentDisplay();
	glInfo.drawable = glXGetCurrentDrawable();
#elif WIN32
	SDL_SysWMinfo info;

	SDL_VERSION( &info.version );

	SDL_GetWMInfo( &info );
	glInfo.hDC = GetDC( info.window );
	glInfo.hGLRC = info.hglrc;
#endif
	return NULL;
}
예제 #29
0
파일: OpenGL.cpp 프로젝트: 2xG/OpenXcom
	void OpenGL::setVSync(bool sync)
	{
	#ifndef __NO_SHADERS
		const int interval = sync ? 1 : 0;
		if (glXGetCurrentDisplay && glXGetCurrentDrawable && glXSwapIntervalEXT)
		{
			void *dpy = glXGetCurrentDisplay();
			Uint32 drawable = glXGetCurrentDrawable();

			if (drawable) {
				glXSwapIntervalEXT(dpy, drawable, interval);
				// Log(LOG_INFO) << "Made an attempt to set vsync via GLX.";
			}
		} else if (wglSwapIntervalEXT)
		{
			wglSwapIntervalEXT(interval);
			// Log(LOG_INFO) << "Made an attempt to set vsync via WGL.";
		}
		#endif
	}
예제 #30
0
// init the window: create the context  
void GLUTWindow::init(GLInitFunctor oFunc)
{
#if defined(WIN32)
    Inherited::setHdc  (wglGetCurrentDC     ());
    Inherited::setHglrc(wglGetCurrentContext());
    Inherited::setHwnd (WindowFromDC(Inherited::getHdc()));
#elif defined(__APPLE__)
    //Inherited::setContext(cocoaWrapperCurrentContext());
    Inherited::setContext(carbonWrapperCurrentContext());
#else
    glutSetWindow(getGlutId());

    Inherited::setDisplay(glXGetCurrentDisplay ());
    Inherited::setContext(glXGetCurrentContext ());
    Inherited::setWindow (glXGetCurrentDrawable());
#endif
    this->doDeactivate();

    Window::init(oFunc);
}