本文整理汇总了C++中CL_GraphicContext::reset_textures方法的典型用法代码示例。如果您正苦于以下问题:C++ CL_GraphicContext::reset_textures方法的具体用法?C++ CL_GraphicContext::reset_textures怎么用?C++ CL_GraphicContext::reset_textures使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CL_GraphicContext
的用法示例。
在下文中一共展示了CL_GraphicContext::reset_textures方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
//.........这里部分代码省略.........
CL_Vec2f vertexCoords[6];
bool renderingComplete = true;
// draw background container texture
boost::shared_ptr<ui::Texture> bgTex = containerView_->getBackgroundTexture();
if (bgTex && bgTex->isReadComplete()) {
CL_Vec3f hueInfo(0, 0, 1);
CL_Rectf rect(0, 0, CL_Sizef(bgTex->getWidth(), bgTex->getHeight()));
vertexCoords[0] = CL_Vec2f(rect.left, rect.top);
vertexCoords[1] = CL_Vec2f(rect.right, rect.top);
vertexCoords[2] = CL_Vec2f(rect.left, rect.bottom);
vertexCoords[3] = CL_Vec2f(rect.right, rect.top);
vertexCoords[4] = CL_Vec2f(rect.left, rect.bottom);
vertexCoords[5] = CL_Vec2f(rect.right, rect.bottom);
CL_Rectf texCoordHelper = bgTex->getNormalizedTextureCoords();
CL_Vec2f texCoords[6] = {
CL_Vec2f(texCoordHelper.left, texCoordHelper.top),
CL_Vec2f(texCoordHelper.right, texCoordHelper.top),
CL_Vec2f(texCoordHelper.left, texCoordHelper.bottom),
CL_Vec2f(texCoordHelper.right, texCoordHelper.top),
CL_Vec2f(texCoordHelper.left, texCoordHelper.bottom),
CL_Vec2f(texCoordHelper.right, texCoordHelper.bottom)
};
CL_PrimitivesArray primarray(gc);
primarray.set_attributes(0, vertexCoords);
primarray.set_attributes(1, texCoords);
primarray.set_attribute(2, hueInfo);
gc.set_texture(1, bgTex->getTexture());
gc.draw_primitives(cl_triangles, 6, primarray);
} else {
renderingComplete = false;
}
for (; igIter != igEnd; ++igIter) {
boost::shared_ptr<world::IngameObject> curObj = *igIter;
// just items in a container
if (!curObj->isDynamicItem()) {
continue;
}
// check if texture is ready to be drawn
boost::shared_ptr<ui::Texture> tex = curObj->getIngameTexture();
if (!tex) {
continue;
}
if (!tex->isReadComplete()) {
renderingComplete = false;
continue;
}
CL_Rectf rect(curObj->getLocXDraw(), curObj->getLocYDraw(), CL_Sizef(tex->getWidth(), tex->getHeight()));
vertexCoords[0] = CL_Vec2f(rect.left, rect.top);
vertexCoords[1] = CL_Vec2f(rect.right, rect.top);
vertexCoords[2] = CL_Vec2f(rect.left, rect.bottom);
vertexCoords[3] = CL_Vec2f(rect.right, rect.top);
vertexCoords[4] = CL_Vec2f(rect.left, rect.bottom);
vertexCoords[5] = CL_Vec2f(rect.right, rect.bottom);
CL_Rectf texCoordHelper = tex->getNormalizedTextureCoords();
CL_Vec2f texCoords[6] = {
CL_Vec2f(texCoordHelper.left, texCoordHelper.top),
CL_Vec2f(texCoordHelper.right, texCoordHelper.top),
CL_Vec2f(texCoordHelper.left, texCoordHelper.bottom),
CL_Vec2f(texCoordHelper.right, texCoordHelper.top),
CL_Vec2f(texCoordHelper.left, texCoordHelper.bottom),
CL_Vec2f(texCoordHelper.right, texCoordHelper.bottom)
};
CL_PrimitivesArray primarray(gc);
primarray.set_attributes(0, vertexCoords);
primarray.set_attributes(1, texCoords);
primarray.set_attribute(2, curObj->getHueInfo(false));
gc.set_texture(1, tex->getTexture());
gc.draw_primitives(cl_triangles, 6, primarray);
}
gc.reset_textures();
gc.reset_program_object();
renderQueue_->postRender(renderingComplete);
if (!renderingComplete) {
ui::Manager::getSingleton()->queueComponentRepaint(containerView_);
}
}