1 / 20

Introduction to C & C++

Introduction to C & C++. Lecture 13 – libQGLViewer JJCAO. libQGLViewer. C ++ library based on Qt eases the creation of OpenGL 3D viewers with some of the typical 3D viewer functionalities: move the camera using the mouse object selection

marvela
Télécharger la présentation

Introduction to C & C++

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to C & C++ Lecture 13 – libQGLViewer JJCAO

  2. libQGLViewer • C++ library • based on Qt • eases the creation of OpenGL 3D viewers with some of the typical 3D viewer functionalities: • move the camera using the mouse • object selection • camera paths control using F1..F12 (demo with simpleViewer) • screenshot saving • …

  3. Without libQGLViewer void MyGLWindow::draw(){ if (!valid())//for window creat and resize initGL(); // clears the color buffer and depth buffer using the current clearing color glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); view_all();// setup camera (only once) //begin of drawing glPushMatrix();//to avoid cumulate effect //setup viewpoint from current arcball arcball_.glDraw(); // draw … … glPopMatrix(); //end of drawing }

  4. Demos • CGAL-3.8\demo\Triangulation_3

  5. simpleViewer D:\libQGLViewer-2.3.10\examples\simpleViewer

  6. manipulatedFrame D:\libQGLViewer-2.3.10\examples\manipulatedFrame

  7. manipulatedFrame setManipulatedFrame(new ManipulatedFrame()) glMultMatrixd(manipulatedFrame()->matrix()); setAxisIsDrawn() drawAxis() D:\libQGLViewer-2.3.10\examples\manipulatedFrame

  8. Select /pick D:\libQGLViewer-2.3.10\examples\select

  9. Select /pick D:\libQGLViewer-2.3.10\examples\select

  10. Select /pick virtual void drawWithNames(); virtual void postSelection(constQPoint& point); glPushName(i); camera()->convertClickToLine(point, orig, dir); selectedPoint = camera()->pointUnderPixel(point, found); selectedName(); D:\libQGLViewer-2.3.10\examples\select

  11. keyboardAndMouse D:\libQGLViewer-2.3.10\examples\keyboardAndMouse

  12. keyboardAndMouse No effect! Why? D:\libQGLViewer-2.3.10\examples\keyboardAndMouse

  13. keyboardAndMouse D:\libQGLViewer-2.3.10\examples\keyboardAndMouse

  14. keyboardAndMouse D:\libQGLViewer-2.3.10\examples\keyboardAndMouse

  15. keyboardAndMouse • setShortcut()changestandard action bindings (axis, grid or fps display, exit...). • setMouseBinding() and setWheelBinding()changestandard action mouse bindings (camera rotation, translation, object selection...). • If you want to define new keyboard shortcuts, overloadkeyPressEvent() and bind your own new actions. Use setKeyDescription() to add your shortcuts in the help window. • To define new mouse actions, overload mouse(Press|Move|Release)Event. OverloadsetMouseBindingDescription() to update the help window binding tab. D:\libQGLViewer-2.3.10\examples\keyboardAndMouse

  16. Animation D:\libQGLViewer-2.3.10\examples\animation

  17. Animation D:\libQGLViewer-2.3.10\examples\animation

  18. Animation • When animation is activated(the Returnkey toggles animation), the animate() and then the draw() functions are called in an infinite loop. • You can tune the frequency of your animation (default is 25Hz) using setAnimationInterval(). The frame rate will then be fixed, provided that your animation loop function is fast enough. D:\libQGLViewer-2.3.10\examples\animation

  19. Interface Practice in the Designer D:\libQGLViewer-2.3.10\examples\interface

  20. More examples

More Related