src/opengl/qgl.h
changeset 30 5dc02b23752f
parent 18 2f34d5167611
child 33 3e2da88830cd
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
    55 #endif
    55 #endif
    56 
    56 
    57 #if defined(Q_WS_MAC)
    57 #if defined(Q_WS_MAC)
    58 # include <OpenGL/gl.h>
    58 # include <OpenGL/gl.h>
    59 # include <OpenGL/glu.h>
    59 # include <OpenGL/glu.h>
    60 #elif defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL)
    60 #elif defined(QT_OPENGL_ES_1)
    61 # include <GLES/gl.h>
    61 # include <GLES/gl.h>
    62 #ifndef GL_DOUBLE
    62 #ifndef GL_DOUBLE
    63 # define GL_DOUBLE GL_FLOAT
    63 # define GL_DOUBLE GL_FLOAT
    64 #endif
    64 #endif
    65 #ifndef GLdouble
    65 #ifndef GLdouble
   142         StencilBuffer           = 0x0020,
   142         StencilBuffer           = 0x0020,
   143         StereoBuffers           = 0x0040,
   143         StereoBuffers           = 0x0040,
   144         DirectRendering         = 0x0080,
   144         DirectRendering         = 0x0080,
   145         HasOverlay              = 0x0100,
   145         HasOverlay              = 0x0100,
   146         SampleBuffers           = 0x0200,
   146         SampleBuffers           = 0x0200,
       
   147         DeprecatedFunctions     = 0x0400,
   147         SingleBuffer            = DoubleBuffer    << 16,
   148         SingleBuffer            = DoubleBuffer    << 16,
   148         NoDepthBuffer           = DepthBuffer     << 16,
   149         NoDepthBuffer           = DepthBuffer     << 16,
   149         ColorIndex              = Rgba            << 16,
   150         ColorIndex              = Rgba            << 16,
   150         NoAlphaChannel          = AlphaChannel    << 16,
   151         NoAlphaChannel          = AlphaChannel    << 16,
   151         NoAccumBuffer           = AccumBuffer     << 16,
   152         NoAccumBuffer           = AccumBuffer     << 16,
   152         NoStencilBuffer         = StencilBuffer   << 16,
   153         NoStencilBuffer         = StencilBuffer   << 16,
   153         NoStereoBuffers         = StereoBuffers   << 16,
   154         NoStereoBuffers         = StereoBuffers   << 16,
   154         IndirectRendering       = DirectRendering << 16,
   155         IndirectRendering       = DirectRendering << 16,
   155         NoOverlay               = HasOverlay      << 16,
   156         NoOverlay               = HasOverlay      << 16,
   156         NoSampleBuffers         = SampleBuffers   << 16
   157         NoSampleBuffers         = SampleBuffers   << 16,
       
   158         NoDeprecatedFunctions   = DeprecatedFunctions << 16
   157     };
   159     };
   158     Q_DECLARE_FLAGS(FormatOptions, FormatOption)
   160     Q_DECLARE_FLAGS(FormatOptions, FormatOption)
   159 }
   161 }
   160 
   162 
   161 Q_DECLARE_OPERATORS_FOR_FLAGS(QGL::FormatOptions)
   163 Q_DECLARE_OPERATORS_FOR_FLAGS(QGL::FormatOptions)
   233     static void setDefaultOverlayFormat(const QGLFormat& f);
   235     static void setDefaultOverlayFormat(const QGLFormat& f);
   234 
   236 
   235     static bool hasOpenGL();
   237     static bool hasOpenGL();
   236     static bool hasOpenGLOverlays();
   238     static bool hasOpenGLOverlays();
   237 
   239 
   238     enum  OpenGLVersionFlag {
   240     void setVersion(int major, int minor);
       
   241     int majorVersion() const;
       
   242     int minorVersion() const;
       
   243 
       
   244     enum OpenGLContextProfile {
       
   245         NoProfile,
       
   246         CoreProfile,
       
   247         CompatibilityProfile
       
   248     };
       
   249 
       
   250     void setProfile(OpenGLContextProfile profile);
       
   251     OpenGLContextProfile profile() const;
       
   252 
       
   253     enum OpenGLVersionFlag {
   239         OpenGL_Version_None               = 0x00000000,
   254         OpenGL_Version_None               = 0x00000000,
   240         OpenGL_Version_1_1                = 0x00000001,
   255         OpenGL_Version_1_1                = 0x00000001,
   241         OpenGL_Version_1_2                = 0x00000002,
   256         OpenGL_Version_1_2                = 0x00000002,
   242         OpenGL_Version_1_3                = 0x00000004,
   257         OpenGL_Version_1_3                = 0x00000004,
   243         OpenGL_Version_1_4                = 0x00000008,
   258         OpenGL_Version_1_4                = 0x00000008,
   247         OpenGL_ES_Common_Version_1_0      = 0x00000080,
   262         OpenGL_ES_Common_Version_1_0      = 0x00000080,
   248         OpenGL_ES_CommonLite_Version_1_0  = 0x00000100,
   263         OpenGL_ES_CommonLite_Version_1_0  = 0x00000100,
   249         OpenGL_ES_Common_Version_1_1      = 0x00000200,
   264         OpenGL_ES_Common_Version_1_1      = 0x00000200,
   250         OpenGL_ES_CommonLite_Version_1_1  = 0x00000400,
   265         OpenGL_ES_CommonLite_Version_1_1  = 0x00000400,
   251         OpenGL_ES_Version_2_0             = 0x00000800,
   266         OpenGL_ES_Version_2_0             = 0x00000800,
   252         OpenGL_Version_3_0                = 0x00001000
   267         OpenGL_Version_3_0                = 0x00001000,
       
   268         OpenGL_Version_3_1                = 0x00002000,
       
   269         OpenGL_Version_3_2                = 0x00004000
   253     };
   270     };
   254     Q_DECLARE_FLAGS(OpenGLVersionFlags, OpenGLVersionFlag)
   271     Q_DECLARE_FLAGS(OpenGLVersionFlags, OpenGLVersionFlag)
   255 
   272 
   256     static OpenGLVersionFlags openGLVersionFlags();
   273     static OpenGLVersionFlags openGLVersionFlags();
   257 
   274 
   357     virtual bool chooseContext(const QGLContext* shareContext = 0);
   374     virtual bool chooseContext(const QGLContext* shareContext = 0);
   358 
   375 
   359 #if defined(Q_WS_WIN)
   376 #if defined(Q_WS_WIN)
   360     virtual int choosePixelFormat(void* pfd, HDC pdc);
   377     virtual int choosePixelFormat(void* pfd, HDC pdc);
   361 #endif
   378 #endif
   362 #if defined(Q_WS_X11) && !defined(QT_OPENGL_ES)
   379 #if defined(Q_WS_X11) && defined(QT_NO_EGL)
   363     virtual void* tryVisual(const QGLFormat& f, int bufDepth = 1);
   380     virtual void* tryVisual(const QGLFormat& f, int bufDepth = 1);
   364     virtual void* chooseVisual();
   381     virtual void* chooseVisual();
   365 #endif
   382 #endif
   366 #if defined(Q_WS_MAC)
   383 #if defined(Q_WS_MAC)
   367     virtual void* chooseMacVisual(GDHandle);
   384     virtual void* chooseMacVisual(GDHandle);
   412 #endif
   429 #endif
   413     friend class QGLFramebufferObject;
   430     friend class QGLFramebufferObject;
   414     friend class QGLFramebufferObjectPrivate;
   431     friend class QGLFramebufferObjectPrivate;
   415     friend class QGLFBOGLPaintDevice;
   432     friend class QGLFBOGLPaintDevice;
   416     friend class QGLPaintDevice;
   433     friend class QGLPaintDevice;
       
   434     friend class QGLWidgetGLPaintDevice;
   417     friend class QX11GLPixmapData;
   435     friend class QX11GLPixmapData;
       
   436     friend class QX11GLSharedContexts;
   418 private:
   437 private:
   419     Q_DISABLE_COPY(QGLContext)
   438     Q_DISABLE_COPY(QGLContext)
   420 };
   439 };
   421 
   440 
   422 Q_DECLARE_OPERATORS_FOR_FLAGS(QGLContext::BindOptions)
   441 Q_DECLARE_OPERATORS_FOR_FLAGS(QGLContext::BindOptions)