int rcUpdateColorBuffer_enc(void *self , uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels) { renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; IOStream *stream = ctx->m_stream; const unsigned int __size_pixels = (((glUtilsPixelBitSize(format, type) * width) >> 3) * height); unsigned char *ptr; const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4; ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4); int tmp = OP_rcUpdateColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; memcpy(ptr, &packetSize, 4); ptr += 4; memcpy(ptr, &colorbuffer, 4); ptr += 4; memcpy(ptr, &x, 4); ptr += 4; memcpy(ptr, &y, 4); ptr += 4; memcpy(ptr, &width, 4); ptr += 4; memcpy(ptr, &height, 4); ptr += 4; memcpy(ptr, &format, 4); ptr += 4; memcpy(ptr, &type, 4); ptr += 4; stream->flush(); stream->writeFully(&__size_pixels,4); stream->writeFully(pixels, __size_pixels); int retval; stream->readback(&retval, 4); return retval; }
void rcCloseColorBuffer_enc(void *self , uint32_t colorbuffer) { renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; IOStream *stream = ctx->m_stream; unsigned char *ptr; const size_t packetSize = 8 + 4; ptr = stream->alloc(packetSize); int tmp = OP_rcCloseColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; memcpy(ptr, &packetSize, 4); ptr += 4; memcpy(ptr, &colorbuffer, 4); ptr += 4; stream->flush(); }