Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SoQtExaminerViewer alway has black SceneGraph #82

Open
saiwing opened this issue Jan 9, 2025 · 4 comments
Open

SoQtExaminerViewer alway has black SceneGraph #82

saiwing opened this issue Jan 9, 2025 · 4 comments

Comments

@saiwing
Copy link

saiwing commented Jan 9, 2025

I compiled Coin3d 4.0.3 & Soqt 1.6.3 based on Qt6.3.2, everything goes well during compiling, but when I test Soqt example, it can't display correctly
Screenshot from 2025-01-09 22-43-12

#include <Inventor/Qt/SoQt.h>
#include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
#include <Inventor/nodes/SoBaseColor.h>
#include <Inventor/nodes/SoCone.h>
#include <Inventor/nodes/SoSeparator.h>

int main(int argc, char ** argv)
{
    // Initializes SoQt library (and implicitly also the Coin and Qt
    // libraries). Returns a top-level / shell Qt window to use.
    QWidget * mainwin = SoQt::init(argc, argv, argv[0]);

    // Make a dead simple scene graph by using the Coin library, only
    // containing a single yellow cone under the scene graph root.
    SoSeparator * root = new SoSeparator;
    root->ref();

    SoBaseColor * col = new SoBaseColor;
    col->rgb = SbColor(1, 1, 0);
    root->addChild(col);

    root->addChild(new SoCone);

    // Use one of the convenient SoQt viewer classes.
    SoQtExaminerViewer * eviewer = new SoQtExaminerViewer(mainwin);
    eviewer->setSceneGraph(root);
    eviewer->show();

    // Pop up the main window.
    SoQt::show(mainwin);
    // Loop until exit.
    SoQt::mainLoop();

    // Clean up resources.
    delete eviewer;
    root->unref();
    SoQt::done();

    return 0;
}

for Soqt's test_code, only "tripleview" has correct display, while all other demos have same problem
Screenshot from 2025-01-09 22-48-33

I found similar issue( high res screen problems #1 ), but set QT_SCREEN_SCALE_FACTOR has no effort for me

@saiwing
Copy link
Author

saiwing commented Jan 10, 2025

I found that if I change SoQtExaminerViewer constructor's 'build' from FALSE to TRUE, it can display the shape, but the tool icons on the right don't work, and the cone can't rotate, I don't know if it is correct

SoQtExaminerViewer::SoQtExaminerViewer(QWidget * parent,
                                       const char * name,
                                       SbBool embed,
                                       SoQtFullViewer::BuildFlag flag,
                                       SoQtViewer::Type type) 
: inherited(parent, name, embed, flag, type, TRUE) // FALSE -> TRUE 
{
  PRIVATE(this) = new SoQtExaminerViewerP(this);
  PRIVATE(this)->constructor(TRUE);
}

Screenshot from 2025-01-10 21-36-11

@saiwing
Copy link
Author

saiwing commented Jan 11, 2025

inspired by demo tripleview.cpp, I find if SoQtExaminerViewer >= 2, the program work, even though the inetration like zooming, rotating etc. not smoothing.

int main(int argc, char ** argv)
{
    QWidget *mainWin = SoQt::init(argc, argv, argv[0]);
    mainWin->resize(640, 480);

    // Set up the Qt widget layout data.
    QHBoxLayout *hlayout = new QHBoxLayout(mainWin);
    QGroupBox *view0 = new QGroupBox(mainWin);
    hlayout->addWidget(view0, 0.5);
    QGroupBox *view1 = new QGroupBox(mainWin);
    hlayout->addWidget(view1, 0.5);

    if(1) {
        SoSeparator *root = new SoSeparator;
        SoDirectionalLight *light = new SoDirectionalLight;
        root->addChild(light);

        SoCube *cube = new SoCube;
        root->addChild(cube);

        SoQtExaminerViewer *eviewer = new SoQtExaminerViewer(view0);
        eviewer->setSceneGraph(root);
        eviewer->setBackgroundColor(SbColor(0.5, 0.0, 0.5));
    }

    if(1) {
        SoSeparator *root = new SoSeparator;
        SoDirectionalLight *light = new SoDirectionalLight;
        root->addChild(light);

        SoCube *cube = new SoCube;
        root->addChild(cube);

        SoQtExaminerViewer * eviewer = new SoQtExaminerViewer(view1);
        eviewer->setSceneGraph(root);
        eviewer->setBackgroundColor(SbColor(0.5, 0.0, 0.5));
    }

    SoQt::show(mainWin);
    SoQt::mainLoop();

    return 0;
}

Screenshot from 2025-01-11 18-04-49

@VolkerEnderlein
Copy link
Collaborator

Thanks for the report. I am not aware that the SoQt examiner viewer is broken. I'll have a look onto the issue but unfortunatly not before monday.

@VolkerEnderlein
Copy link
Collaborator

I just tested the app and all the examples with Qt 6.6.0 as I did not have Qt version 6.3 around, but it works flawlessly as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants