OpenHantek
GlScope Class Reference

OpenGL accelerated widget that displays the oscilloscope screen. More...

#include <glscope.h>

Inheritance diagram for GlScope:

Data Structures

struct  Vertices
 

Signals

void markerMoved (unsigned cursorIndex, unsigned marker)
 

Public Member Functions

void showData (std::shared_ptr< PPresult > newData)
 
void updateCursor (unsigned index=0)
 
void cursorSelected (unsigned index)
 

Static Public Member Functions

static GlScopecreateNormal (DsoSettingsScope *scope, DsoSettingsView *view, QWidget *parent=nullptr)
 
static GlScopecreateZoomed (DsoSettingsScope *scope, DsoSettingsView *view, QWidget *parent=nullptr)
 
static void fixOpenGLversion (QSurfaceFormat::RenderableType t=QSurfaceFormat::DefaultRenderableType)
 

Protected Member Functions

 GlScope (DsoSettingsScope *scope, DsoSettingsView *view, QWidget *parent=nullptr)
 Initializes the scope widget. More...
 
 ~GlScope () override
 
 GlScope (const GlScope &)=delete
 
void initializeGL () override
 Initializes OpenGL output. More...
 
void paintGL () override
 Draw the graphs, marker and the grid. More...
 
void resizeGL (int width, int height) override
 Resize the widget. More...
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseMoveEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void paintEvent (QPaintEvent *event) override
 
void drawGrid ()
 Draw the grid. More...
 
void drawMarkers ()
 Draw vertical lines at marker positions. More...
 
void generateVertices (unsigned marker, const DsoSettingsScopeCursor &cursor)
 
void drawVertices (QOpenGLFunctions *gl, unsigned marker, QColor color)
 
void drawVoltageChannelGraph (ChannelID channel, Graph &graph, int historyIndex)
 
void drawHistogramChannelGraph (ChannelID channel, Graph &graph, int historyIndex)
 
void drawSpectrumChannelGraph (ChannelID channel, Graph &graph, int historyIndex)
 
QPointF eventToPosition (QMouseEvent *event)
 

Private Member Functions

void generateGrid (QOpenGLShaderProgram *program)
 
void draw4Cross (std::vector< QVector3D > &va, int section, float x, float y)
 

Private Attributes

DsoSettingsScopescope
 
DsoSettingsViewview
 
bool zoomed = false
 
const unsigned NO_MARKER = UINT_MAX
 
const unsigned VERTICES_ARRAY_SIZE = sizeof(Vertices) / sizeof(QVector3D)
 
std::vector< VerticesvaMarker
 
unsigned selectedMarker = NO_MARKER
 
QOpenGLBuffer m_marker
 
QOpenGLVertexArrayObject m_vaoMarker
 
std::vector< DsoSettingsScopeCursor * > cursorInfo
 
unsigned selectedCursor = 0
 
QOpenGLBuffer m_grid
 
QOpenGLVertexArrayObject m_vaoGrid [3]
 
GLsizei gridDrawCounts [3]
 
std::list< Graphm_GraphHistory
 
unsigned currentGraphInHistory = 0
 
unsigned int GLSLversion = 150
 
bool shaderCompileSuccess = false
 
QString errorMessage
 
std::unique_ptr< QOpenGLShaderProgram > m_program
 
QMatrix4x4 pmvMatrix
 projection, view matrix More...
 
int colorLocation
 
int vertexLocation
 
int matrixLocation
 
int selectionLocation
 

Detailed Description

OpenGL accelerated widget that displays the oscilloscope screen.

Constructor & Destructor Documentation

◆ GlScope() [1/2]

GlScope::GlScope ( DsoSettingsScope scope,
DsoSettingsView view,
QWidget *  parent = nullptr 
)
protected

Initializes the scope widget.

Parameters
settingsThe settings that should be used.
parentThe parent widget.

◆ ~GlScope()

GlScope::~GlScope ( )
overrideprotected

◆ GlScope() [2/2]

GlScope::GlScope ( const GlScope )
protecteddelete

Member Function Documentation

◆ createNormal()

GlScope * GlScope::createNormal ( DsoSettingsScope scope,
DsoSettingsView view,
QWidget *  parent = nullptr 
)
static

◆ createZoomed()

GlScope * GlScope::createZoomed ( DsoSettingsScope scope,
DsoSettingsView view,
QWidget *  parent = nullptr 
)
static

◆ cursorSelected()

void GlScope::cursorSelected ( unsigned  index)
inline

◆ draw4Cross()

void GlScope::draw4Cross ( std::vector< QVector3D > &  va,
int  section,
float  x,
float  y 
)
private

◆ drawGrid()

void GlScope::drawGrid ( )
protected

Draw the grid.

◆ drawHistogramChannelGraph()

