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

Author Topic: Wierd problem: Transparent render window  (Read 4424 times)

0 Members and 1 Guest are viewing this topic.

BlackPhoenix

  • Newbie
  • *
  • Posts: 7
    • View Profile
Wierd problem: Transparent render window
« on: May 14, 2009, 11:03:39 pm »
Hello,

I'm having a very wierd problem that I cannot explain at all. I'm using SFML 1.4 with Codeblocks 8.02. So here's what happened:

I tested yesterday my program and the window displayed stuff, as it was supposed to. Today I decided to go on with my Pong project but when I run the program again, the window showed nothing. I mean it was like it was transparent, showing the background of the desktop. Actually I had the same problem 2 days ago when I decided to return to making Pong after a long time. Well I remember that the last time I left it, it actually showed stuff, but when I run it again 2 days ago, nothing. Well I didnt care much at the time and went on to update a lot my code, almost done it all again, so i dont know what have I done to fix it  :( . Sorry if it's a bit confusing...Here's my main(), I think it's a standard clear draw display loop...

Code: [Select]
int main()
{
    // Create the main window
    sf::RenderWindow App(sf::VideoMode(800, 600), "Pong!");

    //Board pong;

    float32 timestep = 1.0f/60.0f;
    int32 iterations = 10;

    BoardActors pong(30.0f,&App);

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

//ignore that stuff
        //pong.board_physics->world->Step(timestep,iterations);
        b2Vec2 pos = pong.board_physics->ball->GetPosition();
        std::cout<<pos.x<<"\t"<<pos.y<<std::endl;
        //std::cout<<pong.board_physics->player2->IsStatic();


        //Drawing
        // Clear screen
        App.Clear();
        pong.updateGraphics();
        pong.board_graphics->draw();

        App.Display();
    }

    return EXIT_SUCCESS;
}


pong.board_graphics->draw()
Code: [Select]

void BoardGraphics::draw()
{
    display->Draw(lowerBound);
    display->Draw(upperBound);
    display->Draw(player1);
    display->Draw(player2);
    display->Draw(ball);
}


I also tried creating a simple circle to display but that didnt work either  :(
What am I doing wrong?

edit: Ok it seems that I've posted on the wrong subforum... Sorry about that, mods please move the post to the Window subforum.

It seems that I've solved the problem, though not sure if this "solution" will last...The only thing I've changed was this:

Code: [Select]

sf::RenderWindow App(sf::VideoMode::GetDesktopMode(), "Pong!",sf::Style::Fullscreen);


Actually it doesnt make any sense at all, because I switched back to the original right after I saw that it worked on fullscreen and 1280x1024 and...it worked again. Could it be that 800x600 is not a valid video mode??

nitram_cero

  • Full Member
  • ***
  • Posts: 166
    • View Profile
Wierd problem: Transparent render window
« Reply #1 on: May 16, 2009, 12:35:40 am »
Do you have a widescreen monitor?

You can list valid video modes with:

Code: [Select]
for(int i=0; i<sf::VideoMode::GetModesCount(); i++) {
   std::cout << i
   << " - W: " sf::VideoMode::GetMode(i).Width
   << " - H: " sf::VideoMode::GetMode(i).Height
   << " - BPP: " sf::VideoMode::GetMode(i).BitsPerPixel << std::endl;
}


I think widescreen monitors handle 4:3 dimensions by stretching them awefuly. They usually don't fail. But your milage may vary.

Good luck!
-Martín

BlackPhoenix

  • Newbie
  • *
  • Posts: 7
    • View Profile
Wierd problem: Transparent render window
« Reply #2 on: May 18, 2009, 07:38:50 pm »
Thanks for the input, no I use a standard 4:3 17" lcd monitor. 800x600 with 32bpp is listed as a supported mode... Problem returns every time I switch on the pc. Maybe it has something to do with OpenGL not initializing correctly, or my vga?

edit: Ok just downloaded another project using SFML from the SFML projects subforum and had the exact same problem, meaning it is not my code generating this behavior... Maybe I havent installed it correctly? But then why dont I get any errors, and worse why does it work sometimes? I'm totally clueless   :(

SamuraiCrow

  • Newbie
  • *
  • Posts: 40
    • Yahoo Instant Messenger - samuraileumas
    • View Profile
Wierd problem: Transparent render window
« Reply #3 on: May 19, 2009, 06:29:23 pm »
What's the alpha-blending set to on the background color?

BlackPhoenix

  • Newbie
  • *
  • Posts: 7
    • View Profile
Wierd problem: Transparent render window
« Reply #4 on: May 19, 2009, 08:32:18 pm »
Quote from: "SamuraiCrow"
What's the alpha-blending set to on the background color?


I'm using the standard value through App.Clear() so I guess it's 255. I've narrowed down the problem. It occurs after launching a game from Steam, so far only games based on the source engine, like Half life 2 or Team Fortress 2.

nitram_cero

  • Full Member
  • ***
  • Posts: 166
    • View Profile
Wierd problem: Transparent render window
« Reply #5 on: May 20, 2009, 11:57:36 pm »
Try reinstalling the drivers (uninstall, reboot, install, reboot) and checking if the GPU cooler is working correctly. An overheated GPU could be going erratically nuts :)

BlackPhoenix

  • Newbie
  • *
  • Posts: 7
    • View Profile
Wierd problem: Transparent render window
« Reply #6 on: May 22, 2009, 02:28:19 pm »
Quote from: "nitram_cero"
Try reinstalling the drivers (uninstall, reboot, install, reboot) and checking if the GPU cooler is working correctly. An overheated GPU could be going erratically nuts :)


I installed the latest drivers but the problem persists, and my vga is fanless (nvidia 7600 gt)...Anyway, it seems to be the kind of problem that requires a format to be solved, and I definitevely wont be doing that. I'm getting used to restarting the pc every time i want to work on my project. Thanks for all your help  :)

nitram_cero

  • Full Member
  • ***
  • Posts: 166
    • View Profile
Wierd problem: Transparent render window
« Reply #7 on: May 22, 2009, 05:29:21 pm »
Have you tried to uninstall them first? In windows it makes a WHOLE difference  :lol:

After uninstalling also remove anything relevant from the Device Manager.

Reboot and then install.

Good luck!

BlackPhoenix

  • Newbie
  • *
  • Posts: 7
    • View Profile
Wierd problem: Transparent render window
« Reply #8 on: May 23, 2009, 12:38:18 pm »
I unistalled the drivers, rebooted and then installed the latest and rebooted again. While running the application, the gpu reads a temperature of 54-56 Celcium which is normal I think. For all I know it may even be a bug of the source engine  :D

nitram_cero

  • Full Member
  • ***
  • Posts: 166
    • View Profile
Wierd problem: Transparent render window
« Reply #9 on: May 23, 2009, 02:00:23 pm »
SFML could be missing some initialization/clearing/something, and the graphics card is keeping a rotten state.

Or maybe it's a divine message for you to work more on your game and play less!  :lol:

Matogel

  • Newbie
  • *
  • Posts: 3
    • View Profile
Wierd problem: Transparent render window
« Reply #10 on: October 12, 2011, 06:53:06 am »
"I unistalled the drivers, rebooted and then installed the latest and rebooted again. While running the application, the gpu reads a temperature of 54-56 Celcium which is normal I think. For all I know it may even be a bug of the source engine"

I did this too. seem to work fine for me.