Qt OpenGL 3D graphics

Source: Internet
Author: User

 

Introduction

OpenGL is a standard API for rendering 3D graphics.

OpenGL only deals with 3D rendering and provides little or no support for GUI programming issues. the user interface for an OpenGL * application must be created with another toolkit, such as motif on the X platform, microsoft foundation classes (MFC) under windows, or QT onBothPlatforms.

The QT OpenGL module makes it easy to use OpenGL in QT applications. it provides an OpenGL widget class that can be used just like any other QT widget, doesn't that it opens an OpenGL display buffer where you can use the OpenGL API to render the contents.

The QT OpenGL module is implemented as a platform-independent QT/C ++ wrapper around the platform-dependent Glx, WGL, or agl c APIs. the functionality provided is very similar to mark kilgard's glut library, but with much more non-OpenGL-specific GUI functionality, I. e. the whole qt api.

 

Installation

When you install QT for X11, the configure script will autodetect if OpenGL headers and libraries are installed on your system, and if so, it will include the QT OpenGL module in the QT library. (If your OpenGL headers or libraries are placed in a non-standard directory, you may need to change the qmake_incdir_opengl and/or qmake_libdir_opengl In the config file for your system ). some deployments require threading to be enabled for OpenGL, So If OpenGL is not detected, tryConfigure-Thread.

When you install QT for windows, the QT OpenGL module is always encoded.

The QT OpenGL module is not licensed for use with the QT Professional Edition. Consider upgrading to the QT Enterprise Edition if you require OpenGL support.

Note about using MESA on X11: MESA versions earlier than 3.1 wocould use the name "mesagl" and "mesaglu" for the libraries, instead of "Gl" and "Glu ". if you want to use a pre-3.1 version of Mesa, you must change the makefiles to use these library names instead. the easiest way to do this is to edit the qmake_libs_opengl line in the config file you are using, changing "-lgl-lglu" to "-lmesagl-lmesaglu "; then run "Configure" again.

 

The qgl classes

The OpenGL support classes in QT are:

  • Qglwidget: An easy-to-use QT widget for rendering OpenGL scenes.
  • Qglcontext: encapsulates an OpenGL rendering context.
  • Qglformat: Specifies the display format of a rendering context.
  • Qglcolormap: handles indexed colormaps In Gl-index mode.

Applications only need the High-Level qglwidget class. The other qgl classes provide advanced features. X11 users might like to read the notes on overlays.

See also the OpenGL examples.

The qgl documentation assumes that you are familiar with OpenGL programming. If you're new to the subject a good starting point is http://www.opengl.org /.

* OpenGL is a trademark of Silicon Graphics, Inc. In the United States and other countries.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.