SFML community forums
Help => Graphics => Topic started by: kreed on June 03, 2011, 10:16:44 am
-
I have been trying to create a simple OpenGL 3.2 context in SFML 2.0 and enable anti aliasing.
#1 Is there a way to find out WHAT OpenGL version is being used?
#2 Anti-Aliasing doesn't look like its working.
This is what I'm getting as output.
(http://i.imgur.com/fauZ6.png) (http://imgur.com/fauZ6)
I'm trying this :
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
sf::ContextSettings::ContextSettings(8, 8, 4, 3, 2);
sf::Shape shape;
shape.AddPoint(10, 10, sf::Color::Red, sf::Color::White);
shape.AddPoint(300, 112, sf::Color::Green, sf::Color::White);
shape.AddPoint(10, 300, sf::Color::Blue, sf::Color::White);
shape.EnableFill(true);
shape.EnableOutline(true);
shape.SetOutlineThickness(10);
while (window.IsOpened())
{
sf::Event event;
while (window.PollEvent(event))
{
if (event.Type == sf::Event::Closed)
window.Close();
}
window.Draw(shape);
window.Display();
}
return EXIT_SUCCESS;
}
Thanks for any/all help.
EXTRA SPECIAL thanks to you Laurent, I am new to SFML but love it already.
-
#1 Is there a way to find out WHAT OpenGL version is being used?
window.GetSettings().MajorVersion/MinorVersion
#2 Anti-Aliasing doesn't look like its working.
Are you on Linux?
-
No, I am currently on Windows 7 64-bit. I just realized that I also never actually loaded/compile/linked/used and shaders. Does SFML automatically assume default shader usage in the 3.0+ contexts?
Thanks for everything,
Kreed
-
I just realized that I also never actually loaded/compile/linked/used and shaders. Does SFML automatically assume default shader usage in the 3.0+ contexts?
Nop. SFML creates compatibility profiles so that it can still use fixed-pipeline functions.
For anti-aliasing, make sure that it's not forced to OFF in your graphics driver.
-
ah, that is actually an amazingly GOOD thing to do so no complaints there. If it is forced to OFF how could I turn it on? I am using an NVIDIA GTX 465. I know it supports all the way up to 4.1 rendering contexts, but I want to support more platforms so I'm shooting for a middle ground. I also have my drivers installed with full OpenGL 3.2+ support.
-
You should have a GUI with your driver, to play with its settings. Something like "nVidia configuration panel".
-
Hmm, it isn't forced off, it said its based on the program settings, but I tried making it default to the settings, and there was no change.
-
If you print window.GetSettings().AntialiasingLevel, what do you see? 0 or 4?
-
Ah, I wish I had tried this before I have left! I will have to get back to you with what I get later today. Thanks for all the help so far.
-
it prints a 0.
-
Also, I noticed that the shape object seems to be for 2D objects only, not 3d.
What would you recommend is the best way to set up SFML 2.0 to render 3D graphics using OpenGL 3.2+
-
it prints a 0.
So there should be a message in the standard output (the console), right?
What would you recommend is the best way to set up SFML 2.0 to render 3D graphics using OpenGL 3.2+
There's no best way to setup SFML for 3D, what you do is enough.
-
You are only calling the ContextSettings constructor, you aren't passing it to the RenderWindow constructor.
Here is what I use in my project, except using Window instead of RenderWindow:
sf::Window window(sf::VideoMode(800, 600, 32), "Game", sf::Style::Close, sf::ContextSettings(24, 8, 16, 3, 3));