Closed cursedastronaut closed 5 months ago
This is not a OpenGL question per-se. I think you need to render to texture? https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples#rendering-your-game-scene-into-a-texture Try using RenderDoc to debug your rendering steps.
glUseProgram(shaderProgram);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, tabs[current_tab].textureID);
glUniform1i(glGetUniformLocation(shaderProgram, "inputTexture"), textureID);
This is not having any effect, there are no draw calls.
ImGui::Image()
doesn't DIRECTLY generate a draw call, it emits commands that will be turned into draw calls by ImGui_ImplOpenGL3_RenderDrawData()
.
You need to be following a tutorial to render to texture with OpenGL, e.g. this one http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-14-render-to-texture/
Version/Branch of Dear ImGui:
Version 1.90.0, Branch: master (master/docking/etc.)
Back-ends:
imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler, OS:
Linux + GCC
Full config/build information:
Details:
My Issue/Question:
I have a texture I draw every frame and generate once in a while (at every modification) using glGenTextures. Since it lags a lot, I tried to edit the texture directly on the GPU, using a shader. I'm pretty new to using shaders, and I never used one with ImGui. I wonder if I applied the shaders correctly considering the way ImGui draws?
Drawing code:
generateOnce is now NEVER SET to true as I wanted to try editing the texture using shaders.
(the shaders are supposed to turn the whole image black, just to test) Here is the shader code:
To test, I have a white image, and it never changes despite the shaders being called. What have I done wrong ? Also, initShaders in called in VisualIDK s constructor.
Screenshots/Video:
(It always stays white)
Minimal, Complete and Verifiable Example code:
Whole code is accessible here.
EDIT: Using AddCallback applies the shader but to the whole screen (which I don't want). Maybe I did not understand how to use it...?