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

Author Topic: background color  (Read 3363 times)

0 Members and 1 Guest are viewing this topic.

sand7000

  • Newbie
  • *
  • Posts: 1
    • View Profile
background color
« on: March 25, 2009, 03:57:16 am »
I am unable to change the background color of the windows I create. I tried using glClearColor( 1.f , 1.f , 1.f , 1.f ) but it doesn't do anything. Any help would be appreciated. I would also like to know why the SetBackgroundColor() function  from version 1.3 (which was a member of the renderWindow class) doesn't exist in version 1.4.

Thanks!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
background color
« Reply #1 on: March 25, 2009, 07:50:20 am »
Quote
I am unable to change the background color of the windows I create. I tried using glClearColor( 1.f , 1.f , 1.f , 1.f ) but it doesn't do anything

glClearColor only sets the clear color. It doesn't clear the screen. To do so, you have to call glClear(GL_COLOr_BUFFER_BIT).

Quote
I would also like to know why the SetBackgroundColor() function from version 1.3 (which was a member of the renderWindow class) doesn't exist in version 1.4

It has been replaced with Clear(sf::Color). This is much more flexible :
- Many applications have a background sprite and thus can avoid calling it
- You can now call RenderWindow::Capture wherever you want between Display() and Clear(), especially in your event loop
- Some people think it's a good optimization to keep the contents of the previous frame and update only what's needed; at least now they can do it
Laurent Gomila - SFML developer

 

anything