本文整理汇总了C++中ref_ptr::Bind方法的典型用法代码示例。如果您正苦于以下问题:C++ ref_ptr::Bind方法的具体用法?C++ ref_ptr::Bind怎么用?C++ ref_ptr::Bind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ref_ptr
的用法示例。
在下文中一共展示了ref_ptr::Bind方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderJulia
void RenderJulia(float time)
{
// draw
paramA = cos(time + 0.5f);
paramB = sin(time);
paramC = 0.0f;
color = Vector4f(fabs(paramA) + 0.2f, fabs(paramB) + 0.2f, fabs(paramC) + 0.4f, 1.0);
juliaProgram->Bind();
{
juliaColorUniform->Set(color);
juliaUniformMVP->Set( Matrix4f::ortho(-1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f)
* Matrix4f::scaling(sceneScale.x, sceneScale.y, 1.0f)
* Matrix4f::translation(cameraPos.x, cameraPos.y, 0.0f) );
juliaUniformA->Set(paramA);
juliaUniformB->Set(paramB);
if (juliaUniformDensity) {
juliaUniformDensity->Set(density);
}
quadVBO->Bind( vertexLayout.get() );
device->Draw(TRIANGLE_STRIP, 0, 4);
quadVBO->Unbind();
juliaProgram->Unbind();
}
}
示例2: CalculateTransform
void Arrow3d::RenderArrow(ScreenBase const & screen, ref_ptr<dp::GpuProgram> program,
dp::Color const & color, float dz, bool hasNormals)
{
program->Bind();
GLFunctions::glBindBuffer(m_bufferId, gl_const::GLArrayBuffer);
uint32_t const attributePosition = program->GetAttributeLocation("a_pos");
ASSERT_NOT_EQUAL(attributePosition, -1, ());
GLFunctions::glEnableVertexAttribute(attributePosition);
GLFunctions::glVertexAttributePointer(attributePosition, kComponentsInVertex,
gl_const::GLFloatType, false, 0, 0);
if (hasNormals)
{
GLFunctions::glBindBuffer(m_bufferNormalsId, gl_const::GLArrayBuffer);
uint32_t const attributeNormal = program->GetAttributeLocation("a_normal");
ASSERT_NOT_EQUAL(attributeNormal, -1, ());
GLFunctions::glEnableVertexAttribute(attributeNormal);
GLFunctions::glVertexAttributePointer(attributeNormal, 3, gl_const::GLFloatType, false, 0, 0);
}
dp::UniformValuesStorage uniforms;
math::Matrix<float, 4, 4> const modelTransform = CalculateTransform(screen, dz);
uniforms.SetMatrix4x4Value("u_transform", modelTransform.m_data);
glsl::vec4 const c = glsl::ToVec4(color);
uniforms.SetFloatValue("u_color", c.r, c.g, c.b, c.a);
dp::ApplyState(m_state, program);
dp::ApplyUniforms(uniforms, program);
GLFunctions::glDrawArrays(gl_const::GLTriangles, 0, m_vertices.size() / kComponentsInVertex);
}