Ktam3874/pitx software guide – Kontron KTAM3874-pITX User Manual

Page 196

Advertising
background image

KTD-S0057-I

Page 192 Linux® Programming Examples (DebianTM)


KTAM3874/pITX Software Guide


void resizeGL (int width, int height);

void mousePressEvent (QMouseEvent *event);

void mouseMoveEvent (QMouseEvent *event);

private slots:

void advanceGears ();

private:

GLuint makeGear (const GLfloat *reflectance, GLdouble innerRadius, GLdouble outerRadius, GLdouble thickness,

GLdouble toothSize, GLint toothCount);

void drawGear (GLuint gear, GLdouble dx, GLdouble dy, GLdouble dz, GLdouble angle);

void normalizeAngle (int *angle);

GLuint

gear1;

GLuint

gear2;

GLuint

gear3;

int

xRot;

int

yRot;

int

zRot;

int

gear1Rot;

QPoint

lastPos;

};

#endif


File glwidget.cpp (header with Qt

TM

license see 'main.cpp'):

#include <QtGui/QtGui>

#include <QtOpenGL/QtOpenGL>

#include <math.h>
#include "glwidget.h"

#include "moc_glwidget.cpp"


GLWidget::GLWidget (QWidget *parent)

: QGLWidget (parent)

{

gear1 = 0;

gear2 = 0;

gear3 = 0;

xRot = 0;

yRot = 0;

zRot = 0;

gear1Rot = 0;

QTimer *timer = new QTimer (this);

connect (timer, SIGNAL (timeout ()), this, SLOT (advanceGears ()));

timer->start

(20);

}

Advertising
This manual is related to the following products: