zoukankan      html  css  js  c++  java
  • Qt编译OpenGL程序遇到的问题

    软件版本号:
    Qt 4.8.5
    依照网上的例程(http://www.qiliang.net/old/nehe_qt/lesson01.html),跑了一下基于Qt Creator的OpenGL。因为上述例程的Qt版本号较老(例程是02年的,汗。),在新的Qt环境下产生诸多问题,好在一一得到了解决,现说明例如以下:

    1、须要在project文件.pro中加入对OpenGL的支持:
    QT += opengl(记得清理项目后再编译!)
    否则会出现一大堆类似error: undefined reference to `glShadeModel@4'、error: undefined reference to `glClearColor@16'的问题。


    2、对于设置窗体Title的函数setCaption:
    [error: 'setCaption' was not declared in this scope]
    在新版本号中已经废弃。改而用setWindowTitle()函数取代:
    setCaption("Qt Open-GL");——>setWindowTitle("Qt Open-GL");

    3、对于glu开头的函数,如gluPerspective():
    [error: 'gluPerspective' was not declared in this scope]
    须要包括头文件
    #include <GL/glu.h> 

    4、用到QKeyEvent,须要包括其头文件
    [error: invalid use of incomplete type 'struct QKeyEvent']
    #include <QKeyEvent>
  • 相关阅读:
    Ext Form
    Ext中 get、getDom、getCmp的区别
    Ext.state.Manager.setProvider(new Ext.state.CookieProvider())
    Ext BoxComponent
    Ext表单提示方式:msgTarget
    Ext.QuickTips.init()的使用
    Ext.Ajax.Request
    FitLayout
    视图Ext.Viewport和窗口Ext.Window用法
    禁用IE缓存
  • 原文地址:https://www.cnblogs.com/zhchoutai/p/7020093.html
Copyright © 2011-2022 走看看