I was playing around with custom geometry in the CEGUI Sample App and found a problem:
I added this code inside RenderSingleFrame (CEGuiBaseApplication.cpp).
Code: Select all
gui_renderer->beginRendering();
d_sampleApp->renderGUIContexts();
static auto *buffer = &gui_renderer->createGeometryBuffer();
static bool once = true;
if (once)
{
once = false;
using namespace CEGUI;
const Rectf scrn(d_renderer->getDefaultRenderTarget().getArea());
buffer->setClippingRegion(scrn);
int x = 50, y = 50;
Vertex vertices[6];
#define init(i, v, t, c) vertices[i].position = v; vertices[i].tex_coords = t; vertices[i].colour_val = c;
init(0,Vector3f(x, y, 0.0f), Vector2f(0, 0), Colour(0xFFFFFFFF))
init(1,Vector3f(x + 100, y, 0.0f), Vector2f(0, 0), Colour(0xFFFFFFFF))
init(2,Vector3f(x, y + 100, 0.0f), Vector2f(0, 0), Colour(0xFFFFFFFF))
init(3,Vector3f(x + 100, y + 100, 0.0f), Vector2f(0, 0), Colour(0xFFFFFFFF))
init(4,Vector3f(x, y + 100, 0.0f), Vector2f(0, 0), Colour(0xFFFFFFFF))
init(5,Vector3f(x + 100, y, 0.0f), Vector2f(0, 0), Colour(0xFFFFFFFF))
buffer->appendGeometry(vertices, 6);
auto fnt = System::getSingleton().getDefaultGUIContext().getDefaultFont();
if (fnt)
{
fnt->drawText(*buffer, "test", Vector2f(10, 10), nullptr, Colour(0xFFFFFFFF));
}
}
buffer->draw();
gui_renderer->endRendering();
This will draw "test" and a white rectangle. It works fine in DX9 and OpenGL but not in DX10/11. Only the text is drawn there. I think it is because the text uses a texture while the rectangle doesn't.
Did I miss something? How can I draw the rectangle in DX10/11 too?