I have a 960x540 window I'm creating using OpenGL. Rendering one texture here and using imgui to implement a slider that let's me translate the x, y, and z positions at runtime.
int window_width = 960;
int window_height = 540;
window = glfwCreateWindow(window_width, window_height, "Object Oriented OpenGL", NULL, NULL);
First I set the slider default values.
glm::vec3 model_matrix_translation(200, 200, 0);
Later in my loop that renders the objects positions frame by frame as long as the window is open, I set the ImGui::SliderFloat3
v_min
and v_max
params to be the dimensions of my window. It appears all 3 sliders x,y, and z use these values, but is there a way to set a range for each individuals slider? As you can see my slider for the y axis can go beyond 540.
while (!glfwWindowShouldClose(window))
{
// renderer and other code before this point
{
ImGui::SliderFloat3("Model Matrix Translation", &model_matrix_translation.x, 0.0f, 960.0f);
}
ImGui::Render();
ImGui_ImplGlfwGL3_RenderDrawData(ImGui::GetDrawData());
glfwSwapBuffers(window);
glfwPollEvents();
}