I have a aplication that draws 2D and 3D graphs with QGLWidget. It works good on windows and linux, but the 3D graphs fail on Mac (just bought myself a Macbook ). 2D works good but in 3D appears a blank window with nothing draw.
There is one major difference between graphs 2D and 3D, the 2D graph class is derived from QGLWidget, and the 3D class, however, is derived from a base class wich is derived from QGLWidget
graph 2D
{
Q_OBJECT
public:
GLGraph();
~GLGraph();
.....
class GLGraph : public QGLWidget
{
Q_OBJECT
public:
GLGraph();
~GLGraph();
.....
To copy to clipboard, switch view to plain text mode
graph 3D
#include "graph3d_base_glwidget.h"
class GLGraph3D_fxy : public Graph3D_Base_GLWidget
{
Q_OBJECT
public:
GLGraph3D_fxy();
~GLGraph3D_fxy();
virtual void paintGL();
...
#include "graph3d_base_glwidget.h"
class GLGraph3D_fxy : public Graph3D_Base_GLWidget
{
Q_OBJECT
public:
GLGraph3D_fxy();
~GLGraph3D_fxy();
virtual void paintGL();
...
To copy to clipboard, switch view to plain text mode
3D graph base class
#include <QGLWidget>
#include "graph3Dclass/graph3d.h"
#include "gui/graf3d_dlg.h"
....
class Graph3D_Base_GLWidget
: public QGLWidget {
Q_OBJECT
public:
Graph3D_Base_GLWidget();
~Graph3D_Base_GLWidget();
virtual void initializeGL();
virtual void paintGL()
.....
virtual void resizeGL(int width, int height);
void AutoRotate();
.......
#include <QGLWidget>
#include "graph3Dclass/graph3d.h"
#include "gui/graf3d_dlg.h"
....
class Graph3D_Base_GLWidget : public QGLWidget
{
Q_OBJECT
public:
Graph3D_Base_GLWidget();
~Graph3D_Base_GLWidget();
virtual void initializeGL();
virtual void paintGL()
.....
virtual void resizeGL(int width, int height);
void AutoRotate();
.......
To copy to clipboard, switch view to plain text mode
Also I I've been checking QGLWidget in Qt Assistant documentation and I didn't understand the constructor
{
Q_OBJECT // must include this if you use Qt signals/slots
public:
protected:
void initializeGL()
{
// Set up the rendering context, define display lists etc.:
...
class MyGLDrawer : public QGLWidget
{
Q_OBJECT // must include this if you use Qt signals/slots
public:
MyGLDrawer(QWidget *parent) //????
: QGLWidget(parent) {} //???????
protected:
void initializeGL()
{
// Set up the rendering context, define display lists etc.:
...
To copy to clipboard, switch view to plain text mode
Any ideias on this 3D blank window?
Bookmarks