Giter VIP home page Giter VIP logo

Comments (8)

CedricGuillemet avatar CedricGuillemet commented on July 16, 2024 5

I'm working on it :)

from imguizmo.

PicosePablo avatar PicosePablo commented on July 16, 2024

Yes, and can u make better comments? There are functions without any help (ex: SetRect). Im not sure about how to use this....

from imguizmo.

w1th0utnam3 avatar w1th0utnam3 commented on July 16, 2024

I would really appreciate a small example that works on its own. I currently cannot get ImGuizmo to draw anything and I'm not sure whether it is because of the view/projection matrices or because I call the functions in the wrong order.
At the moment I call

ImGuizmo::BeginFrame();
ImGuizmo::Enable(true);

ImGuiIO& io = ImGui::GetIO();
ImGuizmo::SetRect(0, 0, io.DisplaySize.x, io.DisplaySize.y);

glm::fmat4 view = m_camera->modelViewMatrix();
glm::fmat4 projection = m_camera->projectionMatrix();

ImGuizmo::DrawCube(&view[0][0], &projection[0][0], &matrix[0][0]);
ImGuizmo::Manipulate(&view[0][0], &projection[0][0], ImGuizmo::ROTATE, ImGuizmo::WORLD, &matrix[0][0]);

right after ImGuiGlfw3NewFrame() in the render loop but nothing is drawn. The matrix variable is initialized to the identity matrix and I tried to supply my real view and projection matrices as well as identity matrices. Standard ImGui windows are drawn correctly btw. Do you have any advice?

from imguizmo.

CedricGuillemet avatar CedricGuillemet commented on July 16, 2024

from imguizmo.

w1th0utnam3 avatar w1th0utnam3 commented on July 16, 2024

Thanks for the reply, I use the following code to compute the matrices:

void Camera::updateModelViewMatrix()
{
	m_modelView = glm::scale(glm::dmat4(), m_scaling);
	m_modelView = glm::rotate(m_modelView, glm::angle(m_rotation), glm::axis(m_rotation));
}

void Camera::updateProjectionMatrix()
{	
	const double diag = std::hypot(m_viewportSize.x, m_viewportSize.y);
	m_projection = glm::ortho<double>(-0.5*m_viewportSize.x*m_zoom, 0.5*m_viewportSize.x*m_zoom, -0.5*m_viewportSize.y*m_zoom, 0.5*m_viewportSize.y*m_zoom, -diag, diag);
}

from imguizmo.

edselmalasig avatar edselmalasig commented on July 16, 2024

please add a main.cpp

from imguizmo.

edselmalasig avatar edselmalasig commented on July 16, 2024

added mine with object picker http://www.github.com/edselmalasig/ImGuizmo_pick_and_choose

from imguizmo.

w1th0utnam3 avatar w1th0utnam3 commented on July 16, 2024

@CedricGuillemet, I found the problem why nothing was drawn: In my call

ImGuizmo::Manipulate(&view[0][0], &projection[0][0], ImGuizmo::ROTATE, ImGuizmo::WORLD, &matrix[0][0]);

I forgot to initialize matrix to anything meaningful (e.g. identity matrix). facepalm

from imguizmo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.