Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Set a pixel in an image
- By parasight Date 2009-10-17 10:34
Hi,

is there a way to set a pixel in an image without using Gosu::Bitmap?

Doing something like

  bitmap_.setPixel(160, 120, Gosu::Color(255, 255, 255));
  image_.reset(new Gosu::Image(graphics(), bitmap_));
  image_->draw(0, 0, 1);

in Gosu::Window::draw() seems to be quite an overhead, isn't it?

TIY
- By jlnr (dev) Date 2009-10-17 14:44
You can try and see if the overhead is too much for you. I did something similar in Ruby once and it was actually fast enough.

The workaround is to get the GL texture name from glTexInfo() and then use glTexSubImage2D or what it's called to update a region of the image. You can check the texplay library for Ruby/Gosu to see how it works, it's been posted in the "Extending Gosu" board.
Up Topic Gosu / Gosu Exchange / Set a pixel in an image

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill