I am trying out sfml
and want to draw simple 2D graphic on top of 3D object.
sf::ContextSettings settings;
settings.depthBits = 24;
settings.majorVersion = 4;
settings.minorVersion = 1;//opengl v4.1
settings.attributeFlags = sf::ContextSettings::Core;
sf::RenderWindow window( sf::VideoMode(1200,800),"sfml", sf::Style::Default, settings);
sf::CircleShape qs;
qs.setRadius(400);
qs.setPosition(400,400);
while(window.isOpen()){
sf::Event evnt;
while (window.pollEvent(evnt)) {
switch (evnt.type) {
case sf::Event::Closed:
window.close();
break;
}
}
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
window.draw(qs);
window.display();
}
the sf::ContextSettings
is set so that I can use openGL
to draw 3D graphic. but with this settings, my qs
not showing in the window. if I comment out the settings.majorVersion = 4;
and settings.minorVersion = 1;
, then it appear.
I am rather new and not sure how it works.
Is this possible to be resolved?
Is it correct to think that I want to use
sfml
for interface graphic andOpenGL
for 3D? How do people normally do it?