python opengl_从Python调用OpenGL扩展

Extensions and Conditional

Functionality PyOpenGL has support for

most OpenGL extensions. Extensions

are available as "normal" function

pointers by importing the constructed

package name for the extension, for

instance:from OpenGL.GL.ARB.vertex_buffer_object import * buffer = glGenBuffersARB(1)

there is no need to call

initialization functions or the like

for the extension module. You can, if

you like, call the "init" function for

the extension to retrieve a boolean

indicating whether the local machine

supports a given extension, like so:if glInitVertexBufferObjectARB():

...

However, it is normally clearer to

test for the boolean truth of the

entry points you wish to use:if (glGenBuffersARB):

buffers = glGenBuffersARB( 1 )

There are often a

number of entry points which implement

the same API, for which you would like

to use whichever implementation is

available (likely with some preference

in order). The OpenGL.extensions

module provides an easy mechanism to

support this:from OpenGL.extensions import alternate

glCreateProgram = alternate( 'glCreateProgram', glCreateProgram, glCreateProgramObjectARB)

glCreateProgram = alternate( glCreateProgram, glCreateProgramObjectARB)

If the first

element is a string it will be used as

the name of the alternate object,

otherwise the name is taken from the

first argument.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值