Graphics Reference
In-Depth Information
Constant
Vertex Attribute 0
disable
Vertex Attribute 0
Enable/Disable
Vertex Data
enable
Vertex Array
Vertex Attribute 0
Figure 6-3
Selecting Constant or Vertex Array Vertex Attribute
void glEnableVertexAttribArray (GLuint index );
void glDisableVertexAttribArray (GLuint index );
index specifies the generic vertex attribute index. This value ranges
from 0 to the maximum vertex attributes supported minus 1.
Example 6-3 illustrates how to draw a triangle where one of the vertex
attributes is constant and the other is specified using a vertex array.
Example 6-3
Using Constant and Vertex Array Attributes
int Init ( ESContext *esContext )
{
UserData *userData = (UserData*) esContext->userData;
const char vShaderStr[] =
"#version 300 es \n"
"layout(location = 0) in vec4 a_color; \n"
"layout(location = 1) in vec4 a_position; \n"
"out vec4 v_color; \n"
"void main() \n"
"{ \n"
" v_color = a_color; \n"
" gl_Position = a_position; \n"
"}";
const char fShaderStr[] =
"#version 300 es \n"
"precision mediump float; \n"
"in vec4 v_color; \n"
"out vec4 o_fragColor; \n"
(continues)
 
Search WWH ::




Custom Search