KiCad PCB EDA Suite
GL_UTILS Class Reference

#include <gl_utils.h>

Static Public Member Functions

static int SetSwapInterval (int aVal)
 Attempts to set the OpenGL swap interval. More...
 

Detailed Description

Definition at line 33 of file gl_utils.h.

Member Function Documentation

◆ SetSwapInterval()

static int GL_UTILS::SetSwapInterval ( int  aVal)
inlinestatic

Attempts to set the OpenGL swap interval.

Parameters
aValif -1 = try to set adaptive swapping, 0 = sync off, 1 = sync with VSYNC rate
Returns
actual value set

This routine is written for Linux only. The equivalent functions under Windows would include <wglext.h> and call wglSwapIntervalEXT

Definition at line 41 of file gl_utils.h.

42  {
45  #ifdef __linux__
46  Display *dpy = glXGetCurrentDisplay();
47  GLXDrawable drawable = glXGetCurrentDrawable();
48 
49  if( glXSwapIntervalEXT && glXQueryDrawable && dpy && drawable )
50  {
51  unsigned clampedInterval;
52  glXSwapIntervalEXT( dpy, drawable, aVal );
53  glXQueryDrawable( dpy, drawable, GLX_SWAP_INTERVAL_EXT, &clampedInterval );
54 
55  return clampedInterval;
56  }
57 
58  if( glXSwapIntervalMESA &&glXGetSwapIntervalMESA )
59  {
60  if( aVal < 0 )
61  aVal = 0;
62 
63  glXSwapIntervalMESA( aVal );
64  return glXGetSwapIntervalMESA();
65  }
66 
67  if( glXSwapIntervalSGI )
68  {
69  if( aVal < 1 )
70  aVal = 1;
71 
72  if( glXSwapIntervalSGI( aVal ) )
73  glXSwapIntervalSGI( 1 );
74 
75  return 1;
76  }
77 
78  return std::numeric_limits<int>::max();
79  #else
80  return 0;
81  #endif
82  }

Referenced by KIGFX::OPENGL_GAL::init(), and EDA_3D_CANVAS::initializeOpenGL().


The documentation for this class was generated from the following file: