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

Pages: 1 [2] 3
16
Window / latest SFML snapshot doesn't restore resolution on linux
« on: January 21, 2010, 07:04:48 pm »
Quote from: "Laurent"
Well, I'm not even sure that this is an issue. Can't you just wait until the resolution switch is finished after closing the SFML app?


Well, yes, i can do that, no problem, just wanted to see what are your thoughts about this and if one must considere it an issue or not. :D

17
Window / latest SFML snapshot doesn't restore resolution on linux
« on: January 21, 2010, 04:06:47 pm »
Quote from: "Laurent"
Quote
The first instance is ok, but the second is just in windowed mode and can't be closed. Is this intended behaviour?

Yes, only one fullscreen window is allowed.


Okay, but sometimes it may happen something as i stated above: a sfml application exits from fullscreen mode, does not finish it's business with freeing resources and restoring resolution and i click another fullscreen application. In this moment the second application is just hanged there. Do you plan to address this issue in the future ?

18
Window / latest SFML snapshot doesn't restore resolution on linux
« on: January 21, 2010, 12:31:02 pm »
Quote from: "Laurent"
Quote
When i press Escape. I thought close was just enough to close the window and restore the resolution, hmm...

That's right, actually ;)
But you should still delete your instance anyway. Or better: don't allocate it with new.


Yes you are right! Here is another code. After compiling the application and running:

./Application & ./Application from the console the app is executed in two instances. The first instance is ok, but the second is just in windowed mode and can't be closed. Is this intended behaviour?

Code: [Select]


////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
#include <fstream>


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create the main window

    sf::RenderWindow Application(sf::VideoMode(800, 600, 32),
"Testing!",sf::Style::Fullscreen);

    // Create a clock for measuring the time elapsed
    sf::Clock Clock;

    // Set the color and depth clear values
    glClearDepth(1.f);
    glClearColor(0.f, 0.f, 0.f, 0.f);

    // Enable Z-buffer read and write
    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);

    // Setup a perspective projection
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(90.f, 1.f, 1.f, 500.f);

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

            // Escape key : exit
            if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
            {
                Application.Close();
                break;
            }
            // Resize event : adjust viewport
            if (Event.Type == sf::Event::Resized)
                glViewport(0, 0, Event.Size.Width, Event.Size.Height);
        }

        // Set the active window before using OpenGL commands
        // It's useless here because the active window is always the same,
        // but don't forget it if you use multiple windows
        Application.SetActive();

        // Clear color and depth buffer
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        // Apply some transformations
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glTranslatef(0.f, 0.f, -200.f);
        glRotatef(Clock.GetElapsedTime() * 50, 1.f, 0.f, 0.f);
        glRotatef(Clock.GetElapsedTime() * 30, 0.f, 1.f, 0.f);
        glRotatef(Clock.GetElapsedTime() * 90, 0.f, 0.f, 1.f);

        // Draw a cube
        glBegin(GL_QUADS);

            glColor3f(1.f, 0.f, 0.f);
            glVertex3f(-50.f, -50.f, -50.f);
            glVertex3f(-50.f,  50.f, -50.f);
            glVertex3f( 50.f,  50.f, -50.f);
            glVertex3f( 50.f, -50.f, -50.f);

            glColor3f(1.f, 0.f, 0.f);
            glVertex3f(-50.f, -50.f, 50.f);
            glVertex3f(-50.f,  50.f, 50.f);
            glVertex3f( 50.f,  50.f, 50.f);
            glVertex3f( 50.f, -50.f, 50.f);

            glColor3f(0.f, 1.f, 0.f);
            glVertex3f(-50.f, -50.f, -50.f);
            glVertex3f(-50.f,  50.f, -50.f);
            glVertex3f(-50.f,  50.f,  50.f);
            glVertex3f(-50.f, -50.f,  50.f);

            glColor3f(0.f, 1.f, 0.f);
            glVertex3f(50.f, -50.f, -50.f);
            glVertex3f(50.f,  50.f, -50.f);
            glVertex3f(50.f,  50.f,  50.f);
            glVertex3f(50.f, -50.f,  50.f);

            glColor3f(0.f, 0.f, 1.f);
            glVertex3f(-50.f, -50.f,  50.f);
            glVertex3f(-50.f, -50.f, -50.f);
            glVertex3f( 50.f, -50.f, -50.f);
            glVertex3f( 50.f, -50.f,  50.f);

            glColor3f(0.f, 0.f, 1.f);
            glVertex3f(-50.f, 50.f,  50.f);
            glVertex3f(-50.f, 50.f, -50.f);
            glVertex3f( 50.f, 50.f, -50.f);
            glVertex3f( 50.f, 50.f,  50.f);

        glEnd();

        // Finally, display the rendered frame on screen
        Application.Display();
    }

    return 0;
}


19
Window / latest SFML snapshot doesn't restore resolution on linux
« on: January 20, 2010, 11:51:53 pm »
Quote from: "Laurent"
Does it happen:

- when you close the window => "delete pApplication", which leads to an undefined behaviour because you don't exit the main loop and still use the pointer

