Search the Community
Showing results for tags 'screen'.
-
Hi, I need the 2D screen Position of a 3D Node transformation. Can you write me a short code example with unigine matrices form the Player and Node and perspective division to get the NDC coordinates? auto proj = m_player->getProjection(); auto view = m_player->getTransform(); auto obj = instance->second->getNode()->getTransform(); auto projectedPosition = Unigine::Math::Mat4(proj)*view*obj*Unigine::Math::Vec4(0.0, 0.0, 0.0, 1.0); projectedPosition /= glm::abs(projectedPosition.w); x = (projectedPosition.x+1.0f)*0.5f * m_ungineAppHandle->getWidth(); y = (1.f-(projectedPosition.z+1.0f)*0.5f) * m_ungineAppHandle->getHeight(); Thank you in advance, Sebastian
-
[SOLVED] Custom App cannot recover in full screen after losing focus
mohamed.irshad.k posted a topic in C++ Programming
We are using Direct3D9 in our Unigine::App. While in full screen, if the app loses focus, it cannot recover. I tried the IDirect3DDevice9::Reset() but it fails saying that all the resources need to be released before reseting the device. What is the best way to handle this situation? -
hi, I want to know if it's possible to have the screen position of an widget. I try getPosition but if i don't set before the position i 0x0 I try with the parent of parent of parent position but doesn't work two. An example : WidgetHBox hbox; WidgetVBox vbox; WidgetSprite sprite; WidgetButton button; WidgetButton button2; /* */ int init() { Gui gui = engine.getGui(); hbox = new WidgetHBox(gui); vbox = new WidgetVBox(gui); sprite = new WidgetSprite(gui,""); sprite.setWidth(200); sprite.setHeight(200); button = new WidgetButton(gui,"B1"); button2 = new WidgetButton(gui,"B2"); gui.addChild(hbox,GUI_ALIGN_CENTER); hbox.addChild(sprite,GUI_ALIGN_BACKGROUND); hbox.addChild(vbox,GUI_ALIGN_OVERLAP); vbox.addChild(button,GUI_ALIGN_OVERLAP|GUI_ALIGN_LEFT); vbox.addChild(button2,GUI_ALIGN_OVERLAP|GUI_ALIGN_RIGHT); return 1; } /* */ int shutdown() { log.message("SHUTDOWN\n"); return 1; } /* */ int update() { counter++; if (counter == 1){ hbox.arrange(); log.message("hbox : %d x %d\n",hbox.getPositionX(),hbox.getPositionY()); log.message("sprite : %d x %d\n",sprite.getPositionX(),sprite.getPositionY()); log.message("vbox : %d x %d\n",vbox.getPositionX(),vbox.getPositionY()); log.message("Button : %d x %d\n",button.getPositionX(),button.getPositionY()); log.message("Button2 : %d x %d\n",button2.getPositionX(),button2.getPositionY()); } return 1; } if someone have an idea.