Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ if(Qt5_FOUND)
add_subdirectory(qt)
endif()

if(wxWidgets_FOUND)
add_subdirectory(wx)
endif()
# Disabled as haven't figured out a GL multi-context scheme for wx windows
#if(wxWidgets_FOUND)
# add_subdirectory(wx)
#endif()

if (OpenGL_EGL_FOUND)
add_subdirectory(pi)
Expand Down Expand Up @@ -148,9 +149,6 @@ endif(ARMADILLO_FOUND)
add_executable(helloworld helloworld.cpp)
target_link_libraries(helloworld OpenGL::GL glfw Freetype::Freetype)

add_executable(helloworld_nomx helloworld_nomx.cpp)
target_link_libraries(helloworld_nomx OpenGL::GL glfw Freetype::Freetype)

add_executable(helloversion helloversion.cpp)
target_link_libraries(helloversion OpenGL::GL glfw Freetype::Freetype)

Expand Down Expand Up @@ -270,10 +268,6 @@ target_link_libraries(duochrome OpenGL::GL glfw Freetype::Freetype)
add_executable(graph1 graph1.cpp)
target_link_libraries(graph1 OpenGL::GL glfw Freetype::Freetype)

# Shows how to write a program that uses non-multicontext aware, globally aliased GL functions:
add_executable(graph1_nomx graph1_nomx.cpp)
target_link_libraries(graph1_nomx OpenGL::GL glfw Freetype::Freetype)

if(HAVE_STD_FORMAT)
add_executable(graph_line graph_line.cpp)
target_link_libraries(graph_line OpenGL::GL glfw Freetype::Freetype)
Expand Down Expand Up @@ -334,11 +328,6 @@ target_link_libraries(linregr OpenGL::GL glfw Freetype::Freetype)
add_executable(twowindows twowindows.cpp)
target_link_libraries(twowindows OpenGL::GL glfw Freetype::Freetype)

# In practice, the non-multicontext headers will work for two windows on the same graphics device.
add_executable(twowindows_nomx twowindows_nomx.cpp)
target_compile_definitions(twowindows_nomx PUBLIC GLAD_OPTION_MX=1)
target_link_libraries(twowindows_nomx OpenGL::GL glfw Freetype::Freetype)

add_executable(twowindows_mutex twowindows_mutex.cpp)
target_link_libraries(twowindows_mutex OpenGL::GL glfw Freetype::Freetype)

Expand Down
29 changes: 0 additions & 29 deletions examples/graph1_nomx.cpp

This file was deleted.

8 changes: 0 additions & 8 deletions examples/helloworld_nomx.cpp

This file was deleted.

8 changes: 4 additions & 4 deletions examples/qt/fps/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ MainWindow::MainWindow(QWidget *parent)
// reinitialization. When paintGL is called (and a GL
// context is available) the mathplot OpenGL model will
// be rebuilt.
static_cast<mplot::qt::viswidget*>(this->p_vw)->set_model_needs_reinit (0);
static_cast<mplot::qt::viswidget<0>*>(this->p_vw)->set_model_needs_reinit (0);
// Call the OpenGLWidget's update method. This will cause a
// call to viswidget::paintGL()
this->p_vw->update();
Expand Down Expand Up @@ -73,21 +73,21 @@ void MainWindow::setupHexGridVisual()
// VisualModels that do text, like a GraphVisual). This gives the VisualModel access
// to shader progs from the Visual environment, and allows the VisualModel to know
// its parent Visual.
static_cast<mplot::qt::viswidget*>(this->p_vw)->v.bindmodel (hgv);
static_cast<mplot::qt::viswidget<0>*>(this->p_vw)->v.bindmodel (hgv);

// Give the HexGridVisual access to the scalar data for the surface
hgv->setScalarData (&this->data);

// Now add the HexGridVisual model to newvisualmodels. It has to be cast to a plain mplot::VisualModel first:
std::unique_ptr<mplot::VisualModel<mplot::qt::gl_version>> vmp = std::move (hgv);
// The vector of VisualModels lives in viswidget, accessible via p_vw:
static_cast<mplot::qt::viswidget*>(this->p_vw)->newvisualmodels.push_back (std::move(vmp));
static_cast<mplot::qt::viswidget<0>*>(this->p_vw)->newvisualmodels.push_back (std::move(vmp));
}

void MainWindow::viswidget_init()
{
// Create widget. Seems to open in its own window with a new context.
mplot::qt::viswidget* vw = new mplot::qt::viswidget (this->parentWidget());
mplot::qt::viswidget<0>* vw = new mplot::qt::viswidget<0> (this->parentWidget());
// Choose lighting effects if you want
vw->v.lightingEffects();
// Add the OpenGL widget to the UI.
Expand Down
2 changes: 1 addition & 1 deletion examples/qt/fps/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ QT_END_NAMESPACE
#include <sm/vvec>
#include <sm/hexgrid>

class QOpenGLWidget;
struct QOpenGLWidget;

class MainWindow : public QMainWindow
{
Expand Down
5 changes: 1 addition & 4 deletions examples/qt/graph1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
add_executable(qtgraph1 main.cpp)
target_link_libraries(qtgraph1 Qt5::Gui Qt5::Widgets Qt5::Core ${MPLOT_LIBS_GL})

add_executable(qtgraph1_mx main_mx.cpp)
target_compile_definitions(qtgraph1 PUBLIC GL3_PROTOTYPES GL_GLEXT_PROTOTYPES)
target_link_libraries(qtgraph1_mx Qt5::Gui Qt5::Widgets Qt5::Core ${MPLOT_LIBS_GL})
target_link_libraries(qtgraph1 Qt5::Gui Qt5::Widgets Qt5::Core ${MPLOT_LIBS_GL})
4 changes: 2 additions & 2 deletions examples/qt/graph1/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ int main (int argc, char **argv)
QApplication app(argc, argv);

// Create widget. The GL version to be used is set inside viswidget. It's accessible as
// mplot::qt::gl_version.
mplot::qt::viswidget widget;
// mplot::qt::gl_version. You have to give an index to your widget (0 for the first, 1 for the next one, etc)
mplot::qt::viswidget<0> widget;
// Calling show ensures initializeGL() method gets called. The alternative to
// calling show() at the start of the main() function, is to set viswidget's
// buildmodels callback (see app2).
Expand Down
39 changes: 0 additions & 39 deletions examples/qt/graph1/main_mx.cpp

This file was deleted.

10 changes: 5 additions & 5 deletions examples/qt/hexgrid/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@ void MainWindow::setupHexGridVisual()
// VisualModels that do text, like a GraphVisual). This gives the VisualModel access
// to shader progs from the Visual environment, and allows the VisualModel to know
// its parent Visual.
static_cast<mplot::qt::viswidget*>(this->p_vw)->v.bindmodel (hgv);
static_cast<mplot::qt::viswidget<0>*>(this->p_vw)->v.bindmodel (hgv);

// Give the HexGridVisual access to the scalar data for the surface
hgv->setScalarData (&this->data);

// Now add the HexGridVisual model to newvisualmodels. It has to be cast to a plain mplot::VisualModel first:
std::unique_ptr<mplot::VisualModel<mplot::qt::gl_version>> vmp = std::move (hgv);
// The vector of VisualModels lives in viswidget, accessible via p_vw:
static_cast<mplot::qt::viswidget*>(this->p_vw)->newvisualmodels.push_back (std::move(vmp));
static_cast<mplot::qt::viswidget<0>*>(this->p_vw)->newvisualmodels.push_back (std::move(vmp));
}

void MainWindow::viswidget_init()
{
// Create widget. Seems to open in its own window with a new context.
mplot::qt::viswidget* vw = new mplot::qt::viswidget (this->parentWidget());
mplot::qt::viswidget<0>* vw = new mplot::qt::viswidget<0> (this->parentWidget());
// Choose lighting effects if you want
vw->v.lightingEffects();
// Add the OpenGL widget to the UI.
Expand All @@ -77,7 +77,7 @@ void MainWindow::on_pushButton_clicked()

auto gv = std::make_unique<mplot::GraphVisual<double, mplot::qt::gl_version>> (this->graphlocn);
// Bind the new (Graph)VisualModel to the mplot::Visual associated with the viswidget
static_cast<mplot::qt::viswidget*>(this->p_vw)->v.bindmodel (gv);
static_cast<mplot::qt::viswidget<0>*>(this->p_vw)->v.bindmodel (gv);

gv->twodimensional (false);
sm::vvec<double> x;
Expand All @@ -86,7 +86,7 @@ void MainWindow::on_pushButton_clicked()

// Cast and add
std::unique_ptr<mplot::VisualModel<mplot::qt::gl_version>> vmp = std::move (gv);
static_cast<mplot::qt::viswidget*>(this->p_vw)->newvisualmodels.push_back (std::move(vmp));
static_cast<mplot::qt::viswidget<0>*>(this->p_vw)->newvisualmodels.push_back (std::move(vmp));

// request a render, otherwise it won't appear until user interacts with window
this->p_vw->update();
Expand Down
2 changes: 1 addition & 1 deletion examples/qt/hexgrid/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ QT_END_NAMESPACE
#include <sm/vvec>
#include <sm/hexgrid>

class QOpenGLWidget;
struct QOpenGLWidget;

class MainWindow : public QMainWindow
{
Expand Down
108 changes: 0 additions & 108 deletions examples/twowindows_nomx.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion examples/wx/wx-graph1.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <wx/wx.h>

#define GLAD_GL_IMPLEMENTATION
#include <mplot/glad/gl.h> // must be included before glcanvas.h
#include <mplot/glad/gl_mx.h> // must be included before glcanvas.h

#include <wx/glcanvas.h>

Expand Down
15 changes: 3 additions & 12 deletions mplot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,23 @@ install(
VisualDefaultShaders.h

VisualFaceBase.h
VisualFaceNoMX.h
VisualFaceMX.h
VisualFace.h

VisualResourcesBase.h
VisualResourcesNoMX.h
VisualResourcesMX.h
VisualResources.h

VisualGlfw.h

VisualBase.h
VisualOwnableNoMX.h
VisualOwnableMX.h
VisualNoMX.h
VisualMX.h
VisualOwnable.h
Visual.h

VisualModelBase.h
VisualModelImplNoMX.h
VisualModelImplMX.h
VisualModel.h

VisualDataModel.h

VisualTextModelBase.h
VisualTextModelImplNoMX.h
VisualTextModelImplMX.h
VisualTextModel.h

CartGridVisual.h
Expand Down
Loading
Loading