Skip to content

SCREENGLPROC


获取 OpenGL 过程的地址

语法

declare function ScreenGLProc ( byref procname as const string ) as any ptr

参数

procname

要获取地址的过程名称

说明

此函数可用于获取任何 OpenGL 过程的地址,用于检索与 OpenGL 扩展关联的新函数指针。如果找不到名为 procname 的过程,screenglproc 将返回 NULL(0)。

示例

start GeSHi

vb
'' include fbgfx.bi for some useful definitions
#include "fbgfx.bi"

Dim SwapInterval As Function(ByVal interval As Integer) As Integer
Dim extensions As String

'' Setup OpenGL and retrieve supported extensions
ScreenRes 640, 480, 32,, FB.GFX_OPENGL
ScreenControl FB.GET_GL_EXTENSIONS, extensions

If (InStr(extensions, "WGL_EXT_swap_control") <> 0) Then
    '' extension supported, retrieve proc address
    SwapInterval = ScreenGLProc("wglSwapIntervalEXT")
    If (SwapInterval <> 0) Then
        '' Ok, we got it. Set OpenGL to wait for vertical sync on buffer swaps
        SwapInterval(1)
    End If
End If

end GeSHi

方言差异

  • -lang qb 方言中不可用,除非使用别名 __Screenglproc 引用。

平台差异

  • 不适用于 DOS 目标。

与 QB 的区别

  • FreeBASIC 新增

另请参阅

  • Screen (Graphics)
  • ScreenControl

返回 目录

基于 FreeBASIC 官方文档翻译 如有侵权请联系我们删除
FreeBASIC 是开源项目,与微软公司无隶属关系