<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # QGLContext Class Reference ## [[QtOpenGL](index.htm) module] 該QGLContext類封裝了一個OpenGL渲染上下文。[More...](#details) ### Types * `enum BindOption { NoBindOption, InvertedYBindOption, MipmapBindOption, PremultipliedAlphaBindOption, LinearFilteringBindOption, DefaultBindOption }` * `class **[BindOptions](index.htm)**` ### Methods * `__init__ (self, QGLFormat?format, QPaintDevice?device)` * `int bindTexture (self, QImage?image, int?target?=?GL_TEXTURE_2D, int?format?=?GL_RGBA)` * `int bindTexture (self, QPixmap?pixmap, int?target?=?GL_TEXTURE_2D, int?format?=?GL_RGBA)` * `int bindTexture (self, QString?fileName)` * `int bindTexture (self, QImage?image, int?target, int?format, BindOptions?options)` * `int bindTexture (self, QPixmap?pixmap, int?target, int?format, BindOptions?options)` * `bool chooseContext (self, QGLContext?shareContext?=?None)` * `sip.voidptr chooseVisual (self)` * `bool create (self, QGLContext?shareContext?=?None)` * `deleteTexture (self, int?tx_id)` * `QPaintDevice device (self)` * `bool deviceIsPixmap (self)` * `doneCurrent (self)` * `drawTexture (self, QRectF?target, int?textureId, int?textureTarget?=?GL_TEXTURE_2D)` * `drawTexture (self, QPointF?point, int?textureId, int?textureTarget?=?GL_TEXTURE_2D)` * `QGLFormat format (self)` * `generateFontDisplayLists (self, QFont?fnt, int?listBase)` * `sip.voidptr getProcAddress (self, QString?proc)` * `bool initialized (self)` * `bool isSharing (self)` * `bool isValid (self)` * `makeCurrent (self)` * `QColor overlayTransparentColor (self)` * `QGLFormat requestedFormat (self)` * `reset (self)` * `setFormat (self, QGLFormat?format)` * `setInitialized (self, bool?on)` * `setWindowCreated (self, bool?on)` * `swapBuffers (self)` * `bool windowCreated (self)` ### Static Methods * `bool areSharing (QGLContext?context1, QGLContext?context2)` * `QGLContext currentContext ()` * `setTextureCacheLimit (int?size)` * `int textureCacheLimit ()` * * * ## Detailed Description 該QGLContext類封裝了一個OpenGL渲染上下文。 一個OpenGL渲染上下文是一套完整的OpenGL狀態變量。渲染上下文的[format](qgl.html#FormatOption-enum)被設置在構造,但它也可以購買與設置[setFormat](qglcontext.html#setFormat)( ) 。這實際上是設置格式選項由返回[format](qglcontext.html#format)();你要的選項被退回[requestedFormat](qglcontext.html#requestedFormat)( ) 。請注意,在一個QGLContext對象已建成,實際OpenGL上下文必須通過顯式調用創建的[create()](qglcontext.html#create)功能。該[makeCurrent](qglcontext.html#makeCurrent)()函數使得這方面的當前呈現上下文。您可以_no_使用上下文電流[doneCurrent](qglcontext.html#doneCurrent)( ) 。該[reset](qglcontext.html#reset)( )函數將重置上下文,并使其無效。 你可以檢查上下文的物業,如[isValid](qglcontext.html#isValid)( )[isSharing](qglcontext.html#isSharing)( )[initialized](qglcontext.html#initialized)( )[windowCreated](qglcontext.html#windowCreated)()和[overlayTransparentColor](qglcontext.html#overlayTransparentColor)( ) 。 如果你使用雙緩沖可以使用換用離屏緩沖屏幕內容[swapBuffers](qglcontext.html#swapBuffers)( ) 。 請注意, QGLContext是不[thread-safe](index.htm#thread-safe)。 * * * ## Type Documentation ``` QGLContext.BindOption ``` 一組選項來決定如何使用綁定紋理[bindTexture](qglcontext.html#bindTexture)( ) 。 | Constant | Value | Description | | --- | --- | --- | | `QGLContext.NoBindOption` | `0x0000` | 不要做任何事情,直通傳遞的質感。 | | `QGLContext.InvertedYBindOption` | `0x0001` | 指定紋理應該翻轉X軸,以使紋理坐標0,0對應于左上角。反相紋理意味著一個深層副本之前上傳。 | | `QGLContext.MipmapBindOption` | `0x0002` | 指定[bindTexture](qglcontext.html#bindTexture)( )應該生成貼圖。如果GL實現支持`GL_SGIS_generate_mipmap`擴展,貼圖將自動為紋理生成。 MIP貼圖一代只支持了`GL_TEXTURE_2D`目標。 | | `QGLContext.PremultipliedAlphaBindOption` | `0x0004` | 指定圖像應使用預乘alpha上傳并做了相應的轉換。 | | `QGLContext.LinearFilteringBindOption` | `0x0008` | 指定紋理過濾應設置為GL_LINEAR 。默認值是GL_NEAREST 。如果MIP貼圖也被啟用,過濾將被設置為GL_LINEAR_MIPMAP_LINEAR 。 | | `QGLContext.DefaultBindOption` | `LinearFilteringBindOption &#124; InvertedYBindOption &#124; MipmapBindOption` | 在Qt 4.5和更早的版本,[bindTexture](qglcontext.html#bindTexture)( )將鏡像圖像,并自動生成貼圖。此選項可幫助保護這種默認行為。 | 通過使用從像素圖X11選擇它是否可以在像素映射綁定倒掛與否。 用于涂料引擎,表明像素圖應該沿著邊用像素圖/圖像進行內存管理,它從,如莖在他們破壞安裝鉤子。 這個枚舉被引入或修改的Qt 4.6 。 該BINDOPTIONS類型是一個typedef為[QFlags](index.htm)\u003cBindOption\u003e 。它存儲BindOption值的或組合。 * * * ## Method Documentation ``` QGLContext.__init__ (self, QGLFormat?format, QPaintDevice?device) ``` 構造一個OpenGL上下文給定的_format_它指定為上下文多個顯示選項。 如果底層的OpenGL / Window系統不能滿足所有要求的功能_format_,的特征最接近的子集將被使用。創建后,[format](qglcontext.html#format)( )方法將返回所得到的實際格式。 需要注意的是后一[QGLContext](qglcontext.html)對象被創建,[create](qglcontext.html#create)( )必須顯式地調用來創建實際的OpenGL上下文。上下文會[invalid](qglcontext.html#isValid)如果它是不能夠獲得GL上下文的。 **See also** [format](qglcontext.html#format)()和[isValid](qglcontext.html#isValid)( ) 。 ``` bool QGLContext.areSharing (QGLContext?context1, QGLContext?context2) ``` 返回True如果_context1_和_context2_分享他們吉爾資源,如紋理,著色器程序等,否則返回False 。 此功能被引入Qt的4.6 。 ``` int QGLContext.bindTexture (self, QImage?image, int?target?=?GL_TEXTURE_2D, int?format?=?GL_RGBA) ``` 生成和二維GL紋理綁定到當前上下文的基礎上,_image_。生成的紋理ID被返回,并且可以在以后使用中`glBindTexture()`電話。 該_target_參數指定紋理目標。默認的目標是`GL_TEXTURE_2D`。 該_format_參數設置紋理的內部格式。默認格式為`GL_RGBA`。 綁定_options_是一組用來決定如何將紋理綁定到上下文選項。 生成的紋理緩存,所以多次調用bindTexture ( )具有相同[QImage](qimage.html)將返回相同的紋理ID 。 請注意,我們假設為glPixelStore ()和glPixelTransfer ( )參數的默認值。 此功能被引入Qt的4.6 。 **See also** [deleteTexture](qglcontext.html#deleteTexture)( ) 。 ``` int QGLContext.bindTexture (self, QPixmap?pixmap, int?target?=?GL_TEXTURE_2D, int?format?=?GL_RGBA) ``` 這是一個重載函數。 讀取壓縮的紋理文件_fileName_并從它生成一個二維GL紋理。 此功能可以加載DirectDrawSurface ( DDS)紋理的DXT1 , DXT3和DXT5 DDS格式,如果`GL_ARB_texture_compression`和`GL_EXT_texture_compression_s3tc`擴展的支持。 自從4.6.1 ,在ETC1格式的紋理可以,如果被加載`GL_OES_compressed_ETC1_RGB8_texture`擴展支持與ETC1紋理已被封裝在PVR的容器格式。另外,在PVRTC2和PVRTC4格式的紋理可以被加載,如果`GL_IMG_texture_compression_pvrtc`支持擴展。 **See also** [deleteTexture](qglcontext.html#deleteTexture)( ) 。 ``` int QGLContext.bindTexture (self, QString?fileName) ``` 生成和二維GL紋理綁定到當前上下文的基礎上,_image_。生成的紋理ID被返回,并且可以在以后使用中`glBindTexture()`電話。 這是一個重載函數。 ``` int QGLContext.bindTexture (self, QImage?image, int?target, int?format, BindOptions?options) ``` 這是一個重載函數。 生成并根據綁定一個2D GL紋理_pixmap_。 ``` int QGLContext.bindTexture (self, QPixmap?pixmap, int?target, int?format, BindOptions?options) ``` 這是一個重載函數。 生成和二維GL紋理綁定到當前上下文的基礎上,_pixmap_。 此功能被引入Qt的4.6 。 ``` bool QGLContext.chooseContext (self, QGLContext?shareContext?=?None) ``` 這個半內部函數被[create](qglcontext.html#create)( ) 。它創建了一個與系統相關的OpenGL手柄相匹配的[format](qglcontext.html#format)的( )_shareContext_盡可能密切,返回True,如果成功則返回False合適的手柄找不到。 在Windows上,它調用虛函數[choosePixelFormat](qglcontext.html#choosePixelFormat)(),它找到一個匹配的像素格式標識符。在X11上,它調用虛函數[chooseVisual](qglcontext.html#chooseVisual)(),它找到一個恰當的X視覺。在其他平臺上也可能有不同的工作。 ``` sip.voidptr QGLContext.chooseVisual (self) ``` **X11 only:**這個虛函數試圖找到一個可視化的格式相匹配,減少了需求,如果原來的請求不能得到滿足。 該算法降低了格式的要求是相當簡單的頭腦,所以在你的子類中重寫此方法,如果你的應用程序有視覺上的選擇spcific要求。 **See also** [chooseContext](qglcontext.html#chooseContext)( ) 。 ``` bool QGLContext.create (self, QGLContext?shareContext?=?None) ``` 創建GL上下文。返回True ,如果它是成功地創造在構造函數中指定的繪圖設備上的有效GL渲染上下文,否則返回False (即上下文是無效的) 。 創建成功后,[format](qglcontext.html#format)( )返回集合的創建GL渲染上下文的功能。 If _shareContext_指向一個有效的[QGLContext](qglcontext.html),此方法將嘗試建立這樣的背景下,并與OpenGL顯示列表和紋理對象共享_shareContext_。請注意,這可能會失敗,如果兩個上下文有不同的[formats](qglcontext.html#format)。使用[isSharing](qglcontext.html#isSharing)() ,以查看是否共享將發揮作用。 **Warning:**實現注意事項: C + +的類成員初始化通常發生在類的構造函數。[QGLContext](qglcontext.html)是一個例外,因為它必須是簡單定制。虛函數[chooseContext](qglcontext.html#chooseContext)( ) (和[chooseVisual](qglcontext.html#chooseVisual)( )用于X11)可以在子類中被重新實現來選擇特定的上下文。問題是,虛函數沒有正確施工過程中調用(盡管這是正確的C + + )因為C + +構造的類層次結構從下往上。出于這個原因,我們需要一個create( )函數。 **See also** [chooseContext](qglcontext.html#chooseContext)( )[format](qglcontext.html#format)()和[isValid](qglcontext.html#isValid)( ) 。 ``` QGLContext QGLContext.currentContext () ``` [ 返回當前上下文,即任何OpenGL命令將當前被定向的上下文。返回0,如果沒有上下文是最新的。 ](qglcontext.html) [**See also**](qglcontext.html) [makeCurrent](qglcontext.html#makeCurrent)( ) 。 ``` QGLContext.deleteTexture (self, int?tx_id) ``` 去除所確定的紋理_id_從紋理高速緩存,并呼吁glDeleteTextures ()來從上下文中刪除的質感。 **See also** [bindTexture](qglcontext.html#bindTexture)( ) 。 ``` QPaintDevice QGLContext.device (self) ``` [ 返回漆設備這方面設置。 ](qpaintdevice.html) [**See also**](qpaintdevice.html) [QGLContext.QGLContext](qglcontext.html#QGLContext)( ) 。 ``` bool QGLContext.deviceIsPixmap (self) ``` 返回True如果這個上下文的繪圖設備是像素圖,否則返回False 。 ``` QGLContext.doneCurrent (self) ``` 不作任何GL上下文的當前上下文。通常情況下,你不需要調用此函數;[QGLContext](qglcontext.html)調用它是必要的。 ``` QGLContext.drawTexture (self, QRectF?target, int?textureId, int?textureTarget?=?GL_TEXTURE_2D) ``` 此功能支持以下用例: * On OpenGL and OpenGL ES 1.x it draws the given texture, _textureId_, to the given target rectangle, _target_, in OpenGL model space. The _textureTarget_ should be a 2D texture target. * On OpenGL and OpenGL ES 2.x, if a painter is active, not inside a beginNativePainting / endNativePainting block, and uses the engine with type [QPaintEngine.OpenGL2](qpaintengine.html#Type-enum), the function will draw the given texture, _textureId_, to the given target rectangle, _target_, respecting the current painter state. This will let you draw a texture with the clip, transform, render hints, and composition mode set by the painter. Note that the texture target needs to be GL_TEXTURE_2D for this use case, and that this is the only supported use case under OpenGL ES 2.x. 此功能被引入Qt的4.4 。 ``` QGLContext.drawTexture (self, QPointF?point, int?textureId, int?textureTarget?=?GL_TEXTURE_2D) ``` 此功能支持以下用例: * By default it draws the given texture, _textureId_, at the given _point_ in OpenGL model space. The _textureTarget_ should be a 2D texture target. * If a painter is active, not inside a beginNativePainting / endNativePainting block, and uses the engine with type [QPaintEngine.OpenGL2](qpaintengine.html#Type-enum), the function will draw the given texture, _textureId_, at the given _point_, respecting the current painter state. This will let you draw a texture with the clip, transform, render hints, and composition mode set by the painter. Note that the texture target needs to be GL_TEXTURE_2D for this use case. **Note:**這個功能沒有在任何版本的OpenGL ES的支持。 此功能被引入Qt的4.4 。 ``` QGLFormat QGLContext.format (self) ``` [ 返回得到的(這可能是要求什么的一個子集)的幀緩沖格式。 ](qglformat.html) [**See also**](qglformat.html) [setFormat](qglcontext.html#setFormat)()和[requestedFormat](qglcontext.html#requestedFormat)( ) 。 ``` QGLContext.generateFontDisplayLists (self, QFont?fnt, int?listBase) ``` ``` sip.voidptr QGLContext.getProcAddress (self, QString?proc) ``` 返回一個函數指針傳遞的GL擴展功能_proc_。如果不能獲得一個指向函數返回0。 ``` bool QGLContext.initialized (self) ``` 返回True如果這方面已經初始化,也就是說,如果[QGLWidget.initializeGL](qglwidget.html#initializeGL)( )已在其上被執行,否則返回False 。 **See also** [setInitialized](qglcontext.html#setInitialized)( ) 。 ``` bool QGLContext.isSharing (self) ``` 返回True如果這方面是與另一個共享其GL上下文[QGLContext](qglcontext.html),否則返回假。需要注意的是上下文共享可能不會上下文不同格式之間的支持。 ``` bool QGLContext.isValid (self) ``` 返回True如果一個GL渲染上下文已經成功創建,否則返回False 。 ``` QGLContext.makeCurrent (self) ``` 使得此背景下,當前的OpenGL渲染上下文。你叫所有的GL函數在這樣的背景下運作,直到另一個方面是由電流。 在一些非常罕見的情況下,底層調用可能會失敗。如果發生這種情況的錯誤信息輸出到stderr 。 ``` QColor QGLContext.overlayTransparentColor (self) ``` [](qcolor.html) [如果這方面是一個復蓋面的有效范圍內,則返回飛機的透明色。否則返回一個{](qcolor.html)[QColor.isValid](qcolor.html#isValid)() } {無效}顏色。 返回[QColor](qcolor.html)對象將一般工作,只有當作為參數傳遞如預期[QGLWidget.qglColor](qglwidget.html#qglColor)()或[QGLWidget.qglClearColor](qglwidget.html#qglClearColor)( ) 。在某些情況下它也可以用于繪制透明的圖形用[QPainter](qpainter.html)。 ``` QGLFormat QGLContext.requestedFormat (self) ``` [](qglformat.html) [返回的幀緩沖格式最初是要求在構造函數或](qglformat.html)[setFormat](qglcontext.html#setFormat)( ) 。 **See also** [format](qglcontext.html#format)( ) 。 ``` QGLContext.reset (self) ``` 重設背景,并使其無效。 **See also** [create](qglcontext.html#create)()和[isValid](qglcontext.html#isValid)( ) 。 ``` QGLContext.setFormat (self, QGLFormat?format) ``` 設置_format_此上下文。上下文是[reset](qglcontext.html#reset)。 Call [create](qglcontext.html#create)()來創建一個新的GL上下文,試圖以匹配新的格式。 ``` [QGLContext](qglcontext.html) *cx; // ... [QGLFormat](qglformat.html) f; f.setStereo(true); cx->setFormat(f); if (!cx->create()) exit(); // no OpenGL support, or cannot render on the specified paintdevice if (!cx->format().stereo()) exit(); // could not create stereo context ``` **See also** [format](qglcontext.html#format)( )[reset](qglcontext.html#reset)()和[create](qglcontext.html#create)( ) 。 ``` QGLContext.setInitialized (self, bool?on) ``` If _on_是真正的上下文被初始化,即QGLContext.setInitialized ( )被調用就可以了。如果_on_是假的情況下沒有被初始化。 **See also** [initialized](qglcontext.html#initialized)( ) 。 ``` QGLContext.setTextureCacheLimit (int?size) ``` 該函數設置限制的紋理緩存到_size_,表示以KB為單位。 默認情況下,緩存限制為大約64 MB的。 **See also** [textureCacheLimit](qglcontext.html#textureCacheLimit)( ) 。 ``` QGLContext.setWindowCreated (self, bool?on) ``` If _on_是真正的上下文已為其創建一個窗口。如果_on_是假的無窗已為上下文中創建。 **See also** [windowCreated](qglcontext.html#windowCreated)( ) 。 ``` QGLContext.swapBuffers (self) ``` 掉期,一個離屏緩沖屏幕內容。只有當上下文是在雙緩沖模式。 **See also** [QGLFormat.setDoubleBuffer](qglformat.html#setDoubleBuffer)( ) 。 ``` int QGLContext.textureCacheLimit () ``` 返回以KB為單位的當前紋理緩存限制。 **See also** [setTextureCacheLimit](qglcontext.html#setTextureCacheLimit)( ) 。 ``` bool QGLContext.windowCreated (self) ``` 如果一個窗口已經被用于這樣的背景下建立的,則返回True ,否則返回False 。 **See also** [setWindowCreated](qglcontext.html#setWindowCreated)( ) 。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看