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

Author Topic: Drawing amount of pixels on the screen.  (Read 1864 times)

0 Members and 1 Guest are viewing this topic.

Exxtay

  • Newbie
  • *
  • Posts: 3
    • View Profile
Drawing amount of pixels on the screen.
« on: January 02, 2013, 02:06:32 pm »
Hello everyone.
I'll be short:
We need to draw an array of pixels, which size depends of the size of the screen. It means that array of pixels will fill up an entire screen.
So. We stopped at two ways to solve our problem.
The first one:
Just draw the screen-sized sprite with all data we need.
And second one:
To draw the screen-sized shape, using it's *point* functions.

But... all of that cases not seems to be a very good, and we need to go a bit deeper:
we need just to get access to draw a pixels on the screen and... how to do that without going these probably bad ways like displaying sprite and shape.

Why we need this?
It's just because we're doing some experiments with SVO (sparse voxel octree) and RayTrace rendering system, and we don't really need the graphics libraries, such as OpenGL and whatever.
We just need to draw the pixels (points) onto the screen, with it's colors, based on result of rendering our SVO.
And that's it.

Hope you get me, and thank a lot.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Drawing amount of pixels on the screen.
« Reply #1 on: January 02, 2013, 02:12:45 pm »
1. Initialize a texture to the correct size with sf::Texture::create().
2. Every time the pixels change, call sf::Texture::update() to load the pixels to the texture.
3. Draw a sprite using that texture.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Exxtay

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Drawing amount of pixels on the screen.
« Reply #2 on: January 02, 2013, 02:33:46 pm »
And of course It's works fast enough to do that 60 or more times per second?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Drawing amount of pixels on the screen.
« Reply #3 on: January 02, 2013, 02:40:50 pm »
It depends on the graphics card and the size of the texture, but it should be ok.
Laurent Gomila - SFML developer