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

Author Topic: Image non const byte access  (Read 2695 times)

0 Members and 1 Guest are viewing this topic.

Babalas

  • Newbie
  • *
  • Posts: 1
    • View Profile
Image non const byte access
« on: March 28, 2012, 11:23:19 pm »
Hi,

There is a method GetPixelsPtr that can be used to write image data to ogl, but I haven't yet found a way to read from ogl back into an image. It seems the only way to do this is to create a temp memory buffer, read into this buffer, then use Image::Create to copy from this temp buffer.

What would be nice is the ability to construct an empty
Image(width, height)
that would call
myPixels.reserve(width * height * 4)
Then have
Uint8* GetPixelsPtr() { return &myPixels[0]; }

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Re: Image non const byte access
« Reply #1 on: March 29, 2012, 02:53:16 am »
http://www.sfml-dev.org/documentation/2.0/classsf_1_1Image.php

You can both create the image with the pixel data directly, and you can later set all pixels, what else do you need? :)