本文整理汇总了C++中GLSLProgram::EnableVertexAttributes方法的典型用法代码示例。如果您正苦于以下问题:C++ GLSLProgram::EnableVertexAttributes方法的具体用法?C++ GLSLProgram::EnableVertexAttributes怎么用?C++ GLSLProgram::EnableVertexAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLSLProgram
的用法示例。
在下文中一共展示了GLSLProgram::EnableVertexAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: glBindVertexArray
//------------------------------------------------------------------------------
static void
drawStencils() {
g_samplesProgram.Use( );
glUniformMatrix4fv(g_cageProgram.GetUniformModelViewProjectionMatrix(),
1, GL_FALSE, g_transformData.ModelViewProjectionMatrix);
glBindVertexArray(g_stencilsVAO);
int numEdges = g_controlStencils->GetNumStencils() * 3;
g_samplesProgram.EnableVertexAttributes();
glBindBuffer(GL_ARRAY_BUFFER, g_stencilValues->BindVBO());
g_samplesProgram.EnableVertexAttributes();
glDrawArrays(GL_LINES, 0, numEdges*2);
glBindVertexArray(0);
glUseProgram(0);
}
示例2: setSharpnessColor
//------------------------------------------------------------------------------
static void
drawCageVertices() {
g_cageProgram.Use( );
glUniformMatrix4fv(g_cageProgram.GetUniformModelViewProjectionMatrix(),
1, GL_FALSE, g_transformData.ModelViewProjectionMatrix);
int numPoints = g_controlValues->GetNumVertices();
std::vector<float> vbo;
vbo.reserve(numPoints*6);
float * positions = g_controlValues->BindCpuBuffer();
float r, g, b;
for (int i = 0; i < numPoints; ++i) {
setSharpnessColor(g_coarseVertexSharpness[i], &r, &g, &b);
vbo.push_back(positions[i*3+0]);
vbo.push_back(positions[i*3+1]);
vbo.push_back(positions[i*3+2]);
vbo.push_back(r);
vbo.push_back(g);
vbo.push_back(b);
}
glBindVertexArray(g_cageVertexVAO);
glBindBuffer(GL_ARRAY_BUFFER, g_cageVertexVBO);
glBufferData(GL_ARRAY_BUFFER, (int)vbo.size() * sizeof(float), &vbo[0],
GL_STATIC_DRAW);
g_cageProgram.EnableVertexAttributes();
glPointSize(10.0f);
glDrawArrays(GL_POINTS, 0, numPoints);
glPointSize(1.0f);
glBindVertexArray(0);
glUseProgram(0);
}