Example #1
0
void Model::draw(Camera * camera)
{
    shaderProgram()->setUniformMatrix4fv("projection", camera->projectionMatrix());
    shaderProgram()->setUniformMatrix4fv("view", camera->transformationMatrix());
    shaderProgram()->setUniformMatrix4fv("model", transformationMatrix());

    bindTextures();

    shaderProgram()->use();

    if (isWireframeMode())
    {
//          wireframe mode
        glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
    }

    glBindVertexArray ( m_vaoId );

    if (geometry()->isExist("index"))
    {
        GeometryBuffer *indices = geometry()->get("index");
        indices->bind();
        glDrawElements(GL_TRIANGLES, indices->size(), GL_UNSIGNED_INT, 0);

    } else {
        glDrawArrays      ( GL_TRIANGLES, 0, geometry()->get("vertex")->size() );
    }

    glBindVertexArray ( 0 );

    if (isWireframeMode())
    {
//          wireframe mode
        glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
    }

    shaderProgram()->disable();

    unbindTextures();

}
Example #2
0
 int TextureManager::registerResourceManager(ResourceManager* theResourceManager) {
     if (NULL == theResourceManager) {
         // Decrement count by one
         --_myResourceManagerCount;
         if (_myResourceManagerCount == 0) {
             // Remove the Textures from the resourcemanager
             unbindTextures();
             // XXX TODO: Copy vertices back into the Memory resource manager
             // Set the Resourcemanager back to the Memory implementation
             _myResourceManager = _myMemoryResourceManager.get();
         } else if (_myResourceManagerCount < 0) {
             throw TextureManagerException("No Resourcemanager to set to NULL", PLUS_FILE_LINE);
         }
         AC_TRACE << "ResourceManagerCount decremented to " << _myResourceManagerCount;
     } else {
         if (_myResourceManager != theResourceManager) {
             // XXX TODO: Copy vertices from _myResourceManager into theResourceManager
             _myResourceManager = theResourceManager;
         }
         ++_myResourceManagerCount;
         AC_TRACE << "ResourceManagerCount incremented to " << _myResourceManagerCount;
     }
     return _myResourceManagerCount;
 }
Example #3
0
void unbindTextures(const ImageOutport& outport) {
    unbindTextures(*outport.getData(), true, true, true);
}
Example #4
0
void unbindTextures(const ImageInport& inport) {
    unbindTextures(*inport.getData(), true, true, true);
}
Example #5
0
void unbindTextures(const Image& image) { unbindTextures(image, true, true, true); }
Example #6
0
void unbindPickingTexture(const ImageOutport& outport) {
    unbindTextures(*outport.getData(), false, false, true);
}
Example #7
0
void unbindPickingTexture(const ImageInport& inport) {
    unbindTextures(*inport.getData(), false, false, true);
}
Example #8
0
void unbindDepthTexture(const ImageOutport& outport) {
    unbindTextures(*outport.getData(), false, true, false);
}
Example #9
0
void unbindDepthTexture(const ImageInport& inport) {
    unbindTextures(*inport.getData(), false, true, false);
}