or

- when you press escape => "pApplication->Close()", which leads to a memory leak because you never delete the window, and thus the desktop resolution is never restored

:?:


When i press Escape. I thought close was just enough to close the window and restore the resolution, hmm...

20
Window / latest SFML snapshot doesn't restore resolution on linux
« on: January 20, 2010, 09:37:20 pm »
After further experimentation i have managed to reproduce(every time i was fast enough) a somewhat weird issue. First of all here's the code:

Code: [Select]


////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
#include <fstream>


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create the main window

    sf::RenderWindow* pApplication = new sf::RenderWindow;
    pApplication->Create(sf::VideoMode(800, 600, 32),
"Testing!",sf::Style::Fullscreen);

    // Create a clock for measuring the time elapsed
    sf::Clock Clock;

    // Set the color and depth clear values
    glClearDepth(1.f);
    glClearColor(0.f, 0.f, 0.f, 0.f);

    // Enable Z-buffer read and write
    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);

    // Setup a perspective projection
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(90.f, 1.f, 1.f, 500.f);

    // Start the game loop
    while (pApplication->IsOpened())
    {
        // Process events
        sf::Event Event;
        while (pApplication->GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
            {
                delete pApplication;
                //pApplication->Close();
            }

            // Escape key : exit
            if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
                pApplication->Close();

            // Resize event : adjust viewport
            if (Event.Type == sf::Event::Resized)
                glViewport(0, 0, Event.Size.Width, Event.Size.Height);
        }

        // Set the active window before using OpenGL commands
        // It's useless here because the active window is always the same,
        // but don't forget it if you use multiple windows
        pApplication->SetActive();

        // Clear color and depth buffer
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        // Apply some transformations
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glTranslatef(0.f, 0.f, -200.f);
        glRotatef(Clock.GetElapsedTime() * 50, 1.f, 0.f, 0.f);
        glRotatef(Clock.GetElapsedTime() * 30, 0.f, 1.f, 0.f);
        glRotatef(Clock.GetElapsedTime() * 90, 0.f, 0.f, 1.f);

        // Draw a cube
        glBegin(GL_QUADS);

            glColor3f(1.f, 0.f, 0.f);
            glVertex3f(-50.f, -50.f, -50.f);
            glVertex3f(-50.f,  50.f, -50.f);
            glVertex3f( 50.f,  50.f, -50.f);
            glVertex3f( 50.f, -50.f, -50.f);

            glColor3f(1.f, 0.f, 0.f);
            glVertex3f(-50.f, -50.f, 50.f);
            glVertex3f(-50.f,  50.f, 50.f);
            glVertex3f( 50.f,  50.f, 50.f);
            glVertex3f( 50.f, -50.f, 50.f);

            glColor3f(0.f, 1.f, 0.f);
            glVertex3f(-50.f, -50.f, -50.f);
            glVertex3f(-50.f,  50.f, -50.f);
            glVertex3f(-50.f,  50.f,  50.f);
            glVertex3f(-50.f, -50.f,  50.f);

            glColor3f(0.f, 1.f, 0.f);
            glVertex3f(50.f, -50.f, -50.f);
            glVertex3f(50.f,  50.f, -50.f);
            glVertex3f(50.f,  50.f,  50.f);
            glVertex3f(50.f, -50.f,  50.f);

            glColor3f(0.f, 0.f, 1.f);
            glVertex3f(-50.f, -50.f,  50.f);
            glVertex3f(-50.f, -50.f, -50.f);
            glVertex3f( 50.f, -50.f, -50.f);
            glVertex3f( 50.f, -50.f,  50.f);

            glColor3f(0.f, 0.f, 1.f);
            glVertex3f(-50.f, 50.f,  50.f);
            glVertex3f(-50.f, 50.f, -50.f);
            glVertex3f( 50.f, 50.f, -50.f);
            glVertex3f( 50.f, 50.f,  50.f);

        glEnd();

        // Finally, display the rendered frame on screen
        pApplication->Display();
    }

    return EXIT_SUCCESS;
}


Now for the problem: run the application and just after you see the desktop run it again but very fast, so the resolution switch is not complete. The application will either run in window mode or run as usual but not preserve the resolution. I'm running on Ubuntu 9.10 here. Thanks!

21
Window / latest SFML snapshot doesn't restore resolution on linux
« on: January 20, 2010, 09:14:31 pm »
Quote from: "AdrianM"
Quote from: "Laurent"
Does the same thing happen with SFML 1.5?

Can you show your code?


The code is kind of long, i'll make some minimal example right away!


Further tests did not show up the problem anymore. It just happened the first time i ran the sfml application. Now it seems it's working fine. I'll tests on other machines and report back!
Thanks for the fast reply!

22
Window / latest SFML snapshot doesn't restore resolution on linux
« on: January 20, 2010, 08:48:25 pm »
Quote from: "Laurent"
Does the same thing happen with SFML 1.5?

Can you show your code?


The code is kind of long, i'll make some minimal example right away!

