Пример #1
0
void Sky::uploadToGpu ()
{
	initializeExtensions ();
	glGenBuffers ( 1, &vertexBufferId_ );
	glBindBuffer ( GL_ARRAY_BUFFER, vertexBufferId_ );
	glBufferData ( GL_ARRAY_BUFFER, sizeof(Vertex) * nVertices_,
		           vertices_, GL_STATIC_DRAW );
	glBindBuffer ( GL_ARRAY_BUFFER, 0 );

	glGenBuffers ( 1, &indexId_ );
	glBindBuffer ( GL_ELEMENT_ARRAY_BUFFER, indexId_ );
	glBufferData ( GL_ELEMENT_ARRAY_BUFFER, sizeof(unsigned int) * nTriangles_ * 3,
		           indices_, GL_STATIC_DRAW );
	glBindBuffer ( GL_ELEMENT_ARRAY_BUFFER, 0 );

	int coordOffset = (int)&vertices_[0].coord - (int)&vertices_[0];

	vao_ = new VAO ();

	vao_ -> bind ();
	glPushClientAttrib  ( GL_CLIENT_VERTEX_ARRAY_BIT );
	glEnableClientState ( GL_VERTEX_ARRAY );

	glBindBuffer ( GL_ARRAY_BUFFER, vertexBufferId_ );
	glVertexPointer ( 3, GL_FLOAT, sizeof(Vertex), (void *)coordOffset );
	glBindBuffer ( GL_ELEMENT_ARRAY_BUFFER, indexId_ );
	vao_ -> unbind ();
}
Пример #2
0
bool GraphicsContext3DInternal::ensureExtensionEnabled(const String& name)
{
    initializeExtensions();

    String mappedName = mapExtensionName(name);
    if (m_enabledExtensions.contains(mappedName))
        return true;

    if (m_requestableExtensions.contains(mappedName)) {
        m_impl->requestExtensionCHROMIUM(mappedName.ascii().data());
        m_enabledExtensions.clear();
        m_requestableExtensions.clear();
        m_initializedAvailableExtensions = false;
    }

    initializeExtensions();
    return m_enabledExtensions.contains(mappedName);
}
Пример #3
0
bool Extensions3DUtil::ensureExtensionEnabled(const String& name)
{
    if (m_enabledExtensions.contains(name))
        return true;

    if (m_requestableExtensions.contains(name)) {
        m_context->requestExtensionCHROMIUM(name.ascii().data());
        m_enabledExtensions.clear();
        m_requestableExtensions.clear();
        initializeExtensions();
    }
    return m_enabledExtensions.contains(name);
}
Пример #4
0
//-----------------------------------------------------------------------------
// Function: StickyNote::StickyNote()
//-----------------------------------------------------------------------------
StickyNote::StickyNote(QGraphicsItem* parent):
    QGraphicsItemGroup(parent),
    Associable(),
    oldPos_(),
    extension_(),
    positionExtension_(),
    contentExtension_(),
    associationExtensions_(),
    timestampExtension_(),
    textArea_(0),
    timeLabel_(0),
    associationButton_(0)
{
    initializeExtensions();

    setItemOptions();
    createGluedEdge();
    createWritableArea();
    createAssociationButton();

    setTimestamp(getFormattedTimestamp());

    connect(textArea_, SIGNAL(contentChanged()), this, SLOT(onTextEdited()), Qt::UniqueConnection);
}
Пример #5
0
bool GraphicsContext3DInternal::isExtensionEnabled(const String& name)
{
    initializeExtensions();
    String mappedName = mapExtensionName(name);
    return m_enabledExtensions.contains(mappedName);
}
Пример #6
0
bool GraphicsContext3DInternal::supportsExtension(const String& name)
{
    initializeExtensions();
    String mappedName = mapExtensionName(name);
    return m_enabledExtensions.contains(mappedName) || m_requestableExtensions.contains(mappedName);
}