mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 23:00:04 +00:00
Use GLEW instead of QOpenGLFunctions
This commit is contained in:
parent
4bd749d976
commit
331b2d855f
33 changed files with 788 additions and 959 deletions
|
|
@ -300,8 +300,6 @@ void AlertLayer::Initialize(const std::shared_ptr<MapContext>& mapContext)
|
|||
void AlertLayer::Render(const std::shared_ptr<MapContext>& mapContext,
|
||||
const QMapLibre::CustomLayerRenderParameters& params)
|
||||
{
|
||||
gl::OpenGLFunctions& gl = gl_context()->gl();
|
||||
|
||||
for (auto alertActive : {false, true})
|
||||
{
|
||||
p->geoLines_.at(alertActive)->set_selected_time(p->selectedTime_);
|
||||
|
|
|
|||
|
|
@ -55,38 +55,36 @@ void ColorTableLayer::Initialize(const std::shared_ptr<MapContext>& mapContext)
|
|||
|
||||
auto glContext = gl_context();
|
||||
|
||||
gl::OpenGLFunctions& gl = glContext->gl();
|
||||
|
||||
// Load and configure overlay shader
|
||||
p->shaderProgram_ =
|
||||
glContext->GetShaderProgram(":/gl/texture1d.vert", ":/gl/texture1d.frag");
|
||||
|
||||
p->uMVPMatrixLocation_ =
|
||||
gl.glGetUniformLocation(p->shaderProgram_->id(), "uMVPMatrix");
|
||||
glGetUniformLocation(p->shaderProgram_->id(), "uMVPMatrix");
|
||||
if (p->uMVPMatrixLocation_ == -1)
|
||||
{
|
||||
logger_->warn("Could not find uMVPMatrix");
|
||||
}
|
||||
|
||||
gl.glGenTextures(1, &p->texture_);
|
||||
glGenTextures(1, &p->texture_);
|
||||
|
||||
p->shaderProgram_->Use();
|
||||
|
||||
// Generate a vertex array object
|
||||
gl.glGenVertexArrays(1, &p->vao_);
|
||||
glGenVertexArrays(1, &p->vao_);
|
||||
|
||||
// Generate vertex buffer objects
|
||||
gl.glGenBuffers(2, p->vbo_.data());
|
||||
glGenBuffers(2, p->vbo_.data());
|
||||
|
||||
gl.glBindVertexArray(p->vao_);
|
||||
glBindVertexArray(p->vao_);
|
||||
|
||||
// Bottom panel
|
||||
gl.glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
||||
gl.glBufferData(
|
||||
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
||||
glBufferData(
|
||||
GL_ARRAY_BUFFER, sizeof(float) * 6 * 2, nullptr, GL_DYNAMIC_DRAW);
|
||||
|
||||
gl.glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, static_cast<void*>(0));
|
||||
gl.glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, static_cast<void*>(0));
|
||||
glEnableVertexAttribArray(0);
|
||||
|
||||
// Color table panel texture coordinates
|
||||
const float textureCoords[6][1] = {{0.0f}, // TL
|
||||
|
|
@ -96,12 +94,12 @@ void ColorTableLayer::Initialize(const std::shared_ptr<MapContext>& mapContext)
|
|||
{0.0f}, // BL
|
||||
{1.0f}, // TR
|
||||
{1.0f}}; // BR
|
||||
gl.glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[1]);
|
||||
gl.glBufferData(
|
||||
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[1]);
|
||||
glBufferData(
|
||||
GL_ARRAY_BUFFER, sizeof(textureCoords), textureCoords, GL_STATIC_DRAW);
|
||||
|
||||
gl.glVertexAttribPointer(1, 1, GL_FLOAT, GL_FALSE, 0, static_cast<void*>(0));
|
||||
gl.glEnableVertexAttribArray(1);
|
||||
glVertexAttribPointer(1, 1, GL_FLOAT, GL_FALSE, 0, static_cast<void*>(0));
|
||||
glEnableVertexAttribArray(1);
|
||||
|
||||
connect(mapContext->radar_product_view().get(),
|
||||
&view::RadarProductView::ColorTableLutUpdated,
|
||||
|
|
@ -113,8 +111,7 @@ void ColorTableLayer::Render(
|
|||
const std::shared_ptr<MapContext>& mapContext,
|
||||
const QMapLibre::CustomLayerRenderParameters& params)
|
||||
{
|
||||
gl::OpenGLFunctions& gl = gl_context()->gl();
|
||||
auto radarProductView = mapContext->radar_product_view();
|
||||
auto radarProductView = mapContext->radar_product_view();
|
||||
|
||||
if (radarProductView == nullptr || !radarProductView->IsInitialized())
|
||||
{
|
||||
|
|
@ -130,28 +127,28 @@ void ColorTableLayer::Render(
|
|||
p->shaderProgram_->Use();
|
||||
|
||||
// Set OpenGL blend mode for transparency
|
||||
gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
gl.glUniformMatrix4fv(
|
||||
glUniformMatrix4fv(
|
||||
p->uMVPMatrixLocation_, 1, GL_FALSE, glm::value_ptr(projection));
|
||||
|
||||
if (p->colorTableNeedsUpdate_)
|
||||
{
|
||||
p->colorTable_ = radarProductView->color_table_lut();
|
||||
|
||||
gl.glActiveTexture(GL_TEXTURE0);
|
||||
gl.glBindTexture(GL_TEXTURE_1D, p->texture_);
|
||||
gl.glTexImage1D(GL_TEXTURE_1D,
|
||||
0,
|
||||
GL_RGBA,
|
||||
(GLsizei) p->colorTable_.size(),
|
||||
0,
|
||||
GL_RGBA,
|
||||
GL_UNSIGNED_BYTE,
|
||||
p->colorTable_.data());
|
||||
gl.glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
gl.glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
gl.glGenerateMipmap(GL_TEXTURE_1D);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_1D, p->texture_);
|
||||
glTexImage1D(GL_TEXTURE_1D,
|
||||
0,
|
||||
GL_RGBA,
|
||||
(GLsizei) p->colorTable_.size(),
|
||||
0,
|
||||
GL_RGBA,
|
||||
GL_UNSIGNED_BYTE,
|
||||
p->colorTable_.data());
|
||||
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glGenerateMipmap(GL_TEXTURE_1D);
|
||||
}
|
||||
|
||||
if (p->colorTable_.size() > 0 && radarProductView->sweep_time() !=
|
||||
|
|
@ -171,10 +168,10 @@ void ColorTableLayer::Render(
|
|||
{vertexRX, vertexBY}}; // BR
|
||||
|
||||
// Draw vertices
|
||||
gl.glBindVertexArray(p->vao_);
|
||||
gl.glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
||||
gl.glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices);
|
||||
gl.glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
glBindVertexArray(p->vao_);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
|
||||
static constexpr int kLeftMargin_ = 0;
|
||||
static constexpr int kTopMargin_ = 0;
|
||||
|
|
@ -196,11 +193,9 @@ void ColorTableLayer::Deinitialize()
|
|||
{
|
||||
logger_->debug("Deinitialize()");
|
||||
|
||||
gl::OpenGLFunctions& gl = gl_context()->gl();
|
||||
|
||||
gl.glDeleteVertexArrays(1, &p->vao_);
|
||||
gl.glDeleteBuffers(2, p->vbo_.data());
|
||||
gl.glDeleteTextures(1, &p->texture_);
|
||||
glDeleteVertexArrays(1, &p->vao_);
|
||||
glDeleteBuffers(2, p->vbo_.data());
|
||||
glDeleteTextures(1, &p->texture_);
|
||||
|
||||
p->uMVPMatrixLocation_ = GL_INVALID_INDEX;
|
||||
p->vao_ = GL_INVALID_INDEX;
|
||||
|
|
|
|||
|
|
@ -127,8 +127,7 @@ void DrawLayer::RenderWithoutImGui(
|
|||
{
|
||||
auto& glContext = p->glContext_;
|
||||
|
||||
gl::OpenGLFunctions& gl = glContext->gl();
|
||||
p->textureAtlas_ = glContext->GetTextureAtlas();
|
||||
p->textureAtlas_ = glContext->GetTextureAtlas();
|
||||
|
||||
// Determine if the texture atlas changed since last render
|
||||
const std::uint64_t newTextureAtlasBuildCount =
|
||||
|
|
@ -137,10 +136,10 @@ void DrawLayer::RenderWithoutImGui(
|
|||
newTextureAtlasBuildCount != p->textureAtlasBuildCount_;
|
||||
|
||||
// Set OpenGL blend mode for transparency
|
||||
gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
gl.glActiveTexture(GL_TEXTURE0);
|
||||
gl.glBindTexture(GL_TEXTURE_2D_ARRAY, p->textureAtlas_);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, p->textureAtlas_);
|
||||
|
||||
for (auto& item : p->drawList_)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <scwx/common/geographic.hpp>
|
||||
#include <scwx/common/products.hpp>
|
||||
#include <scwx/qt/config/radar_site.hpp>
|
||||
#include <scwx/qt/gl/gl.hpp>
|
||||
#include <scwx/qt/types/map_types.hpp>
|
||||
#include <scwx/qt/types/radar_product_record.hpp>
|
||||
#include <scwx/qt/types/text_event_key.hpp>
|
||||
|
|
|
|||
|
|
@ -165,8 +165,6 @@ void MarkerLayer::Impl::set_icon_sheets()
|
|||
void MarkerLayer::Render(const std::shared_ptr<MapContext>& mapContext,
|
||||
const QMapLibre::CustomLayerRenderParameters& params)
|
||||
{
|
||||
gl::OpenGLFunctions& gl = gl_context()->gl();
|
||||
|
||||
DrawLayer::Render(mapContext, params);
|
||||
|
||||
SCWX_GL_CHECK_ERROR();
|
||||
|
|
|
|||
|
|
@ -338,10 +338,9 @@ void OverlayLayer::Render(const std::shared_ptr<MapContext>& mapContext,
|
|||
{
|
||||
const std::unique_lock lock {p->renderMutex_};
|
||||
|
||||
gl::OpenGLFunctions& gl = gl_context()->gl();
|
||||
auto radarProductView = mapContext->radar_product_view();
|
||||
auto& settings = mapContext->settings();
|
||||
const float pixelRatio = mapContext->pixel_ratio();
|
||||
auto radarProductView = mapContext->radar_product_view();
|
||||
auto& settings = mapContext->settings();
|
||||
const float pixelRatio = mapContext->pixel_ratio();
|
||||
|
||||
ImGuiFrameStart(mapContext);
|
||||
|
||||
|
|
|
|||
|
|
@ -142,8 +142,6 @@ void OverlayProductLayer::Render(
|
|||
const std::shared_ptr<MapContext>& mapContext,
|
||||
const QMapLibre::CustomLayerRenderParameters& params)
|
||||
{
|
||||
gl::OpenGLFunctions& gl = gl_context()->gl();
|
||||
|
||||
if (p->stiNeedsUpdate_)
|
||||
{
|
||||
p->UpdateStormTrackingInformation(mapContext);
|
||||
|
|
|
|||
|
|
@ -132,8 +132,6 @@ void PlacefileLayer::Render(
|
|||
const std::shared_ptr<MapContext>& mapContext,
|
||||
const QMapLibre::CustomLayerRenderParameters& params)
|
||||
{
|
||||
gl::OpenGLFunctions& gl = gl_context()->gl();
|
||||
|
||||
std::shared_ptr<manager::PlacefileManager> placefileManager =
|
||||
manager::PlacefileManager::Instance();
|
||||
|
||||
|
|
|
|||
|
|
@ -78,42 +78,40 @@ void RadarProductLayer::Initialize(
|
|||
|
||||
auto glContext = gl_context();
|
||||
|
||||
gl::OpenGLFunctions& gl = glContext->gl();
|
||||
|
||||
// Load and configure radar shader
|
||||
p->shaderProgram_ =
|
||||
glContext->GetShaderProgram(":/gl/radar.vert", ":/gl/radar.frag");
|
||||
|
||||
p->uMVPMatrixLocation_ =
|
||||
gl.glGetUniformLocation(p->shaderProgram_->id(), "uMVPMatrix");
|
||||
glGetUniformLocation(p->shaderProgram_->id(), "uMVPMatrix");
|
||||
if (p->uMVPMatrixLocation_ == -1)
|
||||
{
|
||||
logger_->warn("Could not find uMVPMatrix");
|
||||
}
|
||||
|
||||
p->uMapScreenCoordLocation_ =
|
||||
gl.glGetUniformLocation(p->shaderProgram_->id(), "uMapScreenCoord");
|
||||
glGetUniformLocation(p->shaderProgram_->id(), "uMapScreenCoord");
|
||||
if (p->uMapScreenCoordLocation_ == -1)
|
||||
{
|
||||
logger_->warn("Could not find uMapScreenCoord");
|
||||
}
|
||||
|
||||
p->uDataMomentOffsetLocation_ =
|
||||
gl.glGetUniformLocation(p->shaderProgram_->id(), "uDataMomentOffset");
|
||||
glGetUniformLocation(p->shaderProgram_->id(), "uDataMomentOffset");
|
||||
if (p->uDataMomentOffsetLocation_ == -1)
|
||||
{
|
||||
logger_->warn("Could not find uDataMomentOffset");
|
||||
}
|
||||
|
||||
p->uDataMomentScaleLocation_ =
|
||||
gl.glGetUniformLocation(p->shaderProgram_->id(), "uDataMomentScale");
|
||||
glGetUniformLocation(p->shaderProgram_->id(), "uDataMomentScale");
|
||||
if (p->uDataMomentScaleLocation_ == -1)
|
||||
{
|
||||
logger_->warn("Could not find uDataMomentScale");
|
||||
}
|
||||
|
||||
p->uCFPEnabledLocation_ =
|
||||
gl.glGetUniformLocation(p->shaderProgram_->id(), "uCFPEnabled");
|
||||
glGetUniformLocation(p->shaderProgram_->id(), "uCFPEnabled");
|
||||
if (p->uCFPEnabledLocation_ == -1)
|
||||
{
|
||||
logger_->warn("Could not find uCFPEnabled");
|
||||
|
|
@ -122,22 +120,22 @@ void RadarProductLayer::Initialize(
|
|||
p->shaderProgram_->Use();
|
||||
|
||||
// Generate a vertex array object
|
||||
gl.glGenVertexArrays(1, &p->vao_);
|
||||
glGenVertexArrays(1, &p->vao_);
|
||||
|
||||
// Generate vertex buffer objects
|
||||
gl.glGenBuffers(3, p->vbo_.data());
|
||||
glGenBuffers(3, p->vbo_.data());
|
||||
|
||||
// Update radar sweep
|
||||
p->sweepNeedsUpdate_ = true;
|
||||
UpdateSweep(mapContext);
|
||||
|
||||
// Create color table
|
||||
gl.glGenTextures(1, &p->texture_);
|
||||
glGenTextures(1, &p->texture_);
|
||||
p->colorTableNeedsUpdate_ = true;
|
||||
UpdateColorTable(mapContext);
|
||||
gl.glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
gl.glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
gl.glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
|
||||
auto radarProductView = mapContext->radar_product_view();
|
||||
connect(radarProductView.get(),
|
||||
|
|
@ -153,8 +151,6 @@ void RadarProductLayer::Initialize(
|
|||
void RadarProductLayer::UpdateSweep(
|
||||
const std::shared_ptr<MapContext>& mapContext)
|
||||
{
|
||||
gl::OpenGLFunctions& gl = gl_context()->gl();
|
||||
|
||||
boost::timer::cpu_timer timer;
|
||||
|
||||
std::shared_ptr<view::RadarProductView> radarProductView =
|
||||
|
|
@ -174,20 +170,20 @@ void RadarProductLayer::UpdateSweep(
|
|||
const std::vector<float>& vertices = radarProductView->vertices();
|
||||
|
||||
// Bind a vertex array object
|
||||
gl.glBindVertexArray(p->vao_);
|
||||
glBindVertexArray(p->vao_);
|
||||
|
||||
// Buffer vertices
|
||||
gl.glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
||||
timer.start();
|
||||
gl.glBufferData(GL_ARRAY_BUFFER,
|
||||
vertices.size() * sizeof(GLfloat),
|
||||
vertices.data(),
|
||||
GL_STATIC_DRAW);
|
||||
glBufferData(GL_ARRAY_BUFFER,
|
||||
vertices.size() * sizeof(GLfloat),
|
||||
vertices.data(),
|
||||
GL_STATIC_DRAW);
|
||||
timer.stop();
|
||||
logger_->debug("Vertices buffered in {}", timer.format(6, "%ws"));
|
||||
|
||||
gl.glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, static_cast<void*>(0));
|
||||
gl.glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, static_cast<void*>(0));
|
||||
glEnableVertexAttribArray(0);
|
||||
|
||||
// Buffer data moments
|
||||
const GLvoid* data;
|
||||
|
|
@ -206,14 +202,14 @@ void RadarProductLayer::UpdateSweep(
|
|||
type = GL_UNSIGNED_SHORT;
|
||||
}
|
||||
|
||||
gl.glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[1]);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[1]);
|
||||
timer.start();
|
||||
gl.glBufferData(GL_ARRAY_BUFFER, dataSize, data, GL_STATIC_DRAW);
|
||||
glBufferData(GL_ARRAY_BUFFER, dataSize, data, GL_STATIC_DRAW);
|
||||
timer.stop();
|
||||
logger_->debug("Data moments buffered in {}", timer.format(6, "%ws"));
|
||||
|
||||
gl.glVertexAttribIPointer(1, 1, type, 0, static_cast<void*>(0));
|
||||
gl.glEnableVertexAttribArray(1);
|
||||
glVertexAttribIPointer(1, 1, type, 0, static_cast<void*>(0));
|
||||
glEnableVertexAttribArray(1);
|
||||
|
||||
// Buffer CFP data
|
||||
const GLvoid* cfpData;
|
||||
|
|
@ -235,18 +231,18 @@ void RadarProductLayer::UpdateSweep(
|
|||
cfpType = GL_UNSIGNED_SHORT;
|
||||
}
|
||||
|
||||
gl.glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[2]);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[2]);
|
||||
timer.start();
|
||||
gl.glBufferData(GL_ARRAY_BUFFER, cfpDataSize, cfpData, GL_STATIC_DRAW);
|
||||
glBufferData(GL_ARRAY_BUFFER, cfpDataSize, cfpData, GL_STATIC_DRAW);
|
||||
timer.stop();
|
||||
logger_->debug("CFP moments buffered in {}", timer.format(6, "%ws"));
|
||||
|
||||
gl.glVertexAttribIPointer(2, 1, cfpType, 0, static_cast<void*>(0));
|
||||
gl.glEnableVertexAttribArray(2);
|
||||
glVertexAttribIPointer(2, 1, cfpType, 0, static_cast<void*>(0));
|
||||
glEnableVertexAttribArray(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
gl.glDisableVertexAttribArray(2);
|
||||
glDisableVertexAttribArray(2);
|
||||
}
|
||||
|
||||
p->numVertices_ = vertices.size() / 2;
|
||||
|
|
@ -256,18 +252,17 @@ void RadarProductLayer::Render(
|
|||
const std::shared_ptr<MapContext>& mapContext,
|
||||
const QMapLibre::CustomLayerRenderParameters& params)
|
||||
{
|
||||
gl::OpenGLFunctions& gl = gl_context()->gl();
|
||||
|
||||
p->shaderProgram_->Use();
|
||||
|
||||
// Set OpenGL blend mode for transparency
|
||||
gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
const bool wireframeEnabled = mapContext->settings().radarWireframeEnabled_;
|
||||
if (wireframeEnabled)
|
||||
{
|
||||
// Set polygon mode to draw wireframe
|
||||
gl.glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
}
|
||||
|
||||
if (p->colorTableNeedsUpdate_)
|
||||
|
|
@ -291,28 +286,28 @@ void RadarProductLayer::Render(
|
|||
glm::radians<float>(params.bearing),
|
||||
glm::vec3(0.0f, 0.0f, 1.0f));
|
||||
|
||||
gl.glUniform2fv(p->uMapScreenCoordLocation_,
|
||||
1,
|
||||
glm::value_ptr(util::maplibre::LatLongToScreenCoordinate(
|
||||
{params.latitude, params.longitude})));
|
||||
glUniform2fv(p->uMapScreenCoordLocation_,
|
||||
1,
|
||||
glm::value_ptr(util::maplibre::LatLongToScreenCoordinate(
|
||||
{params.latitude, params.longitude})));
|
||||
|
||||
gl.glUniformMatrix4fv(
|
||||
glUniformMatrix4fv(
|
||||
p->uMVPMatrixLocation_, 1, GL_FALSE, glm::value_ptr(uMVPMatrix));
|
||||
|
||||
gl.glUniform1i(p->uCFPEnabledLocation_, p->cfpEnabled_ ? 1 : 0);
|
||||
glUniform1i(p->uCFPEnabledLocation_, p->cfpEnabled_ ? 1 : 0);
|
||||
|
||||
gl.glUniform1ui(p->uDataMomentOffsetLocation_, p->rangeMin_);
|
||||
gl.glUniform1f(p->uDataMomentScaleLocation_, p->scale_);
|
||||
glUniform1ui(p->uDataMomentOffsetLocation_, p->rangeMin_);
|
||||
glUniform1f(p->uDataMomentScaleLocation_, p->scale_);
|
||||
|
||||
gl.glActiveTexture(GL_TEXTURE0);
|
||||
gl.glBindTexture(GL_TEXTURE_1D, p->texture_);
|
||||
gl.glBindVertexArray(p->vao_);
|
||||
gl.glDrawArrays(GL_TRIANGLES, 0, p->numVertices_);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_1D, p->texture_);
|
||||
glBindVertexArray(p->vao_);
|
||||
glDrawArrays(GL_TRIANGLES, 0, p->numVertices_);
|
||||
|
||||
if (wireframeEnabled)
|
||||
{
|
||||
// Restore polygon mode to default
|
||||
gl.glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
}
|
||||
|
||||
SCWX_GL_CHECK_ERROR();
|
||||
|
|
@ -322,10 +317,8 @@ void RadarProductLayer::Deinitialize()
|
|||
{
|
||||
logger_->debug("Deinitialize()");
|
||||
|
||||
gl::OpenGLFunctions& gl = gl_context()->gl();
|
||||
|
||||
gl.glDeleteVertexArrays(1, &p->vao_);
|
||||
gl.glDeleteBuffers(3, p->vbo_.data());
|
||||
glDeleteVertexArrays(1, &p->vao_);
|
||||
glDeleteBuffers(3, p->vbo_.data());
|
||||
|
||||
p->uMVPMatrixLocation_ = GL_INVALID_INDEX;
|
||||
p->uMapScreenCoordLocation_ = GL_INVALID_INDEX;
|
||||
|
|
@ -536,7 +529,6 @@ void RadarProductLayer::UpdateColorTable(
|
|||
|
||||
p->colorTableNeedsUpdate_ = false;
|
||||
|
||||
gl::OpenGLFunctions& gl = gl_context()->gl();
|
||||
std::shared_ptr<view::RadarProductView> radarProductView =
|
||||
mapContext->radar_product_view();
|
||||
|
||||
|
|
@ -547,17 +539,17 @@ void RadarProductLayer::UpdateColorTable(
|
|||
|
||||
const float scale = rangeMax - rangeMin;
|
||||
|
||||
gl.glActiveTexture(GL_TEXTURE0);
|
||||
gl.glBindTexture(GL_TEXTURE_1D, p->texture_);
|
||||
gl.glTexImage1D(GL_TEXTURE_1D,
|
||||
0,
|
||||
GL_RGBA,
|
||||
(GLsizei) colorTable.size(),
|
||||
0,
|
||||
GL_RGBA,
|
||||
GL_UNSIGNED_BYTE,
|
||||
colorTable.data());
|
||||
gl.glGenerateMipmap(GL_TEXTURE_1D);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_1D, p->texture_);
|
||||
glTexImage1D(GL_TEXTURE_1D,
|
||||
0,
|
||||
GL_RGBA,
|
||||
(GLsizei) colorTable.size(),
|
||||
0,
|
||||
GL_RGBA,
|
||||
GL_UNSIGNED_BYTE,
|
||||
colorTable.data());
|
||||
glGenerateMipmap(GL_TEXTURE_1D);
|
||||
|
||||
p->rangeMin_ = rangeMin;
|
||||
p->scale_ = scale;
|
||||
|
|
|
|||
|
|
@ -107,8 +107,6 @@ void RadarSiteLayer::Render(
|
|||
return;
|
||||
}
|
||||
|
||||
gl::OpenGLFunctions& gl = gl_context()->gl();
|
||||
|
||||
// Update map screen coordinate and scale information
|
||||
p->mapScreenCoordLocation_ = util::maplibre::LatLongToScreenCoordinate(
|
||||
{params.latitude, params.longitude});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue