本文整理汇总了C++中Box2d::toArray方法的典型用法代码示例。如果您正苦于以下问题:C++ Box2d::toArray方法的具体用法?C++ Box2d::toArray怎么用?C++ Box2d::toArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box2d
的用法示例。
在下文中一共展示了Box2d::toArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void NormalFilter::render(const ITextureObject& texture, const ICamera<float>& renderedCamera)
{
const Box2d<float> box(Vector2d<float>(-1.0, -1.0), Vector2d<float>(1.0, 1.0));
const auto& positions = box.toArray();
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
//glDisable(GL_DEPTH_TEST);
glUseProgram(shader.getId());
texture.bind();
//glGetUniformLocation( texture.getId()
glUniform1i(shader.getUniformLocation("depthTex"), texture.getId());
glUniform1f(shader.getUniformLocation("texelSizeW"), 1.0f / static_cast<float>(texture.getWidth()));
glUniform1f(shader.getUniformLocation("texelSizeH"), 1.0f / static_cast<float>(texture.getHeight()));
glUniformMatrix4fv(shader.getUniformLocation("projectionMatrix"), 1, GL_FALSE, renderedCamera.getProjectionMatrix().toArray().data());
glVertexAttribPointer(shader.getAttribLocation("positions"), 2, GL_FLOAT, GL_FALSE, 0, positions.data());
glEnableVertexAttribArray(0);
glDrawArrays(GL_QUADS, 0, static_cast<GLsizei>( positions.size() / 2) );
glDisableVertexAttribArray(0);
glBindFragDataLocation(shader.getId(), 0, "fragColor");
texture.unbind();
glDisable(GL_DEPTH_TEST);
glUseProgram(0);
}
示例2: render
void OnScreenRenderer::render(const ITextureObject& texture)
{
const Box2d<float> box(Vector2d<float>(-1.0, -1.0), Vector2d<float>(1.0, 1.0));
const auto& positions = box.toArray();
//glEnable(GL_DEPTH_TEST);
glUseProgram(shader.getId());
texture.bind();
glUniform1i(shader.getUniformLocation("texture"), texture.getId());
glVertexAttribPointer(shader.getAttribLocation("positions"), 2, GL_FLOAT, GL_FALSE, 0, positions.data());
glEnableVertexAttribArray(0);
glDrawArrays(GL_QUADS, 0, static_cast<GLsizei>( positions.size() / 2) );
glDisableVertexAttribArray(0);
glBindFragDataLocation(shader.getId(), 0, "fragColor");
texture.unbind();
//glDisable(GL_DEPTH_TEST);
glUseProgram(0);
}