本文整理汇总了C++中GLSLProgram::Use方法的典型用法代码示例。如果您正苦于以下问题:C++ GLSLProgram::Use方法的具体用法?C++ GLSLProgram::Use怎么用?C++ GLSLProgram::Use使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLSLProgram
的用法示例。
在下文中一共展示了GLSLProgram::Use方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: glBindVertexArray
//------------------------------------------------------------------------------
static void
drawStencils() {
g_samplesProgram.Use( );
const float scale = 0.02f;
glUniform1f(g_samplesProgram.GetUniformScale(), scale);
glUniformMatrix4fv(g_samplesProgram.GetUniformModelViewMatrix(),
1, GL_FALSE, g_transformData.ModelViewMatrix);
glUniformMatrix4fv(g_samplesProgram.GetUniformProjectionMatrix(),
1, GL_FALSE, g_transformData.ProjectionMatrix);
glBindVertexArray(g_stencilsVAO);
glBindBuffer(GL_ARRAY_BUFFER, g_stencilOutput->BindDstBuffer());
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glEnableVertexAttribArray(2);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*9, 0);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*9, (void*)(sizeof(GLfloat)*3));
glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*9, (void*)(sizeof(GLfloat)*6));
glDrawArrays(GL_POINTS, 0, g_stencilOutput->GetNumStencils());
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
glDisableVertexAttribArray(2);
glBindVertexArray(0);
glUseProgram(0);
}
示例2: glslProcess
void glslProcess()
{
GLSLProgram glprog;
glprog.SetGstap(true);
glprog.SetVerbose(true);
if(!glprog.Create("D:\\v0.vert", "D:\\v0.frag")) {
return ;
}
glprog.Use();
}
示例3: 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);
}
示例4: 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);
}