Comments (11)
I managed to fix the issue, it was an issue with how I setup my rotation Matrix and how it was applying to the model matrix. It ended up exploding everything. Thanks for helping me, even though it wasn't an issue with your codebase :)
from imgui.
This is most likely an issue on your end. You should use a graphics debugger like RenderDoc to investigate.
from imgui.
@PathogenDavid Why does it start working as soon as I disable ImGui::DockSpaceOverViewport();?
from imgui.
Hard to say without debugging your app, which is why I recommended looking at a graphics debugger.
from imgui.
For some reason the vs output changes depending on whether dockspace is active or not. If it is active, gl_position goes to NaN. If it is inactive, the values are correct.
No Dockspace
Dockspace
from imgui.
It seems like my program doesn't allow:
if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
{
GLFWwindow* backup_current_context = glfwGetCurrentContext();
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindowsDefault();
glfwMakeContextCurrent(backup_current_context);
}
and:
if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_DockingEnable)
{
ImGui::DockSpaceOverViewport();
}
to run at the same time for some reason.
from imgui.
It's possibly an issue in your code and you may be not sharing the relevant code.
It's ambiguous what those vertices you posted are (vertices for what?).
Try to confirm if your render-to-texture is valid in both cases.
Use Metrics/Debugger to inspect our draw calls.
from imgui.
My textures are valid, it seems like my vertex positions become invalid. I'm not sure what is causing it to become invalid.
this is my vertex shader if it helps.
from imgui.
it seems like my vertex positions become invalid.
OpenGL uses a bunch of global state, so it is possible that some of the state we alter inside ImGui_ImplOpenGL3_RenderDrawData()
are altering your render because it doesn't explicitly set them up.
from imgui.
My textures are valid, it seems like my vertex positions become invalid. I'm not sure what is causing it to become invalid.
Again, this can means different things and is very ambiguous to read without code. We still don't know how you are rendering the things that breaks.
If you have a texture working, then you can submit your framebuffer using ImGui::Image()
, and then I don't understand what this shader is about because you shouldn't need one. So it seems like you are may doing something else but I cannot guess what it is.
I also don't know if by texture you are referring to the texture used as part of the render toward generating your framebuffer-rendered-to-texture, or if you are talking about your framebuffer-rendered-to-texture. Without code we can only guess.
from imgui.
Through testing a bunch I've found out that my model matrix is getting screwed up for some reason. Also just to give some context, I am using ImGui to display a render texture using ImGui::Image. However the part that is going wrong happens during the rendering of the render texture, and the render texture is rendering a scene that contains a gameObject with a texture that looks like this:
The GameObject's texture is being passed correctly, but the render texture isn't rendering anything.
void K::Transform::PassModelMatrix(K::Transform* parent)
{
K::Matrix4x4 globalModelMatrix = K::Matrix4x4::IdentityMatrix();
if (parent == nullptr)
{
//World space transforms are in control
*this->localScale = *this->scale;
*this->localRotation = *this->rotation;
*this->localPosition = *this->position;
//Scaling Matrix
globalModelMatrix.m[0][0] *= this->scale->x;
globalModelMatrix.m[1][1] *= this->scale->y;
globalModelMatrix.m[2][2] *= this->scale->z;
//Rotation Matrix
globalModelMatrix = K::Matrix4x4::Matrix_MultiplyMatrix(globalModelMatrix, *K::Quaternion::Euler(this->rotation)->QuaternionToMatrix());
//Translation Matrix
globalModelMatrix.m[3][0] += this->position->x;
globalModelMatrix.m[3][1] += this->position->y;
globalModelMatrix.m[3][2] += this->position->z;
}
else
{
if (*this->position != this->previousPosition)
{
*this->localPosition = *this->position;
K::Matrix4x4 invert = K::QuickInverse(parent->modelMatrix);
K::MultiplyMatrixVector(*this->position, *this->localPosition, invert);
}
if (*this->rotation != this->previousRotation)
{
*this->localRotation = *this->rotation - *parent->rotation;
}
if (*this->scale != this->previousScale)
{
*this->localScale = *this->scale / *parent->scale;
}
//Local space transforms are in control
*this->scale = *this->localScale * *parent->scale;
*this->rotation = *this->localRotation + *parent->rotation;
K::MultiplyMatrixVector(*this->localPosition, *this->position, parent->modelMatrix);
//Scaling Matrix
globalModelMatrix.m[0][0] *= this->scale->x;
globalModelMatrix.m[1][1] *= this->scale->y;
globalModelMatrix.m[2][2] *= this->scale->z;
//Rotation Matrix
globalModelMatrix = K::Matrix4x4::Matrix_MultiplyMatrix(globalModelMatrix, *K::Quaternion::Euler(this->rotation)->QuaternionToMatrix());
//Translation Matrix
globalModelMatrix.m[3][0] += this->position->x;
globalModelMatrix.m[3][1] += this->position->y;
globalModelMatrix.m[3][2] += this->position->z;
}
this->modelMatrix = globalModelMatrix;
this->previousPosition = *this->position;
this->previousRotation = *this->rotation;
this->previousScale = *this->scale;
}
This is the code(^) used to construct the model matrix, this->modelMatrix is the final model matrix that gets passed to the shader.
void GameObject::PassTransformationMatrix()
{
if (this->parent == nullptr)
this->GetTransform()->PassModelMatrix();
else
this->GetTransform()->PassModelMatrix(this->parent->GetTransform());
glUniformMatrix4fv(glGetUniformLocation(this->material->GetShader()->shader, "modelMatrix"), 1, GL_FALSE, &this->GetTransform()->modelMatrix.m[0][0]);
}
from imgui.
Related Issues (20)
- imgui_widgets.cpp gives 200+ errors HOT 1
- How can I size a table correctly for a given number of rows when using ImGuiTableFlags_ScrollX? HOT 4
- Image Loading Not Working
- Item-tooltip for group will disappear for a short time if the widget inside is clicked HOT 1
- Multi-viewport: window constrained to main viewport moves if it goes outside of viewport HOT 2
- Add a flag to disable Ctrl+Tab navigation HOT 1
- Renderer backend for the new SDL3 GPU API HOT 6
- Advice on implementing a visual tour for a user interface HOT 5
- Merging icon font doesn't work HOT 7
- Not all expected cells are selected when drag-selecting in an x-scrolling table
- Late availability of monitor information HOT 2
- IMGUI_DISABLE_OBSOLETE_FUNCTIONS does more than hiding obsoleted functions HOT 5
- Translating between backend keycode and ImGuiKey HOT 1
- Lack of separate ImGuiDockNodeFlags_NoDockingSplitMe flag in 1.91 HOT 2
- Question - D3D12 Texture
- Scrollbar behavior change HOT 8
- IsItemDeactivatedAfterEdit and InputTextMultiline HOT 3
- Displaying a slice of a 3D texture HOT 1
- SDL2 backend does not build on UWP HOT 1
- Latest Dawn source code breaks WGPU Backend.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imgui.