本文整理汇总了C++中boost::shared_ptr::Bind方法的典型用法代码示例。如果您正苦于以下问题:C++ shared_ptr::Bind方法的具体用法?C++ shared_ptr::Bind怎么用?C++ shared_ptr::Bind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::shared_ptr
的用法示例。
在下文中一共展示了shared_ptr::Bind方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: glViewport
void
RenderServer::BindCamera(boost::shared_ptr<Camera>& camera)
{
camera->Bind();
// adjust the viewport
glViewport(
camera->GetViewportX(),
camera->GetViewportY(),
camera->GetViewportWidth(),
camera->GetViewportHeight()
);
// set depth range
glDepthRange(0, 1);
if (mEnablePicking)
{
glRenderMode(GL_SELECT);
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluPickMatrix(mPickAt[0],viewport[3]-mPickAt[1],mPickRange,mPickRange,viewport);
glMultMatrixf(camera->GetProjectionTransform().m);
glMatrixMode(GL_MODELVIEW);
//glLoadIdentity();
//glMultMatrixf(camera->GetViewTransform().m);
glInitNames();
} else
{
// setup the projection matrix
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMultMatrixf(camera->GetProjectionTransform().m);
// initialize the modelview stack
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glMultMatrixf(camera->GetViewTransform().m);
}
}
示例2: RenderInternal
void StaticMesh::RenderInternal()
{
if (
(mMesh.get() == 0) ||
(mMaterials.empty())
)
{
return;
}
const float* pos = mMesh->GetPos().get();
if (pos == 0)
{
return;
}
glVertexPointer(3, GL_FLOAT, 0, pos);
glEnableClientState (GL_VERTEX_ARRAY);
const float* tex = mMesh->GetTexCoords().get();
if (tex != 0)
{
glTexCoordPointer(3, GL_FLOAT, 0, tex);
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
}
const float* normal = mMesh->GetNormals().get();
if (normal != 0)
{
glNormalPointer(GL_FLOAT, 0, normal);
glEnableClientState(GL_NORMAL_ARRAY);
}
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
glScalef(mScale[0],mScale[1],mScale[2]);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
const TriMesh::TFaces& faces = mMesh->GetFaces();
TriMesh::TFaces::const_iterator iter = faces.begin();
TMaterialList::const_iterator miter = mMaterials.begin();
while (
(iter != faces.end()) &&
(miter != mMaterials.end())
)
{
const boost::shared_ptr<Material> material = (*miter);
if (material.get() != 0)
{
material->Bind();
const TriMesh::Face& face = (*iter);
const boost::shared_ptr<IndexBuffer>& idx = face.indeces;
glDrawElements(GL_TRIANGLES, idx->GetNumIndex(),
GL_UNSIGNED_INT, idx->GetIndex().get());
}
++iter;
++miter;
}
glDisable(GL_BLEND);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY );
glDisableClientState(GL_NORMAL_ARRAY);
}