direcs
2012-09-30
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
QtGLContext.h
Go to the documentation of this file.
1
/*************************************************************************
2
* Copyright (C) Markus Knapp *
3
* www.direcs.de *
4
* *
5
* This file is part of direcs. *
6
* *
7
* direcs is free software: you can redistribute it and/or modify it *
8
* under the terms of the GNU General Public License as published *
9
* by the Free Software Foundation, version 3 of the License. *
10
* *
11
* direcs is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU General Public License for more details. *
15
* *
16
* You should have received a copy of the GNU General Public License *
17
* along with direcs. If not, see <http://www.gnu.org/licenses/>. *
18
* *
19
*************************************************************************/
20
21
#ifndef GLCONTEXT_H_
22
#define GLCONTEXT_H_
23
24
#include <QtOpenGL>
25
#include <QString>
26
#include <QtGui/QMouseEvent>
27
33
class
QtGLContext
:
public
QGLWidget
34
{
35
Q_OBJECT
36
37
38
public
:
40
QtGLContext
(QWidget* parent = 0,
const
QGLWidget* sharedWidget = 0, Qt::WFlags f = 0 );
41
QtGLContext
(
const
QGLFormat &format, QWidget* parent = 0,
const
QGLWidget* sharedWidget = 0, Qt::WFlags f = 0 );
42
~QtGLContext
();
43
45
//bool setImage(unsigned char* imgP, const int width, const int height, const int pixeldepth, const bool flipped = false);
46
bool
setImage
(
unsigned
char
* imgP,
const
bool
flipped =
false
);
47
49
void
setImageData
(
const
int
width,
const
int
height,
const
int
pixeldepth);
50
52
void
setZoomRect
(
float
ulX,
float
ulY,
float
lrX,
float
lrY);
53
54
//void resetBox() { m_exit.setX(0); m_exit.setY(0); m_entry.setX(0); m_entry.setY(0);}
55
60
void
enableMirrorMode
(
int
state);
61
62
63
signals:
64
void
boxCreated
(
int
x,
int
y,
int
x2,
int
y2);
65
void
saveImage
();
66
67
68
protected
:
69
// standard qt methods
70
virtual
void
paintGL
();
71
virtual
void
resizeGL
(
int
w,
int
h);
72
virtual
void
initializeGL
();
73
74
/*
75
virtual void mousePressEvent(QMouseEvent* event);
76
virtual void mouseMoveEvent(QMouseEvent* event);
77
virtual void mouseReleaseEvent(QMouseEvent* event);
78
*/
86
void
drawTexture
(
float
ul,
float
ur,
float
ll,
float
lr);
88
unsigned
int
NextLargerPowerOfTwo
(
unsigned
int
n);
89
90
91
private
:
93
unsigned
char
*
m_imgP
;
95
unsigned
int
m_width
,
m_height
,
m_pixeldepth
;
97
bool
m_flipped
;
99
bool
m_mirrored
;
101
unsigned
int
m_texWidth
;
103
unsigned
int
m_texHeight
;
105
unsigned
int
m_texNameGL
;
107
float
m_texUpperLeftX
,
m_texUpperLeftY
,
m_texLowerRightX
,
m_texLowerRightY
;
108
// box parameters (for mouse dragging)
109
QPoint
m_entry
,
m_exit
;
110
bool
m_mousePressed
;
111
// "the image" (texture)
112
unsigned
char
*
textureGL
;
113
114
};
115
116
#endif
direcs
src
QtGLContext.h
Generated on Sat Feb 2 2013 21:41:02 for direcs by
1.8.1.1