
Then i pass the click to the engine, now i am getting wrong results of about 2 to 12 pixels deppending on the position of the horizontal and virtical scroll bar of the back portion, then what i do is to hide the cursor and ask the engine to draw it when the cursor passes through it. If (mx>=rendering_x & my>=rendering_y & mxGetWidth() įmy = (float(my)-rendering_y)+uv1_y*Umb::Graphics::GetDisplay()->GetHeight() Įvent->SetCoord(mx,my) /// transform click relative to black portion UmbPointerMoveEvent * event = dynamic_cast(update_frame->event) If (update_frame->event->GetType() = UmbEventType::POINTER_MOVE) Uv2.x = ImGui::GetContentRegionAvail().x / engine_screen->w +uv1.x ĮngineInbox.SetViewPortion(uv1.x,uv1.y,uv2.x,uv2.y) Uv1.y = abs(ImGui::GetWindowContentRegionMin().y)/engine_screen->h

Uv1.x = abs(ImGui::GetWindowContentRegionMin().x)/engine_screen->w ImVec2 uv1,uv2 /// top left and button down range ( 0. / tell the engine the current view potion ImGui::Image((ImTextureID)GPU_GetImageHandle(engine_screen->image),ImVec2(engine_screen->w,engine_screen->h)) ImVec2 w_pos = ImGui::GetCursorPos() ,c_pos = ImGui::GetWindowPos() ĮngineInbox.SetRenderingPosition(w_pos.x+c_pos.x,w_pos.y+c_pos.y) / tell the engine the current draw position ImVec2 win_region = ImGui::GetContentRegionAvail() ĮngineInbox.SetRenderingWindowSize(win_region.x,win_region.y) / move the draw cursor to the top left corner of the window / tell the inbox if it should receive inputĮngineInbox.SetInputOn(ImGui::GetWindowIsFocused()) Slow Chat: Visual C++: Yesterday, Today, and Tomorrow.Slow Chat: Developing Multithreaded Applications.Slow Chat: Talk with Microsoft Developer Teams.IoT, IoE, and Maker Forum (on VBForums).Project Planning, Design, and Management.Scripting - Server Side (PHP, Perl, etc.).
#Opengl getting mouse coordinates windows#
Windows Presentation Foundation (WPF) & XAML forum.NET Installation and Configuration Issues Quick Navigation Visual C++ Programming Top

Again, sorry if this is a terribly newbie question, I really would like to be able to show a mouse cursor, but not if it keeps flickering! Thanks. I'd really appreciate if any of the gurus could give me a little guidance on this one. If so, what value should I pass to gluUnProject() for the z-coordinate on the screen? Since the cursor is floating above the window, wouldn't its z-coordinate be 0? Is this even a remotely do-able approach?Ģ. When I run the debugger, the values I get in object coordinates are very very small floating point numbers, which cannot be correct. I was trying to think of a way to get around this, and I came up with this idea: why not disable the mouse cursor's visibility, then catch the WM_MOUSEMOVE message and call a DrawCursor() function, then render the rest of the scene at the same time? In my DrawCursor function, I've used the gluUnProject() method to try to convert the screen coordinates into object coordinates, then draw a simple polygon at that position, but I can't get it to work right. I'm not having any major problems except this one: when the mouse pointer passes over the window, the cursor repeatedly flickers, since the OpenGL scene is rendered, then the cursor is drawn. I'm in the process of writing my first OpenGL application, so please excuse my possibly bad code/ideas. I know this isn't a forum geared toward OpenGL, but I've had excellent results posting here in the past and thought I'd try again
