#ifndef GLSCREEN_H
#define GLSCREEN_H
#include <QMainWindow>
#include <QGLWidget>
Q_OBJECT
public:
VJOutput();
protected:
void initializeGL();
void paintGL();
void resizeGL(int w, int h);
public slots:
void Herteken();
};
#endif // GLSCREEN_H
#ifndef GLSCREEN_H
#define GLSCREEN_H
#include <QMainWindow>
#include <QGLWidget>
class VJOutput : public QGLWidget{
Q_OBJECT
public:
VJOutput();
protected:
void initializeGL();
void paintGL();
void resizeGL(int w, int h);
public slots:
void Herteken();
};
#endif // GLSCREEN_H
To copy to clipboard, switch view to plain text mode
#include "glscreen.h"
#include "ui_glscreen.h"
#include <iostream>
#include <QTimer>
#include <math.h>
void VJOutput::initializeGL(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glLoadIdentity(); // Reset The View
}
VJOutput::VJOutput(){
initializeGL();
connect(RedrawTimer,SIGNAL(timeout()),this,SLOT(Herteken()));
RedrawTimer->start(20);
}
void VJOutput::resizeGL(int w, int h){
}
void VJOutput::paintGL(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(-1.5f,0.0f,-6.0f);
glBegin(GL_TRIANGLES);
glVertex3f( 0.0f, 1.0f, 0.0f);
glVertex3f(-1.0f,-1.0f, 0.0f);
glVertex3f( 1.0f,-1.0f, 0.0f);
glEnd();
glTranslatef(3.0f,0.0f,0.0f);
glBegin(GL_QUADS);
glVertex3f(-1.0f, 1.0f, 0.0f);
glVertex3f( 1.0f, 1.0f, 0.0f);
glVertex3f( 1.0f,-1.0f, 0.0f);
glVertex3f(-1.0f,-1.0f, 0.0f);
glEnd();
}
void VJOutput::Herteken(){
updateGL();
}
#include "glscreen.h"
#include "ui_glscreen.h"
#include <iostream>
#include <QTimer>
#include <math.h>
void VJOutput::initializeGL(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glLoadIdentity(); // Reset The View
}
VJOutput::VJOutput(){
initializeGL();
QTimer *RedrawTimer = new QTimer(this);
connect(RedrawTimer,SIGNAL(timeout()),this,SLOT(Herteken()));
RedrawTimer->start(20);
}
void VJOutput::resizeGL(int w, int h){
}
void VJOutput::paintGL(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(-1.5f,0.0f,-6.0f);
glBegin(GL_TRIANGLES);
glVertex3f( 0.0f, 1.0f, 0.0f);
glVertex3f(-1.0f,-1.0f, 0.0f);
glVertex3f( 1.0f,-1.0f, 0.0f);
glEnd();
glTranslatef(3.0f,0.0f,0.0f);
glBegin(GL_QUADS);
glVertex3f(-1.0f, 1.0f, 0.0f);
glVertex3f( 1.0f, 1.0f, 0.0f);
glVertex3f( 1.0f,-1.0f, 0.0f);
glVertex3f(-1.0f,-1.0f, 0.0f);
glEnd();
}
void VJOutput::Herteken(){
updateGL();
}
To copy to clipboard, switch view to plain text mode
my VJ.pro file has:
# -------------------------------------------------
# Project created by QtCreator 2010-01-15T13:07:06
# -------------------------------------------------
QT += network \
opengl \
sql \
xml \
xmlpatterns \
phonon \
dbus
CONFIG += thread
TARGET = VJ
TEMPLATE = app
SOURCES += main.cpp \
mainwindow.cpp \
lib/Rhythm.cpp \
lib/MidiDevices.cpp \
lib/RtMidi.cpp \
visualLib/glscreen.cpp
HEADERS += mainwindow.h \
lib/Rhythm.h \
lib/MidiDevices.h \
lib/RtMidi.h \
lib/RtError.h \
visualLib/glscreen.h
LIBS += -L/alsa/ \
-lasound \
-lpthread
FORMS += mainwindow.ui
# -------------------------------------------------
# Project created by QtCreator 2010-01-15T13:07:06
# -------------------------------------------------
QT += network \
opengl \
sql \
xml \
xmlpatterns \
phonon \
dbus
CONFIG += thread
TARGET = VJ
TEMPLATE = app
SOURCES += main.cpp \
mainwindow.cpp \
lib/Rhythm.cpp \
lib/MidiDevices.cpp \
lib/RtMidi.cpp \
visualLib/glscreen.cpp
HEADERS += mainwindow.h \
lib/Rhythm.h \
lib/MidiDevices.h \
lib/RtMidi.h \
lib/RtError.h \
visualLib/glscreen.h
LIBS += -L/alsa/ \
-lasound \
-lpthread
FORMS += mainwindow.ui
To copy to clipboard, switch view to plain text mode
Bookmarks