23
Window / latest SFML snapshot doesn't restore resolution on linux
« on: January 20, 2010, 08:42:17 pm »
I just downloaded the snapshot from here: http://www.sfml-dev.org/download.php. I'm running on Ubuntu 9.10 and after the application exited the resolution was not restored(it remained under the resolution of the sfml application). Is this a problem with SFML or i am forgetting something?

24
Window / Want to draw an image onto a window and not use OpenGL, how?
« on: January 09, 2010, 11:09:42 am »
Quote from: "Laurent"
There's no way to do this in SFML other than using a dynamic OpenGL texture.

Well, too bad!

Quote
i figure uploading the video frame through gdi(on windows) for example would be much faster than uploading it to video memory as a texture

Are you sure of that? Did you make tests?


No, i didn't i'm just guessing here :D.

25
Window / Want to draw an image onto a window and not use OpenGL, how?
« on: January 09, 2010, 04:01:51 am »
Is it possible to draw an image onto the screen using SFML, but not usin OpenGL at all? I'm asking that because i'm streaming some video using theora and i figure uploading the video frame through gdi(on windows) for example would be much faster than uploading it to video memory as a texture, on older less powerful video cards. Can i do this? If not is there a way i can access the hdc for example so i can implement this?

26
SFML projects / Pirate's Treasure & Enchanted Forest
« on: August 18, 2009, 01:00:57 am »
I must say i thank all of you who helped creating SFML and who used it and helped make it a better library. I have succesufully used SFML in two quite similar projects: two arkanoid style games. What follows is a copy-paste from another post i made on gamedev.net(well, i am lazy programmer :) ).

I graduated this year with a Bsc in Computer Science and my graduation coincided with the completion of two casual games i worked on with a few friends.(i was responsible for all the programming). The games are two arkanoid clones with two different themes. They run well on Windows and also Macintosh(ppc or intel). For the development i used C++, a little ObjC, OpenGL, SFML, OpenAL, OpenALSoft(yes this was necessary because OpenAL crashed on Mac OS X sometimes, at that time), ogg and vorbis. You can find more information about the games at http://www.magic-games.net.

The development took a little too long because this was the first time we did something like this and we had a lazy artist, but i guess we met the deadline of me graduating and also completing not one but two games(rather similar :D ). I know there has been a long discussion about game clones and originality but i hope you enjoy the games. You can download them from the above mentioned site(and also PlayFirst.com) but if you do consider on purchasing one of them please support us and do it from http://www.magic-games.net (we use paypal and 2checkout so it's completely safe).

Enjoy and feel free to share any thoughts/suggestions/commentaries you might have.

PS: it seems some images contain artefacts due to the VSync off, these are not present in the actual game.(well they are not visible), also note that the first and last image have their description switched, i am sorry.

Screenshots:















27
Window / [MAC] Unwanted Alert Sound playing when pressing ESCAPE
« on: August 16, 2009, 07:34:20 pm »
Quote from: "Ceylo"
This has been fixed in the sources of the Subversion repository. You should try to build the frameworks from these sources.


Thanks Ceylo, i compiled the last svn sources and the alert sound is gone!

28
Window / [MAC] Unwanted Alert Sound playing when pressing ESCAPE
« on: August 16, 2009, 02:16:16 pm »
Quote from: "Meltra Bour"
I had a similar problem while running tutorials on a linux, my conclusion back then was ...

App.Close(); destroys the openGL context, so in your main loop you first destroy openGL and then you start making openGL calls.

Ether break out of the while loop right after calling App.Close() or
work with a boolean to keep the loop active and move App.Close() to a nice spot after the while loop.

*cross fingers* :P


It sounds similar but it is not quite my problem. I never close the application.  The alert sound plays when running the app, i don't call App.Close() when the escape is pressed...

29
Window / [MAC] Unwanted Alert Sound playing when pressing ESCAPE
« on: August 16, 2009, 12:30:00 am »
I have created a simple cocoa application from the template, renamed main.m to main.mm and added the opengl sample from the samples directory which comes with the sfml SDK. I modified it a little bit so that no background image is loaded and when you press escape to not exit. But everytime i press escape an alert sound plays. I don't want this to happen, how can i prevent it?
I want the bundle with the window to use it for registering the application (outside opengl), so this is a must, everything is done and working except for this naughty alert sound. :D. How can i prevent it?

Here is an example project: just run it and press escape, an alert sound will be played. Also i am using SFML 1.5.

http://www.gamesrebirth.com/adrian/alert_test.zip

30
Window / Mac OS X: [NSApplication terminate] does not work
« on: July 10, 2009, 03:40:36 pm »
Quote from: "Ceylo"
What are your "calls" ?

And whatever the sfml-window Mac OS X implementation, -[NSApplication terminate:] uses an exit like function, so this call will always work. Maybe you're talking of the Quit menu item ?


[SOLVED] :D

I was trying to call [[NSApplication sharedApplication] terminate:self] and also [NSApp terminate:self].

I SOLVED the issues by downloading SFML 1.5 (i was using SFML 1.4). I'm very happy now because this was keeping my work pending. Thanks a lot guys!

Pages: 1 [2] 3
anything