[osg-users] Equivalent of glTexSubImage2D ?

Johny Canes psijsma at gmail.com
Wed Mar 1 00:47:20 PST 2017


Thanks for the amazing answers. I'm not trying for sprites, I'm for a repaint over an existing surface. The code below works on another project of mine, but I haven't got it working in my OSG app yet...

What it does, it gives you an BGRA buffer for you to paint your existing surface with.

void nr::as::Zurface::Paint(unsigned char* src_buffer, int src_row_span, const Awesomium::Rect& src_rect, const Awesomium::Rect& dest_rect) {
	auto cid = gGc->getState()->getContextID();

	texture->getTextureObject( cid )->bind();

	unsigned char* a = &src_buffer[0];

	glTexSubImage2D(GL_TEXTURE_2D, 0, dest_rect.x, dest_rect.y, dest_rect.width, dest_rect.height, GL_BGRA_EXT, GL_UNSIGNED_BYTE, a);

	glBindTexture( GL_TEXTURE_2D, 0 ); // unbind?

Awesomium has its own threads and this one is an arbitrary callback. Should I mutex?

Thank you!


Read this topic online here:

More information about the osg-users mailing list