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 - akhena

Pages: [1]
1
Window / Re: Fullscreen mode not working
« on: June 13, 2012, 03:02:54 pm »
Bump...

Anyone would have a brilliant idea to help me find the problem here ? :)

2
Window / Re: Fullscreen mode not working
« on: June 10, 2012, 11:42:46 am »
Hello,

First thanks for taking a look into it. :)

I tried Rosme solution, but I was pretty convinced it wouldn't help. Sure I had no decent way to close my app, but Alt+F4 should have done the trick. Plus Ctrl+Alt+Del should have brought up the Task Manager. But it doesn't. Anyway I tried it, and here is my code.
 #include <SFML/Graphics.hpp>

 int main()
 {
     // Create the main window
     sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window" , sf::Style::Fullscreen );

     // Create a graphical text to display

     sf::Text text("Hello SFML", sf::Font::getDefaultFont(), 50);

     // Start the game loop
     while (window.isOpen())
     {
         // Process events
         sf::Event event;
         while (window.pollEvent(event))
         {
             // Close window : exit
            /* if (event.type == sf::Event::Closed)
                 window.close();
                 */

             if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape)
                window.close();
         }

         // Clear screen
         window.clear(sf::Color(200,200,128));

         // Draw the string
         window.draw(text);

         // Update the window
         window.display();
     }

     return EXIT_SUCCESS;
 }
 
But the same problem happens.

I'll try to describe my problem a little bit better. When I launch that application, the screen turns completely black. And there's no reaction whatsoever to any mouse / keyboard input I do. So I "guess" the program crashes, but I don't see any confirmation of this. The only way out is the reset button of my desktop.

When I say I could only debug till that line, I meant that executing this last line, the screen turns completely black, and I can't go back to the debugger. I tried Alt+Tab, Alt+Esc and Alt+F4 and finally Alt+Ctrl+Del. But I'm still sitting in front of a black screen. So I have to reboot my computer.

This is rather cumbersome, because I don't see how to find out what's wrong, as I can't see anything.

Otherwise if I comment out the sf::Style::Fullscreen, I can successfully run the app in window mode. The background is greenish and I can red a white Hello SFML in the top left corner.

My config is : Intel i7-2600K using its on board graphic chip HD Graphics 3000. RAM : 8 Go. OS : Windows 7 64 bits.

PS : Nobody answered this, but I suppose the minimal code I provided works perfectly on other machines... ?

3
Window / Fullscreen mode not working
« on: June 09, 2012, 04:47:27 pm »
Hello everyone,

I would be glad to get some help here with my problem. It seems like I can't go in fullscreen mode without problems.

So first here is my minimal code :

#include <SFML/Graphics.hpp>

 int main()
 {
     // Create the main window
     sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window", sf::Style::Fullscreen);

     // Create a graphical text to display

     sf::Text text("Hello SFML", sf::Font::getDefaultFont(), 50);


     // Start the game loop
     while (window.isOpen())
     {
         // Process events
         sf::Event event;
         while (window.pollEvent(event))
         {
             // Close window : exit
             if (event.type == sf::Event::Closed)
                 window.close();
         }

         // Clear screen
         window.clear(sf::Color(200,200,128));

         // Draw the string
         window.draw(text);

         // Update the window
         window.display();
     }

     return EXIT_SUCCESS;
 }
 

When I run this, I get a black screen and nothing seems to work anymore. There are no response from keyboard inputs. I tried Ctrl-Alt-Del to no avail.

I'm on windows 7. Compiled with the latest SFML from GitHub. Tried to link on both release and debug dll.

I tried to debug to see how far I can go, but it stops at
void WindowImplWin32::switchToFullscreen(const VideoMode& mode)
{
    DEVMODE devMode;
    devMode.dmSize       = sizeof(devMode);
    devMode.dmPelsWidth  = mode.width;
    devMode.dmPelsHeight = mode.height;
    devMode.dmBitsPerPel = mode.bitsPerPixel;
    devMode.dmFields     = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;

    // Apply fullscreen mode
    if (ChangeDisplaySettings(&devMode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
 
this last line.

Might be obvious as it will indeed go in fullscreen.

If you see anything I could do to find what's wrong, that would be of great help.

PS : I realize this should have gone in the Window forum. If a mod wants to move it, be my guest. :)

4
Graphics / sf::View
« on: September 13, 2011, 02:28:46 pm »
No answer on this one ? Is the question too "stupid" ?  :cry:

5
Graphics / Text rendering problem
« on: September 04, 2011, 06:13:02 pm »
Thanks for the link, unfortunately it doesn't solve my problem.   :(

6
Graphics / Text rendering problem
« on: September 04, 2011, 03:59:28 pm »
Hello,

I finally made a "minimal" code to show the bug I had when displaying some text. I know this problem doesn't happen on all computers, as it doesn't on my laptop. Nevertheless, I thought it might be of interest.

If anyone has an idea to help me find the culprit, I would appreciate.

Code: [Select]
#include <iostream>
#include <list>
#include <vector>
#include <SFML/Graphics.hpp>

using namespace std;

int main()
{
    sf::Font font;
    // Create a window and its view
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML Game");
    // Load font
    if (!font.LoadFromFile("comic.ttf"))
        {
            std::cout << "Could not load font." << std::endl;
            return EXIT_FAILURE;
        }

    typedef std::list<std::string> StringList;
    StringList stringList;

    stringList.push_back("Test avec le texte");
    stringList.push_back("éèàêzZaA ù");
    stringList.push_back("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    stringList.push_back("abcdefghijklmnopqrstuvwxyz");
    stringList.push_back("éèàê");

    std::vector<sf::Text> textLines;
    float lastLinePosition = 0.f;

    for(std::list<std::string>::iterator line = stringList.begin(); line != stringList.end();
            ++ line)
    {
        sf::Text textLine(*line, font, 20);
        textLine.SetColor(sf::Color::Red);
        sf::Vector2f position;
        position.x = 10.f;
        position.y = std::floor(10.f + lastLinePosition + 0.5);
        textLine.SetPosition(position);
        textLines.push_back(textLine);
        lastLinePosition += font.GetLineSpacing(20);
    }

    // Start the game loop
    while (window.IsOpened())
    {
        // Process events
        sf::Event event;
        while (window.PollEvent(event))
        {
            // Close window : exit
            if (event.Type == sf::Event::Closed)
                window.Close();
        }

        // Clear screen
        window.Clear();
        for(std::vector<sf::Text>::iterator line = textLines.begin(); line != textLines.end();
                    ++line)
        {
            window.Draw(*line);
        }
        // Update the window
        window.Display();

    }
    return EXIT_SUCCESS;

}

Of course you'll need comic.ttf in your folder. But I guess this font can be found on most computers...

I'm running this on an AMD 2400++ with an ATI Radeon 9600 graphic card. I already tried to install the latest driver, with no success.

You can find my print screen here : http://imageshack.us/f/684/sfmltext.jpg
The problem appears on the 4th line.

7
Graphics / sf::View
« on: September 02, 2011, 03:06:56 pm »
All this makes sense. Thank you.

But then didn't we just bury the public interface of sf::View into the sf::RenderWindow ? Take for instance the
Code: [Select]
void sf::View::Move( const Vector2f & offset )  member function. You cannot apply it directly on the View of the window. You must create another View on the side, which is a replicate of the window View, move it, and every time copy it back with SetView().

Is it how it is intended to work ?

As a side question, I was wondering if the View makes any culling from the part of openGL. I guess yes, but as I'm no expert, I was wondering if it is more efficient to only draw what will be visible, or if the "graphic engine" takes care of that.

8
Graphics / sf::View
« on: August 22, 2011, 04:53:17 pm »
Ok, thanks.

Just also wondering why not make a non-const GetView() ? Is that also too "dangerous" ?

9
Graphics / sf::View
« on: August 22, 2011, 03:58:23 pm »
I'm starting to use SFML2. I'm a bit surprised that the View in a RenderWindow is not a reference to an external view, but a copy of the View passed to the SetView method. I was expecting that one could use some code like this :

Code: [Select]

sf::RenderWindow window(sf::VideoMode(800, 600), "SFML test");
sf::View camera(sf::FloatRect(0.f, 0.f, 800.f, 600.f));
camera.SetViewport(sf::FloatRect(0.f, 0.f, 1.f, 1.f));
window.SetView(camera);

//and then later on
camera.Move(20.f, 0.f);
//But nothing happen until I call
window.SetView(camera);


Did I miss something ? Is there a design reason for not holding a reference but a local copy of the View object ? Thanks for clarifying.  :)

Pages: [1]