void copy_from(buffer& source) { source.unmap(); source.bind(); GL(glBindTexture(GL_TEXTURE_2D, id_)); GL(glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width_, height_, FORMAT[stride_], TYPE[stride_], NULL)); GL(glBindTexture(GL_TEXTURE_2D, 0)); source.unbind(); source.map(); // Just map it back since map will orphan buffer. }
void copy_to(buffer& dest) { dest.unmap(); dest.bind(); GL(glBindTexture(GL_TEXTURE_2D, id_)); GL(glReadBuffer(GL_COLOR_ATTACHMENT0)); GL(glReadPixels(0, 0, width_, height_, FORMAT[stride_], TYPE[stride_], NULL)); GL(glBindTexture(GL_TEXTURE_2D, 0)); dest.unbind(); GL(glFlush()); }
void fbo::draw_elements(const buffer& buffer_, rsx::primitive_type mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset) const { buffer_.bind(buffer::target::array); draw_elements(mode, count, type, indices, indices_buffer_offset); }
void fbo::draw_elements(rsx::primitive_type mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset) const { indices.bind(buffer::target::element_array); glDrawElements(draw_mode(mode), count, (GLenum)type, (GLvoid*)indices_buffer_offset); }
void fbo::draw_elements(const buffer& buffer, rsx::primitive_type mode, GLsizei count, indices_type type, const GLvoid *indices) const { buffer.bind(buffer::target::array); glDrawElements(draw_mode(mode), count, (GLenum)type, indices); }
void fbo::draw_arrays(const buffer& buffer, rsx::primitive_type mode, GLsizei count, GLint first) const { buffer.bind(buffer::target::array); draw_arrays(mode, count, first); }