本文整理汇总了C++中GraphicsContext::CreateVertexBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsContext::CreateVertexBuffer方法的具体用法?C++ GraphicsContext::CreateVertexBuffer怎么用?C++ GraphicsContext::CreateVertexBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicsContext
的用法示例。
在下文中一共展示了GraphicsContext::CreateVertexBuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
PostProcessRenderer::PostProcessRenderer(GraphicsContext& graphicsContext)
: _graphicsContext(graphicsContext), _quadVertexBuffer(graphicsContext.CreateVertexBuffer(BufferType::Static))
{
static const VertexPositionTexture quadVertices[6]
{
VertexPositionTexture(Vector3f(-1, 1, 0), Vector2f::UnitY),
VertexPositionTexture(Vector3f(-1, -1, 0), Vector2f::Zero),
VertexPositionTexture(Vector3f(1, -1, 0), Vector2f::UnitX),
VertexPositionTexture(Vector3f(-1, 1, 0), Vector2f::UnitY),
VertexPositionTexture(Vector3f(1, -1, 0), Vector2f::UnitX),
VertexPositionTexture(Vector3f(1, 1, 0), Vector2f::One),
};
_quadVertexBuffer->SetVertexData(quadVertices, Array::Length(quadVertices));
_currentRenderTarget = _graphicsContext.CreateRenderTarget(1920, 1080, DepthBufferFormat::Depth24Stencil8);
_backgroundRenderTarget = _graphicsContext.CreateRenderTarget(1920, 1080, DepthBufferFormat::Depth24Stencil8);
static const std::string VertexShader = R"XXX(
#version 330 core
layout(location = 0) in vec3 vertexPosition;
layout(location = 2) in vec2 vertexUV;
out vec2 fragmentUV;
void main(){
gl_Position = vec4(vertexPosition, 1);
fragmentUV = vertexUV;
})XXX";
static const std::string FragmentShader = R"XXX(
#version 330 core
in vec2 fragmentUV;
out vec4 color;
uniform sampler2D TextureSampler;
void main() {
color = texture2D(TextureSampler, fragmentUV);
})XXX";