Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Pimms

Pages: [1]
1
Graphics / sf::String rendering issue
« on: December 30, 2011, 03:06:05 pm »
Greetings! I've been trying desperately to fix this issue myself, but after 4 hours, I'm admitting defeat and asking for help.

The error I'm experiencing is that the entire window turns black - with the exception of the string - after the string has been rendered. I've played around (A LOT) with attempting to render the string on top of the existing stuff by calling Display() twice per loop, and a billion other smaller unsuccessful tweaks.

This leads be to believe that the issue is caused by an OpenGL-state floating around inside the machine - which renders (get it? ho ho) me useless, should this be the case.

The minimal code required is:

Code: [Select]

int main (int argc, char** argv)
{
sf::RenderWindow App;
App.Create(sf::VideoMode(1280, 720, 32), "snb", sf::Style::Resize | sf::Style::Close);

sf::Font font;
font.LoadFromFile("Times New Roman.ttf");

sf::String str("This is a string.", font);

while (App.IsOpened())
{
App.Clear();

glColor3f(1, 1, 1);
glLineWidth(10.f);

glBegin(GL_TRIANGLE_FAN);
glVertex2f(0, 0);
glVertex2f(1280, 0);
glVertex2f(1280, 720);
glVertex2f(0, 720);
glEnd();

                //Comment this line, and behold the beautiful white background
App.Draw(str);

App.Display();
}
}


I've tried setting glMatrixMode's, glOrtho, glLoadIdentity and all other glFunctions I use from time to time without luck.

Also, as a side issue : I can only load external resources (sprites etc) when running in admin mode. Is there a way around this? Know that this is not what is causing the rendering to fail.

2
EDIT:

I googled one of the specific errors I got, and found a thread on this forum I didn't look into because the title looked unrelated :P

Anyways, the main problem was the order in which I linked the libraries, and various other mistakes made. I'm posting the link to the thread that helped me, hoping it might help someone else.

http://www.sfml-dev.org/forum/viewtopic.php?p=28272&sid=95d57818ea4964d0300e4c027a3cbb25

Pages: [1]
anything