当前位置: 首页>>代码示例>>C++>>正文


C++ GLSLProgram::Use方法代码示例

本文整理汇总了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);
}
开发者ID:AiYong,项目名称:OpenSubdiv,代码行数:34,代码来源:glStencilViewer.cpp

示例2: glslProcess

void glslProcess()
{
	GLSLProgram glprog;
	glprog.SetGstap(true);
	glprog.SetVerbose(true);

	if(!glprog.Create("D:\\v0.vert", "D:\\v0.frag")) {
		return ;
	}
	glprog.Use();

}
开发者ID:UsingtcNower,项目名称:glsl-helper,代码行数:12,代码来源:pbo_example.cpp

示例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);
}
开发者ID:GameFusion,项目名称:OpenSubdiv,代码行数:43,代码来源:glStencilViewer.cpp

示例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);
}
开发者ID:GameFusion,项目名称:OpenSubdiv,代码行数:24,代码来源:glStencilViewer.cpp


注:本文中的GLSLProgram::Use方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。