portfolio/color-space/GLwindow.h
2026-08-29 23:20:33 +02:00

71 lines
1.5 KiB
C++

/* Copyright (C) 2012 Karl Phillip Buhr <karlphillip@gmail.com>
*
* This work is licensed under the Creative Commons Attribution-ShareAlike License.
* To view a copy of this license, visit:
* https://creativecommons.org/licenses/by-sa/2.5/legalcode
*
* Or to read the human-readable summary of the license:
* https://creativecommons.org/licenses/by-sa/2.5/
*
*
* Ingress logo with glowing effect, based on Nehe lesson 36.
*/
#pragma once
#include <QGLWidget>
class GLwindow : public QGLWidget
{
Q_OBJECT
public:
explicit GLwindow(QWidget* parent = 0);
virtual ~GLwindow();
/* OpenGL initialization, viewport resizing, and painting */
void initializeGL();
void paintGL();
void resizeGL( int width, int height);
void keyPressEvent(QKeyEvent *event);
void wheelEvent(QWheelEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
/* Helper functions */
void setXRotation(int angle);
void setYRotation(int angle);
void setZRotation(int angle);
void _view_ortho();
void _view_perspective();
void _draw();
/*Project fonction */
void _draw_cube();
void _draw_rgb();
void _draw_hsv();
void _draw_Point(QRgb pixel);
void _setImg(QImage* Img);
private:
int _width;
int _height;
QPoint last_pos;
double x,y,z, distance;
double x_rot,y_rot,z_rot;
QImage* _image;
protected slots:
void _tick();
};