| View previous topic :: View next topic |
| Author |
Message |
armage Level-0

Joined: 18 Feb 2008 Posts: 10
|
|
| Back to top |
|
 |
dabo Level-3

Joined: 16 Sep 2007 Posts: 257 Location: Sweden
|
Posted: Tue Feb 19, 2008 7:52 pm Post subject: |
|
|
| Code: | sf::RenderWindow App(sf::VideoMode(800, 600), "SFML window");
App.UseVerticalSync(true); |
|
|
| Back to top |
|
 |
armage Level-0

Joined: 18 Feb 2008 Posts: 10
|
Posted: Tue Feb 19, 2008 8:27 pm Post subject: |
|
|
Thank you for your reponse. I tried your suggestion but there is no response.
How do I enable double buffering? |
|
| Back to top |
|
 |
zarka Level-1

Joined: 20 Aug 2007 Posts: 81 Location: Sweden
|
Posted: Tue Feb 19, 2008 8:58 pm Post subject: |
|
|
i belive SFML uses double buffering by default ...
and if UseVerticalSync(true) didn't do anything you have most likely disabled v-sync in your graphics card drivers. You will probably be able to change v-sync settings in the settings program for your graphics driver. _________________ //Zzzarka |
|
| Back to top |
|
 |
armage Level-0

Joined: 18 Feb 2008 Posts: 10
|
Posted: Tue Feb 19, 2008 9:20 pm Post subject: |
|
|
I tried looking up some GLUT double buffering examples. It is working on my computer with no flicker and seems pretty smooth.
In GLUT there is a way to initialize double buffering. How do I code double buffering anyway? |
|
| Back to top |
|
 |
armage Level-0

Joined: 18 Feb 2008 Posts: 10
|
Posted: Tue Feb 19, 2008 9:51 pm Post subject: |
|
|
Just one question, when I do
| Code: |
sf::RenderWindow App;
App.Create(sf::VideoMode(1280, 768, 32), "SFML Window",sf::Style::Fullscreen, 4);
|
Is this using the win32?
Meaning, did stuff like:
| Code: | pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
PFD_DOUBLEBUFFER;
SwapBuffers( hDC ); |
|
|
| Back to top |
|
 |
Laurent Administrator


Joined: 30 May 2007 Posts: 8386 Location: Metz, France
|
Posted: Wed Feb 20, 2008 1:37 am Post subject: |
|
|
You shouldn't care about internal behaviour of SFML. Of course it's using double-buffering, and of course it's using all the Win32 stuff it needs.
You should rather show us your code, and if possible, upload a compiled version of your app so that we can see what happens. _________________ Laurent Gomila - SFML developer |
|
| Back to top |
|
 |
retrogamer4ever Level-0

Joined: 06 May 2009 Posts: 6
|
Posted: Wed May 27, 2009 5:52 pm Post subject: I still get a bit of flicker.... |
|
|
I still see a bit of flickering, or it could just be that i am crazy... Here is my code
| Code: |
#include "stdafx.h"
#include "sfml.h"
using namespace sf;
int main()
{
// Create the main window
RenderWindow App(VideoMode(616, 387, 32), "SFML Window");
App.UseVerticalSync(true);
Image img_background;
if(!img_background.LoadFromFile("c://background.png"))
return -1;
Image img_ball;
if(!img_ball.LoadFromFile("c://ball.png"))
return -1;
Sprite background(img_background);
Sprite ball(img_ball);
ball.SetY(325);
while (App.IsOpened())
{
Event Event;
while (App.GetEvent(Event))
{
if (Event.Type == Event::Closed)
App.Close();
if ((Event.Type == Event::KeyPressed) && (Event.Key.Code == Key::Escape))
App.Close();
}
if (App.GetInput().IsKeyDown(Key::Right)) ball.Move(100, 0);
if (App.GetInput().IsKeyDown(Key::Left)) ball.Move(-100, 0);
App.Clear();
App.Draw(background);
App.Draw(ball);
App.Display();
}
return EXIT_SUCCESS;
}
|
I basically just had two simple images, one background image colored red that was the size of the window, and a white ball image that I moved back and forth... The white ball tends to flicker sometimes though. Any idea why it would? I have solved this flickering issue in the past by just preforming some double buffering, but doesn't seem like you can easily add sprites with in sprites. Any idea what I might be doing wrong? Or is the flickering all in my head  |
|
| Back to top |
|
 |
|