Skip to content

Commit

Permalink
properly fix casting for pick pos
Browse files Browse the repository at this point in the history
  • Loading branch information
Astral-C committed Sep 3, 2024
1 parent 8954186 commit d63a55f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/UStarForgeContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,14 +398,14 @@ void UStarForgeContext::Render(float deltaTime) {
ImVec2 mousePos = ImGui::GetMousePos();

ImVec2 pickPos = {
static_cast<uint32_t>(mousePos.x) - static_cast<uint32_t>(cursorPos.x),
static_cast<uint32_t>(winSize.y) - (static_cast<uint32_t>(mousePos.y) - static_cast<uint32_t>(cursorPos.y))
mousePos.x - cursorPos.x,
winSize.y - (mousePos.y - cursorPos.y)
};

glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadBuffer(GL_COLOR_ATTACHMENT1);
uint32_t id = 0xFFFFFFFF;
glReadPixels((uint32_t)pickPos.x, (uint32_t)pickPos.y, 1, 1, GL_RED_INTEGER, GL_INT, (void*)&id);
glReadPixels(static_cast<GLint>(pickPos.x), static_cast<GLint>(pickPos.y), 1, 1, GL_RED_INTEGER, GL_INT, (void*)&id);

if(id != 0){

Expand Down

0 comments on commit d63a55f

Please sign in to comment.