glUseProgram
来源:互联网 发布:windows 体验指数 编辑:程序博客网 时间:2024/06/14 15:21
Name
glUseProgram — Installs a program object as part of current rendering state
C Specification
void glUseProgram(
GLuint program)
;Parameters
program
Specifies the handle of the program object whose executables are to be used as part of current rendering state.
Description
glUseProgram
installs the program object specified byprogram
as part of current rendering state. One or more executables are created in a program object by successfully attaching shader objects to it withglAttachShader, successfully compiling the shader objects withglCompileShader, and successfully linking the program object withglLinkProgram.
A program object will contain an executable that will run on the vertex processor if it contains one or more shader objects of typeGL_VERTEX_SHADER
that have been successfully compiled and linked. A program object will contain an executable that will run on the geometry processor if it contains one or more shader objects of typeGL_GEOMETRY_SHADER
that have been successfully compiled and linked. Similarly, a program object will contain an executable that will run on the fragment processor if it contains one or more shader objects of typeGL_FRAGMENT_SHADER
that have been successfully compiled and linked.
While a program object is in use, applications are free to modify attached shader objects, compile attached shader objects, attach additional shader objects, and detach or delete shader objects. None of these operations will affect the executables that are part of the current state. However, relinking the program object that is currently in use will install the program object as part of the current rendering state if the link operation was successful (seeglLinkProgram ). If the program object currently in use is relinked unsuccessfully, its link status will be set toGL_FALSE
, but the executables and associated state will remain part of the current state until a subsequent call toglUseProgram
removes it from use. After it is removed from use, it cannot be made part of current state until it has been successfully relinked.
If program
is zero, then the current rendering state refers to aninvalid program object and the results of shader execution are undefined. However, this is not an error.
If program
does not contain shader objects of typeGL_FRAGMENT_SHADER
, an executable will be installed on the vertex, and possibly geometry processors, but the results of fragment shader execution will be undefined.
Notes
Like buffer and texture objects, the name space for program objects may be shared across a set of contexts, as long as the server sides of the contexts share the same address space. If the name space is shared across contexts, any attached objects and the data associated with those attached objects are shared as well.
Applications are responsible for providing the synchronization across API calls when objects are accessed from different execution threads.
Errors
GL_INVALID_VALUE
is generated if program
is neither 0 nor a value generated by OpenGL.
GL_INVALID_OPERATION
is generated if program
is not a program object.
GL_INVALID_OPERATION
is generated if program
could not be made part of current state.
GL_INVALID_OPERATION
is generated if transform feedback mode is active.
Associated Gets
glGet with the argumentGL_CURRENT_PROGRAM
glGetActiveAttrib with a valid program object and the index of an active attribute variable
glGetActiveUniform with a valid program object and the index of an active uniform variable
glGetAttachedShaders with a valid program object
glGetAttribLocation with a valid program object and the name of an attribute variable
glGetProgram with a valid program object and the parameter to be queried
glGetProgramInfoLog with a valid program object
glGetUniform with a valid program object and the location of a uniform variable
glGetUniformLocation with a valid program object and the name of a uniform variable
glIsProgram
- glUseProgram
- gluseprogram
- Robot Framework 安装
- 使用Myeclipse插件将wsdl生成java客户端代码
- spice server qxl red_worker_main()代码分析
- 招聘实习生,要求懂java开发
- zoj-2559 The Smart Bomb 简单几何
- glUseProgram
- 【EXE PE】初识pe结构--手写可执行程序
- 容器做参数,传地址
- canal和otter的关系?
- Map 和 Set 的遍历运用
- [ios]各种证书
- JUnit in Action Second Edition-20130906
- SVN中更改连接用户
- 想开始一个开源的项目,从今天开始吧