]>
Commit | Line | Data |
---|---|---|
6fa02541 JH |
1 | /* |
2 | * This file is part of the sigrok project. | |
3 | * | |
4 | * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk> | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation; either version 2 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * This program 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 this program; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
19 | */ | |
20 | ||
21 | #include "sigview.h" | |
22 | ||
009e1503 JH |
23 | #include "sigsession.h" |
24 | ||
25 | SigView::SigView(SigSession &session, QWidget *parent) : | |
26 | QGLWidget(parent), | |
27 | _session(session) | |
6fa02541 | 28 | { |
009e1503 JH |
29 | connect(&_session, SIGNAL(dataUpdated()), |
30 | this, SLOT(dataUpdated())); | |
31 | ||
d7002724 JH |
32 | setMouseTracking(true); |
33 | } | |
34 | ||
35 | void SigView::initializeGL() | |
36 | { | |
37 | glDisable(GL_TEXTURE_2D); | |
38 | glDisable(GL_DEPTH_TEST); | |
39 | glDisable(GL_COLOR_MATERIAL); | |
40 | glEnable(GL_BLEND); | |
41 | glEnable(GL_POLYGON_SMOOTH); | |
42 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | |
43 | glClearColor(1.0, 1.0, 1.0, 0); | |
44 | } | |
45 | ||
46 | void SigView::resizeGL(int width, int height) | |
47 | { | |
48 | glViewport(0, 0, (GLint)width, (GLint)height); | |
49 | glMatrixMode(GL_PROJECTION); | |
50 | glLoadIdentity(); | |
51 | glOrtho(0, width, height, 0, -1, 1); | |
52 | glMatrixMode(GL_MODELVIEW); | |
53 | } | |
54 | ||
55 | void SigView::paintGL() | |
56 | { | |
57 | glClear(GL_COLOR_BUFFER_BIT); | |
6fa02541 | 58 | } |
009e1503 JH |
59 | |
60 | void SigView::dataUpdated() | |
61 | { | |
62 | printf("Data Updated\n"); | |
63 | } | |
64 |