Git Product home page Git Product logo

qtopenglviewer's Introduction

QtOpenGLViewer

Yet another simple 3D/2D OpenGL viewer with mouse rotation, pan, zoom and some object selection.

This is meant for when all you need is a simple OpenGL 3D or 2D viewer with generic mouse interaction and/or object selection or manipulaiton, and you don't really want to waste the time to roll your own for something so stupidly simple. If you need something fancy, you'll probably have to roll your own code, but using this code as a starting point might help.

Author: Marcel Goldschen-Ohm
Email: [email protected]
License: MIT
Copyright (c) 2018 Marcel Goldschen-Ohm

Overview

  1. Make your own custom viewer class that derives from QtOpenGLViewer. This will give you a widget with a 3D or 2D OpenGL scene (see is3D() and setIs3D(bool)) with mouse rotation (3D only), pan and zoom out of the box.
  2. Override drawScene() and make it do something interesting beyond just drawing axes.
  3. [OPTIONAL] Override drawHud(QPainter &painter) if you want a 2D overlay (default just prints mouse controls).
  4. [OPTIONAL] Override selectObject(const QPoint &mousePosition) if you want mouse left-click selection of scene objects.
  5. [OPTIONAL] Override any of the mouse, keyboard, or other input functions such as mouseMoveEvent(...) if you want to to handle those actions (i.e. drag objects with the mouse or something).

See the example in test/ for some simple drawing and object selection/dragging using functions that come with QtOpenGLViewer.

INSTALL

Everything is in:

  • QtOpenGLViewer.h
  • QtOpenGLViewer.cpp

CMake:

See CMakeLists.txt for example build as a static library.

๐Ÿ‘‰ This is most likely what you want: See test/CMakeLists.txt for example build of an app that uses QtOpenGLViewer. This build uses CMake to automatically download QtOpenGLViewer files directly from this GitHub repository, builds QtOpenGLViewer as a static library and links it to the app executable. This way you can use QtOpenGLViewer in your project without downloading or managing the QtOpenGLViewer repository manually.

Requires:

qtopenglviewer's People

Contributors

marcel-goldschen-ohm avatar

Watchers

 avatar  avatar

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.