i'm using OpenGL 4.1 (and SFML on Windowing), and recently i begin using the UBO but i've some issues, i do this
static constexpr auto ACCESS_MODE = BitfieldAccessMode::MAP_WRITE_BIT | BitfieldAccessMode::MAP_INVALIDATE_RANGE_BIT;
const auto &projection_matrix = m_cache.matrices[MatrixType::Projection];
const auto &view_matrix = m_cache.matrices[MatrixType::View];
m_cache.transform_uniform_buffer->bind();
TransformBlock *ptr = reinterpret_cast<TransformBlock*>(m_cache.transform_uniform_buffer->mapRange(ACCESS_MODE, 0, sizeof(TransformBlock)));
ptr->projection = projection_matrix.matrix;
ptr->view = view_matrix.matrix;
ptr = nullptr;
m_cache.transform_uniform_buffer->unmap();
m_cache.transform_uniform_buffer->unbind();
but i got 1 fps, this
auto tp = Clock::now();
m_window.display();
auto tp2 = Clock::now();
storm::DLOG("t: %f", std::chrono::duration_cast<std::chrono::milliseconds>(tp2 - tp).count());
[Debug] t: 568
[Debug] t: 1033
[Debug] t: 1006
[Debug] t: 684
Sorry for my english, i've recently started to learn it.
Aucun commentaire:
Enregistrer un commentaire