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.


Messages - Pimms

Pages: [1]
1
Graphics / sf::String rendering issue
« on: December 30, 2011, 11:34:15 pm »
Tanks a lot! :-) Really made my day.

2
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.

3
I've been testing some more, and I'm still equally clueless. The only issue I'm experiencing is when I declare a Window. I went through my browser history and found a link to a guy having the same problem, and fixed it by statically linking the library files. This is however, not helpful for me. Maybe it may shed some light onto something for someone :)

http://forums.elysianshadows.com/viewtopic.php?f=6&p=71850

4
Quote from: "Nexus"
In debug mode, link to the SFML debug libraries. These end with the "-d" suffix. By the way, the Code::Blocks tutorial mentions that.


I've already tried that as well, and unfortunately I'm still having troubles getting the window to display.

So far I've tried:

All four variations of the suffixes ( none, -s, -d, -s-d, and #define values accordingly) in both global compiler settings, and project build options.

Gone over the tutorial step by step several times, just in case I skipped a step. Wich I'm very positive I've not done.

Having the dll's in the *.exe folder, and in System32.

I've also tried to create a SFML Project from the template within Code::Blcoks (both static and dynamic). It compiles and runs, but I get the exact same error.  

I've read something about nVidia and ATI Radeon cards or drivers messing up with SFML, could this possibly be the case? If so, what would be the fix? I've read something about this on another forum (God knows which one, been browsing for hours :P), and it mentioned that compiling it statically would resolve this. However, it does not.

Running a ATI Radeon 4800, should it matter.

5
Quote from: "Nexus"
Quote
-lsfml-system-s
-lsfml-window-s
-sfml-graphics-s

--sfml-system
-lsfml-graphics
-lsfml-window
Both configurations contain typing errors, or is that correct in your project?

Did you compile in Release mode when linking to sfml-system-s etc., and did you not define SFML_DYNAMIC in this configuration?


I did type that half-heartedly, they are indeed correct in the configurations.

I've only been compiling in debug-mode as of now. Does that change anything?

6
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