glCreateProgram — プログラムオブジェクトを作成する
GLuint glCreateProgram(
|
void) ; |
glCreateProgram
は、空のプログラムオブジェクトを作成し、ゼロ以外の値を返します。この値を使用してプログラムオブジェクトを参照できます。
プログラムオブジェクトとは、シェーダーオブジェクトをアタッチできるオブジェクトです。
これにより、プログラムを作成するためにリンクされるシェーダーオブジェクトを指定するメカニズムが提供されます。
また、プログラムの作成に使用されるシェーダーの互換性をチェックする手段も提供します(例えば、頂点シェーダーとフラグメントシェーダー間の互換性をチェックする)。
プログラムオブジェクトの一部として不要になったら、シェーダーオブジェクトをデタッチできます。
glAttachShader でシェーダーオブジェクトを正常にアタッチし、glCompileShader でシェーダーオブジェクトを正常にコンパイルし、glLinkProgramでプログラムオブジェクトを正常にリンクすることにより、プログラムオブジェクトに1つ以上の実行可能なプログラムが作成されます。 これらの実行可能なプログラムは、glUseProgramが呼び出されたときにカレントの状態の一部になります。 プログラムオブジェクトは、glDeleteProgramを呼び出すことで削除できます。 プログラムオブジェクトに関連付けられたメモリは、コンテキストの現在の描画状態の一部でなくなると削除されます。
バッファーおよびテクスチャーオブジェクトのように、プログラムオブジェクトの名前空間は、コンテキストのサーバー側が同じアドレス空間を共有する限り、コンテキストのセット全体で共有できます。 名前空間がコンテキスト全体で共有される場合、アタッチされたオブジェクトとそれらオブジェクトに関連付けられたデータも共有されます。 アプリケーションは、オブジェクトが異なる実行スレッドからアクセスされたときに、全てのAPI呼び出しを同期呼び出しに変換する責任があります。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.
This function returns 0 if an error occurs creating the program object.
glGet
with the argument GL_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
OpenGL Version | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Function / Feature Name | 2.0 | 2.1 | 3.0 | 3.1 | 3.2 | 3.3 | 4.0 | 4.1 | 4.2 | 4.3 | 4.4 | 4.5 |
glCreateProgram
|
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
glAttachShader, glBindAttribLocation, glCreateShader, glDeleteProgram, glDetachShader, glLinkProgram, glUniform, glUseProgram, glValidateProgram
Copyright © 2003-2005 3Dlabs Inc. Ltd. Copyright © 2010-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.