SFML community forums
Help => General => Topic started by: BoomBip on March 07, 2012, 07:08:31 am
-
I'm getting constant errors in my console box whenever I attempt to draw a sprite. For the record it looks like http://i.imgur.com/3r5ju.png The image still draws fine. The only problem is the constant stream of messages.
-
What graphics card do you have? Are your graphics drivers up to date?
-
ATI Radeon HD 3200 Graphics
I'm using the latest drivers.
-
Do these messages really happen when you draw a sprite? They are supposed to be triggered in sf::Texture's creation function.
Can you try to call texture.SetRepeated(true) on every texture before loading/using them, and see if the message disappears?
-
That doesn't do anything different. Could it also happen if I assign a new texture to be applied to a sprite?
EDIT: I tried eliminating parts where textures were being reassigned and that reduced the number of errors from about 6/8 to 2. They're still happening every frame though.
-
It's not clear, could you show a complete and minimal example that reproduces the problem? Just texture creation and sprite drawing, nothing from your original code please.
-
OK. I think I figured it out. When you load a texture, you need to say: texture.SetRepeated(true) This fixes the error message (which only plays that one time). However when you load a font you can't say: font.SetRepeated(true) This creates the error. What was happening in my code was that I was loading a font every frame (inefficient, I know), thus causing the error to appear every frame.
Anyways, here's the code:
#include "SFML\Graphics.hpp"
int main()
{
//Setup
sf::RenderWindow App;
App.Create(sf::VideoMode(800, 600, 32), "OPENGL TEST");
while (App.IsOpen())
{
sf::Event Event;
while (App.PollEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
{
App.Close();
return EXIT_SUCCESS;
}
}
sf::Font font;
font.LoadFromFile("mizufalp.ttf");
sf::Text text;
text.SetFont(font);
text.SetString("SFML TEST");
App.Clear(sf::Color(0, 0, 0, 255));
App.Draw(text);
App.Display();
}
return EXIT_SUCCESS;
}
[/u]
-
Ok, it's much clearer now.
Your graphics driver doesn't support the OpenGL flag that I'm using, which was added to OpenGL 1.2. This means that your graphics card only supports OpenGL 1.1, which is strange because it doesn't seem to be that crappy. Maybe a driver bug?
Just to be sure, could you check what's returned by glGetString(GL_VERSION) (in the OpenGL example, so that you don't have to modify the project settings)?
-
Hmm. I may have been wrong over which driver version I had. I tried the glGetString thing and got version 1.1. Then I tried updating my graphics drivers and got version 3.xx and that also fixed the problem. However, now my original project (the one I started the issue with) triggers a Blue Screen of Death. So sorry about the mistake and I'll get back to you on the Blue Screen of Death thing.