Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » [BUG] GL canvas gone missing...
Re: [BUG] GL canvas gone missing... [message #50611 is a reply to message #50526] Mon, 26 November 2018 11:51 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
ptkacz wrote on Tue, 13 November 2018 01:31

Looking forward to any update!


Peter


So after fixing GTK GLCtrl, I have tried your code and found that the problem was something else.

It is a bad idea to do layout in DialogGL::DialogGL - at that point, GetSize is likely to return something odd. The best here is to use SizePos.

Fixed code:

struct CanvasGL : GLCtrl {
    typedef CanvasGL CLASSNAME;

    virtual void GLPaint() {
        StdView();

        glLoadIdentity();
        glShadeModel(GL_SMOOTH);
        glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        // glClearDepth(1.0f);
    }
};

struct DialogGL : public TopWindow {
    typedef DialogGL CLASSNAME;

    DialogGL() {
        Add(canvasGL.SizePos());
    }

    void open() {
        if(!IsOpen()) {
            Open();
        }
    }

    void close() {
        if(IsOpen()) {
            Close();
        }
    }

private:
    CanvasGL canvasGL;
};

 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Automatic Build Methods setup - Does it find MinGW?
Next Topic: TopWindow Run on Background
Goto Forum:
  


Current Time: Thu May 02 03:24:38 CEST 2024

Total time taken to generate the page: 0.04583 seconds