VertexBuffer::VertexBuffer(RenderContext* rc, const VertexDeclaration& decl, const BinaryDataStorage& data, BufferDrawType vertexDrawType, const std::string& aName) : APIObject(aName), _rc(rc), _decl(decl), _drawType(vertexDrawType) { GLuint buffer = 0; glGenBuffers(1, &buffer); setAPIHandle(buffer); setData(data.data(), data.dataSize()); }
void Renderer::readFramebufferData(const vec2i& size, TextureFormat format, DataType dataType, BinaryDataStorage& data) { ET_ASSERT((8 * data.size()) >= (size.square() * bitsPerPixelForTextureFormat(format, dataType))); glReadPixels(0, 0, size.x, size.y, textureFormatValue(format), dataTypeValue(dataType), data.data()); checkOpenGLError("glReadPixels"); }