Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8538451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:07:20+00:00 2026-06-11T11:07:20+00:00

I am new to using OpenGL with Qt Creator and I have been playing

  • 0

I am new to using OpenGL with Qt Creator and I have been playing around with the information I got from various tutorials. However, I never was able to find out where the OpenGL function definitions actually are!

I was thinking that when I linked the opengl module to the qmake file like this:

QT += core gui opengl

the OpenGL stuff was included, but then I thought again when I was reading about the QGLWidget.

So where does the OpenGL API become included into my code?

P.S. My OS is Windows 7 and I my graphics card is AMD Radeon HD 6250 Graphics.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:07:22+00:00Added an answer on June 11, 2026 at 11:07 am

    The QT variable is used to include Qt modules into your project. By adding opengl you’re adding the Qt OpenGL module which contains Qt code that uses OpenGL (and links to it). If by “include” you mean link, than the OpenGL module of Qt (libQtOpenGL.so) links the various OpenGL libraries. Also, the Qt module includes the headers of the Qt OpenGL module which in turn includes OpenGL headers.

    The OpenGL headers and the OpenGL libraries are wherever your OS keeps those. Your project knows where those are because of the Qt mkspecs for your platform, whatever it is. In the mkspecs, include paths and link paths are already included.

    For instance, now I’m on a Mac OS X, and Qt mkspecs are installed in /usr/local/Qt4.8/mkspecs. Here I have all the platform descriptions, under common you can find mac.conf, which is a part of the description of my platform. Inside it you can see:

    QMAKE_INCDIR_OPENGL = /System/Library/Frameworks/OpenGL.framework/Headers \
        /System/Library/Frameworks/AGL.framework/Headers/
    

    This information is used when Qt Creator (qmake) is asked to produce a Makefile for any application. This way your application knows where to find the headers for OpenGL. Your project will automatically add that to the include paths only when you add the opengl module.

    As another example, this is part of the definition for the Linux platform:

    ...
    QMAKE_INCDIR          =
    QMAKE_LIBDIR          =
    QMAKE_INCDIR_X11      = /usr/X11R6/include
    QMAKE_LIBDIR_X11      = /usr/X11R6/lib
    QMAKE_INCDIR_QT       = $$[QT_INSTALL_HEADERS]
    QMAKE_LIBDIR_QT       = $$[QT_INSTALL_LIBS]
    QMAKE_INCDIR_OPENGL   = /usr/X11R6/include
    QMAKE_LIBDIR_OPENGL   = /usr/X11R6/lib
    QMAKE_INCDIR_OPENGL_ES1 = $$QMAKE_INCDIR_OPENGL
    QMAKE_LIBDIR_OPENGL_ES1 = $$QMAKE_LIBDIR_OPENGL
    QMAKE_INCDIR_OPENGL_ES2 = $$QMAKE_INCDIR_OPENGL
    QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_OPENGL
    QMAKE_INCDIR_EGL      = 
    QMAKE_LIBDIR_EGL      =
    QMAKE_INCDIR_OPENVG   = 
    QMAKE_LIBDIR_OPENVG   =
    ...
    

    I suppose you can understand on your own what this means 😉

    So to answer your question: the include paths and the link paths to the OpenGL libraries are included into the Makefile qmake produces for your application taking the information stored in the mkspec file which is located somewhere in your system. The actual OpenGL headers and libraries are located in a default location in your system, and this has nothing to do with Qt itself. You might need to include the headers in your source code if you use OpenGL libraries directly (or you might not need, it depends), but the include paths should already be provided by your mkspec files.

    EDIT: Look what happens automatically when adding the opengl module: this is the command line Qt Creator uses to compile a C++ file without the opengl module (on Mac):

    g++ -c -pipe -g -gdwarf-2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.8/mkspecs/macx-g++ -I../TextEdit -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/usr/include -I. -I. -I../TextEdit -I. -F/Library/Frameworks -o main.o ../TextEdit/main.cpp
    

    now this is what happens after adding it:

    g++ -c -pipe -g -gdwarf-2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.8/mkspecs/macx-g++ -I../TextEdit -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtOpenGL.framework/Versions/4/Headers -I/usr/include/QtOpenGL -I/usr/include -I/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/System/Library/Frameworks/AGL.framework/Headers -I. -I. -I../TextEdit -I. -F/Library/Frameworks -o main.o ../TextEdit/main.cpp
    

    Your project has been told where to look for the OpenGL headers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using OpenGL 3.0 and one of the things that has me
I am new to the opengl so i am using guide of the android
Very new to using Raphael.js I'm looking at the tutorials and I am able
I have some (OpenCV) code that generates images. I'm displaying these using OpenGL. When
For the last two years I have been using Java and NetBeans, where all
i'm quite new on using opengl, i wonder if there is any way to
I'm currently developing a game for Android using OpenGL ES 2.0. I have almost
using opengl 3.3, radeon 3870HD, c++.. I got question about interleaved arrays of data.
I'm currently using OpenGL ES 2.0 under GLKView on the new iPad. It seems,
I am using OpenGl in android and they have a callback method called draw

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.