Exemplo n.º 1
0
//!\brief  Draw a frame contained in an IplTexture object on an OpenGL viewport.
void IplTexture::drawQuad(float x, float y, float _width, float _height)
{
    if (!this || !getIm()) return;

    IplImage *im = getIm();
    int w = im->width-1;
    int h = im->height-1;

    float width = (_width==0 ? im->width : _width);
    float height = (_height==0 ? im->height : _height);


    loadTexture();

    glBegin(GL_QUADS);

    glTexCoord2f(u(0), v(0));
    glVertex2f(x, y);

    glTexCoord2f(u(w), v(0));
    glVertex2f(x+width, y);

    glTexCoord2f(u(w), v(h));
    glVertex2f(x+width, y+height);

    glTexCoord2f(u(0), v(h));
    glVertex2f(x, y+height);
    glEnd();

    disableTexture();
}
Exemplo n.º 2
0
Complex Complex::diff(const Complex& b) const
{
	return Complex(getRe()-b.getRe(), getIm()-b.getIm());
}
Exemplo n.º 3
0
Complex Complex::add(const Complex& b) const
{
	return Complex(getRe()+b.getRe(), getIm()+b.getIm());
}