Hi all,
I'm trying to work with librocket and sfml but I can't render both things...
void CGUIRenderInterface::resize()
{
mWindow->SetActive();
static sf::View View;
View.SetViewport(sf::FloatRect(0, (float)mWindow->GetWidth(), (float)mWindow->GetHeight(), 0));
mWindow->SetView(View);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, mWindow->GetWidth(), mWindow->GetHeight(), 0, -1, 1);
glMatrixMode(GL_MODELVIEW);
glViewport(0, 0, mWindow->GetWidth(), mWindow->GetHeight());
}
void CGUIRenderInterface::RenderGeometry(Rocket::Core::Vertex* vertices, int num_vertices, int* indices, int num_indices, const Rocket::Core::TextureHandle texture, const Rocket::Core::Vector2f& translation)
{
mWindow->SetActive();
glPushMatrix();
glTranslatef(translation.x, translation.y, 0);
std::vector<Rocket::Core::Vector2f> Positions(num_vertices);
std::vector<Rocket::Core::Colourb> Colors(num_vertices);
std::vector<Rocket::Core::Vector2f> TexCoords(num_vertices);
for(int i = 0; i < num_vertices; i++)
{
Positions[i] = vertices[i].position;
Colors[i] = vertices[i].colour;
TexCoords[i] = vertices[i].tex_coord;
};
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, &Positions[0]);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, &Colors[0]);
glTexCoordPointer(2, GL_FLOAT, 0, &TexCoords[0]);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
sf::Texture* image = (sf::Texture *)texture;
if(image)
{
image->Bind();
}
else
{
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glBindTexture(GL_TEXTURE_2D, 0);
};
glDrawElements(GL_TRIANGLES, num_indices, GL_UNSIGNED_INT, indices);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glColor4f(1, 1, 1, 1);
glPopMatrix();
}
problem is here....
If I comment resize function sfml draw his things but librocket no.