lundi 27 juin 2016

qt + opengl gluLookAt issue

i'm writing simple 2d game and i have to do some stuff in qt. Game runs good , it was written in vs 2015 , now i moved it into qt creator.

There is opengl widget to display graphic. I've added things in .pro file and i can use opengl function except gluLookAt(used in timer function cscenaqt) , i get error :

    cscenaqt.obj:-1: błąd: LNK2019: unresolved external symbol gluLookAt referenced in function "protected: virtual void __cdecl cScenaQt::timerEvent(class QTimerEvent *)" (?timerEvent@cScenaQt@@MEAAXPEAVQTimerEvent@@@Z)

Here is opengl widget file

#ifndef CSCENAQT_H
#define CSCENAQT_H

#include <QWidget>
#include <QGLWidget>

class cScenaQt : public QGLWidget
{
    Q_OBJECT        // must include this if you use Qt signals/slots

public:
    cScenaQt(QWidget *parent);

protected:

    void initializeGL();

    void resizeGL(int w, int h);

    void paintGL();
    void mouseMoveEvent(QMouseEvent * event);
    void keyPressEvent(QKeyEvent* e);

    void timerEvent(QTimerEvent *event);
private:
    float m_x,m_y;
    int m_timer_id;
};

#endif // CSCENAQT_H

Here is .pro file

#-------------------------------------------------
#
# Project created by QtCreator 2016-05-25T04:49:19
#
#-------------------------------------------------

QT       += core gui opengl

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = openglqt
TEMPLATE = app


SOURCES += main.cpp
        mainwindow.cpp 
    cscenaqt.cpp 
    bielan_przeszkoda_1.cpp 
    boss.cpp 
    czlowiek.cpp 
    figura.cpp 
    figury.cpp 
    fizyka.cpp 
    funckje.cpp 
    gnom.cpp 
    gracz.cpp 
    pawlak_slupki.cpp 
    pawlak_wieze.cpp 
    pawlak_winda.cpp 
    przeszkoda.cpp 
    wrobel_dzialo.cpp 
    wrobel_gate.cpp 
    wrobel_kolec.cpp 
    wrobel_most.cpp 
    wrobel_przepasc.cpp 
    wrobel_przeszkoda_1.cpp

HEADERS  += mainwindow.h 
    cscenaqt.h 
    bielan_przeszkoda_1.h 
    boss.h 
    czlowiek.h 
    figura.h 
    figury.h 
    fizyka.h 
    funckje.h 
    gnom.h 
    gracz.h 
    pawlak_slupki.h 
    pawlak_wieze.h 
    pawlak_winda.h 
    przeszkoda.h 
    wrobel_dzialo.h 
    wrobel_gate.h 
    wrobel_kolec.h 
    wrobel_most.h 
    wrobel_przepasc.h 
    wrobel_przeszkoda_1.h

FORMS    += mainwindow.ui
LIBS += opengl32.lib

How can i fix this issue and is there some way to allow user to use more than one key in qt(i know it was possible in opengl with glkeyupfun and keydown , smth like this)?

Aucun commentaire:

Enregistrer un commentaire