void NativeImage::draw(const Rectangle& bounds) { refreshTexture(); if (isEmpty()) { return; } const Point t1(size.width, 0); const Point t2(0, size.height); const Point v1 = bounds.getUpperRightCorner(); const Point v2 = bounds.getLowerLeftCorner(); glEnable(GL_TEXTURE_RECTANGLE_ARB); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texture); glBegin(GL_QUADS); glTexCoord2i(t1.x, t1.y); glVertex2i(v1.x, v1.y); glTexCoord2i(t2.x, t1.y); glVertex2i(v2.x, v1.y); glTexCoord2i(t2.x, t2.y); glVertex2i(v2.x, v2.y); glTexCoord2i(t1.x, t2.y); glVertex2i(v1.x, v2.y); glEnd(); glDisable(GL_TEXTURE_RECTANGLE_ARB); }
void Image2D::loadImage(Mat img) { image=img; refreshTexture(); }
void Image2D::loadImage(const char* file) { //Load image image=imread(file); refreshTexture(); }