Hey,
I am trying to write a simple game with my own OpenGL 4.3 core 3D graphics renderer and sfml for 2D stuff.
I want to use sfml for a simple HUD and later for a GUI (with sfgui, for example).
Currently I am not even able to draw a simple sf::CircleShape on top of my 3D scene.
sf::CircleShape shape(10000);
shape.setFillColor(sf::Color::Red);
while(isExecuting_)
{
const sf::Vector2i& oldMousePos = sf::Mouse::getPosition(*this);
sf::Event event;
while(this->pollEvent(event))
{
if(event.type == sf::Event::Closed)
{
// end the program
isExecuting_ = false;
}
if(event.type == sf::Event::Resized)
{
// adjust the viewport when the window is resized
glViewport(0, 0, event.size.width, event.size.height);
getSceneRenderer()->setRenderSize(event.size.width, event.size.height);
}
if(event.type == sf::Event::KeyPressed)
{
if(event.key.code == sf::Keyboard::R)
{
std::unique_ptr<sf::Image> image = getSceneRenderer()->getBackbuffer()->getTextureImage();
image->saveToFile("Screenshot.png");
}
}
}
const sf::Clock clock;
getSceneRenderer()->renderScene();
this->pushGLStates();
//this->clear(sf::Color::Blue); //This works and clears the screen completely
this->draw(shape);
this->popGLStates();
this->display();
This is my current 3D renderer:
https://github.com/ElHolzi/WoodEngine/blob/master/GFX/SceneRenderer.cppKind regards,
Woodfighter