void GlScope::drawHistogramChannelGraph ( ChannelID  channel,
Graph graph,
int  historyIndex 
)
protected

◆ drawMarkers()

void GlScope::drawMarkers ( )
protected

Draw vertical lines at marker positions.

◆ drawSpectrumChannelGraph()

void GlScope::drawSpectrumChannelGraph ( ChannelID  channel,
Graph graph,
int  historyIndex 
)
protected

◆ drawVertices()

void GlScope::drawVertices ( QOpenGLFunctions *  gl,
unsigned  marker,
QColor  color 
)
protected

◆ drawVoltageChannelGraph()

void GlScope::drawVoltageChannelGraph ( ChannelID  channel,
Graph graph,
int  historyIndex 
)
protected

◆ eventToPosition()

QPointF GlScope::eventToPosition ( QMouseEvent *  event)
protected

◆ fixOpenGLversion()

void GlScope::fixOpenGLversion ( QSurfaceFormat::RenderableType  t = QSurfaceFormat::DefaultRenderableType)
static

We need at least OpenGL 3.2 with shader version 150 or OpenGL ES 2.0 with shader version 100.

◆ generateGrid()

void GlScope::generateGrid ( QOpenGLShaderProgram *  program)
private

◆ generateVertices()

void GlScope::generateVertices ( unsigned  marker,
const DsoSettingsScopeCursor cursor 
)
protected

◆ initializeGL()

void GlScope::initializeGL ( )
overrideprotected

Initializes OpenGL output.

◆ markerMoved

void GlScope::markerMoved ( unsigned  cursorIndex,
unsigned  marker 
)
signal

◆ mouseMoveEvent()

void GlScope::mouseMoveEvent ( QMouseEvent *  event)
overrideprotected

◆ mousePressEvent()

void GlScope::mousePressEvent ( QMouseEvent *  event)
overrideprotected

◆ mouseReleaseEvent()

void GlScope::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotected

◆ paintEvent()

void GlScope::paintEvent ( QPaintEvent *  event)
overrideprotected

◆ paintGL()

void GlScope::paintGL ( )
overrideprotected

Draw the graphs, marker and the grid.

◆ resizeGL()

void GlScope::resizeGL ( int  width,
int  height 
)
overrideprotected

Resize the widget.

Parameters
widthThe new width of the widget.
heightThe new height of the widget.

◆ showData()

void GlScope::showData ( std::shared_ptr< PPresult newData)

Show new post processed data

Parameters
data

◆ updateCursor()

void GlScope::updateCursor ( unsigned  index = 0)

Field Documentation

◆ colorLocation

int GlScope::colorLocation
private

◆ currentGraphInHistory

unsigned GlScope::currentGraphInHistory = 0
private

◆ cursorInfo

std::vector<DsoSettingsScopeCursor *> GlScope::cursorInfo
private

◆ errorMessage

QString GlScope::errorMessage
private

◆ GLSLversion

unsigned int GlScope::GLSLversion = 150
private

◆ gridDrawCounts

GLsizei GlScope::gridDrawCounts[3]
private

◆ m_GraphHistory

std::list<Graph> GlScope::m_GraphHistory
private

◆ m_grid

QOpenGLBuffer GlScope::m_grid
private

◆ m_marker

QOpenGLBuffer GlScope::m_marker
private

◆ m_program

std::unique_ptr<QOpenGLShaderProgram> GlScope::m_program
private

◆ m_vaoGrid

QOpenGLVertexArrayObject GlScope::m_vaoGrid[3]
private

◆ m_vaoMarker

QOpenGLVertexArrayObject GlScope::m_vaoMarker
private

◆ matrixLocation

int GlScope::matrixLocation
private

◆ NO_MARKER

const unsigned GlScope::NO_MARKER = UINT_MAX
private

◆ pmvMatrix

QMatrix4x4 GlScope::pmvMatrix
private

projection, view matrix

◆ scope

DsoSettingsScope* GlScope::scope
private

◆ selectedCursor

unsigned GlScope::selectedCursor = 0
private

◆ selectedMarker

unsigned GlScope::selectedMarker = NO_MARKER
private

◆ selectionLocation

int GlScope::selectionLocation
private

◆ shaderCompileSuccess

bool GlScope::shaderCompileSuccess = false
private

◆ vaMarker

std::vector<Vertices> GlScope::vaMarker
private

◆ vertexLocation

int GlScope::vertexLocation
private

◆ VERTICES_ARRAY_SIZE

const unsigned GlScope::VERTICES_ARRAY_SIZE = sizeof(Vertices) / sizeof(QVector3D)
private

◆ view

DsoSettingsView* GlScope::view
private

◆ zoomed

bool GlScope::zoomed = false
private

The documentation for this class was generated from the following files: