Exemplo n.º 1
0
QwtDoubleRect ImageMarker::boundingRect() const
{
    return QwtDoubleRect(xValue(), yValue(), qAbs(d_x_right - xValue()), qAbs(d_y_bottom - yValue()));
}
Exemplo n.º 2
0
void ellipsoidWireFrame() {

    static GLuint vertBuffer;
    static GLuint normalsBuffer;
    static GLuint indexBuffer;
    static GLboolean first = GL_TRUE;
    GLfloat u,v;
    int m,n;
    int cnt=0;

    if (first || changeFlag) {

        for (n=0; n <= BIG_N; n++) {
            v = -M_PI/2.0 + (float) n/ (float) BIG_N * M_PI;
            for (m=0; m <= BIG_M; m++) {
                u = -M_PI + (float) m/ (float) BIG_M  * 2.0 * M_PI;

                verticesArray[cnt] = xValue(u,v);
                normalsArray[cnt] = nxValue(u,v);

                cnt++;

                verticesArray[cnt] = yValue(u,v);
                normalsArray[cnt] = nyValue(u,v);

                cnt++;

                verticesArray[cnt] = zValue(u,v);
                normalsArray[cnt] = nzValue(u,v);

                cnt++;

            }


        }
        glGenBuffers(1, &vertBuffer);
        glBindBuffer(GL_ARRAY_BUFFER, vertBuffer);
        glBufferData(GL_ARRAY_BUFFER, sizeof(verticesArray),
                     verticesArray, GL_STATIC_DRAW);

        glGenBuffers(1, &normalsBuffer);
        glBindBuffer(GL_ARRAY_BUFFER,normalsBuffer);
        glBufferData(GL_ARRAY_BUFFER, sizeof(normalsArray),
                     normalsArray, GL_STATIC_DRAW);

        if (first) {
            createMeshStripIndices();
            glGenBuffers(1, &indexBuffer);
            glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
            glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(tubeStrips),
                         tubeStrips, GL_STATIC_DRAW);
        }
        first = GL_FALSE;
        changeFlag = GL_FALSE;
    }

    loadUniforms();


    glEnableVertexAttribArray(vertexPositionAttr);
    glBindBuffer(GL_ARRAY_BUFFER, vertBuffer);
    glVertexAttribPointer(vertexPositionAttr,3, GL_FLOAT,GL_FALSE, 0, (GLvoid*) 0);

    glBindBuffer(GL_ARRAY_BUFFER, normalsBuffer);

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,indexBuffer);

    glDrawElements(GL_QUAD_STRIP, TOTAL_INDICES, GL_UNSIGNED_SHORT, (GLvoid*) 0);


}