Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
fa3e4683
Commit
fa3e4683
authored
Oct 13, 2015
by
Nate Weibley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use QOpenGLFunctions to resolve direct OpenGL calls
parent
4c1701bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
CameraView.cc
src/ui/CameraView.cc
+19
-6
No files found.
src/ui/CameraView.cc
View file @
fa3e4683
...
...
@@ -31,6 +31,7 @@ This file is part of the QGROUNDCONTROL project
#include "CameraView.h"
#include <QDebug>
#include <QtOpenGL>
#include <QOpenGLFunctions_2_0>
CameraView
::
CameraView
(
int
width
,
int
height
,
int
depth
,
int
channels
,
QWidget
*
parent
)
:
QGLWidget
(
parent
)
{
...
...
@@ -237,14 +238,26 @@ void CameraView::setPixels(int imgid, const unsigned char* imageData, int length
void
CameraView
::
paintGL
()
{
glDrawPixels
(
glImage
.
width
(),
glImage
.
height
(),
GL_RGBA
,
GL_UNSIGNED_BYTE
,
glImage
.
bits
());
Q_ASSERT
(
QOpenGLContext
::
currentContext
());
QOpenGLFunctions_2_0
*
funcs
=
QOpenGLContext
::
currentContext
()
->
versionFunctions
<
QOpenGLFunctions_2_0
>
();
if
(
!
funcs
)
{
qWarning
()
<<
"OpenGL 2.0 not available on this platform. CameraView will not function"
;
return
;
}
funcs
->
glDrawPixels
(
glImage
.
width
(),
glImage
.
height
(),
GL_RGBA
,
GL_UNSIGNED_BYTE
,
glImage
.
bits
());
}
void
CameraView
::
resizeGL
(
int
w
,
int
h
)
{
glViewport
(
0
,
0
,
w
,
h
);
glMatrixMode
(
GL_PROJECTION
);
glLoadIdentity
();
glOrtho
(
0
,
w
,
0
,
h
,
-
1
,
1
);
glMatrixMode
(
GL_MODELVIEW
);
Q_ASSERT
(
QOpenGLContext
::
currentContext
());
QOpenGLFunctions_2_0
*
funcs
=
QOpenGLContext
::
currentContext
()
->
versionFunctions
<
QOpenGLFunctions_2_0
>
();
if
(
!
funcs
)
{
// paintGL warning should suffice
return
;
}
funcs
->
glViewport
(
0
,
0
,
w
,
h
);
funcs
->
glMatrixMode
(
GL_PROJECTION
);
funcs
->
glLoadIdentity
();
funcs
->
glOrtho
(
0
,
w
,
0
,
h
,
-
1
,
1
);
funcs
->
glMatrixMode
(
GL_MODELVIEW
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment