Home › Forum › SOFA › Programming with SOFA › [SOLVED] View Port via HDMI port
- This topic has 15 replies, 5 voices, and was last updated 8 years, 8 months ago by Binesh.
-
AuthorPosts
-
11 December 2015 at 17:23 #4909ZabolianBlocked
Hi!
I have a problem I wanted to run by you. If you could help me I’d appreciate it.
I want to have two outputs of Sofa simulator. One them in another Monitor using HDMI port, meaning one 2-Dimension view in the the computer and on the main GUI and the other one, a stereo (3D) full view on another Screen using HDMI cable.
The only thing I found that met my needs was OGLViewport which created an extra view and put it on the previous one. But there are 2 issues:
first, if I want to make this new view, a stereo one, the main view is going to be stereo too.
Second, the new image appears on the previous one while a separate and independent window so I’m able to show it somewhere else with a HDMI cable.
Thank you so much!28 December 2015 at 15:25 #5248fspadoniBlockedHi Zabolian,
In my project I needed to display the Sofa scene in two or more different windows and I faced your second problem.
In my project I created a second window using Qt and the OpenGL viewport using QGLWidget.
In the Sofa Qt GUI the sofa::gui:qt::viewer::qt::QtViewer class inherits from QGLWidget.To display the scene in a different window you have to share the OpenGL display lists and texture objects between the QGLWidgets. So you have to create the QGLWidget of the second window passing in the constructor the pointer to the QGLWidget of the main window as shareWidget parameter. (3rd parameter)
QGLWidget::QGLWidget(const QGLFormat & format, QWidget * parent = 0, const QGLWidget * shareWidget = 0, Qt::WindowFlags f = 0)
http://doc.qt.io/qt-4.8/qglwidget.html#QGLWidget
Hope it helps
Federico25 January 2016 at 18:04 #5383HugoKeymasterDear Zabolian,
Did the answer of Federico help you?
Do you need further support?Best regards,
Hugo
11 February 2016 at 18:44 #5616BineshBlockedHi friends
can you tell me closer?
I am confused…in which class i can do your offer ?
How can create QOGWidget and where?
How can share context ?18 February 2016 at 10:53 #5824HugoKeymasterDear Binesh,
It is really unclear what you expect to do. Could you please reformulate your problem/question (and if necessary create a separate topic) and give us some context?
Best,
Hugo
18 February 2016 at 11:41 #5826BineshBlockedThanks Dear Hugo,
Yes of course , i create a QGLWidget object in QtViewer.h and pass it into QtViewer constructor as shareWidget parametr and in constructor i create a QWidget and new the QGLWidget object that create in header before … then in QGLWidget i pass my QWidget object as QWidget* parent for it.
finally i show my widget and QGLWidget with show() function.
and i call initializeGL() and PaintGL() and DrawLogo() function..
my windows will be show but no context sharing with mainwindow of sofa
it is show empty..
all that function calling was in constructor
whats your idea??Thanks So Much For Reply
18 February 2016 at 13:36 #5836HugoKeymasterOk, one more thing: you’re saying “my windows will be show but no context sharing with mainwindow of sofa”. Did you already implement it and test it? do you have any screenshot? If nothing is appearing you might need to call the draw function in your widget.
Cheers,
Hugo
18 February 2016 at 14:51 #5837BineshBlocked
That is a screenshot
How can test and implement it ?22 February 2016 at 10:47 #5867HugoKeymasterHi @secretdevil,
I repost your screenshot (it isn’t appearing properly)
If nothing appears in the new Window (you have the SOFA backgrounds, meaning you call DrawLogo()), it means the call of the function draw(), drawScene(), DisplayOBJs() is not done. Make sure you are calling it within your new OpenGL draw loop. Finally, everything is done properly, this could also be an issue of camera.
Cheers,
Hugo
22 February 2016 at 12:13 #5878BineshBlockedQtViewer::QtViewer(QWidget* parent, const char* name, const unsigned int nbMSAASamples) : QGLWidget(setupGLFormat(nbMSAASamples), parent, name,testwindow) { if(check){ SReal s = 100; SReal w = 300; window = new QWidget(); window->setFixedSize(600,600); window->setWindowTitle(":: SOFA ::"); window->show(); testwindow = new QGLWidget(window); testwindow->resize(600,600); testwindow->show(); paintGL(); drawScene(); resizeGL(300,300); initializeGL(); resetView(); drawScene(); DrawBox(&s,&w); DrawXYPlane(10,10,20,10,20,1); DrawXZPlane(10,10,20,10,20,1); DrawYZPlane(10,10,20,10,20,1); DrawLogo(); DisplayOBJs(); DisplayMenu(); drawTexture(QRectF(200,200,200,200),_materialMode); drawText(300,300,"Behnam"); //DrawAxis(100,100,100,50); update(); mytimer = new QTimer(); mytimer->start(); mytimer->singleShot(1,this,SLOT(updateGL())); } }
testwindow is my secondwindow that i create it and i want share context to this window
22 February 2016 at 13:08 #5882BineshBlockedcan you give me your code please?
29 February 2016 at 10:47 #5987HugoKeymasterDear Binesh,
It seems (if you really copy-pasted your code) that you set all the functions in the constructor. You need to define these functions in the draw() of your GUI. Take a look at the QtViewer.h to get inspiration.
We obviously can’t just send you private code. But if you need a closer support, you can join the Consortium and subscribe for a support request.
Best regards,
Hugo
29 February 2016 at 15:54 #5990remibessardBlockedHi Binesh and Hugo,
I just wanted to suggest the fact that you did not called the method setScene():
void BaseViewer::setScene(sofa::simulation::Node::SPtr scene, const char* filename /* = NULL */, bool /* = false */)
that is used to set the scene that a viewer is going to render.
maybe you could try to call it (after testwindow->show()) ?Regards,
– Rémi
2 March 2016 at 06:16 #6011BineshBlockedDear @Hugo
Thanks for your reply
I solve this problem
You guide me and i could solve this problem so Thanks a lot2 March 2016 at 08:59 #6018HugoKeymasterHi Binesh,
Nice to hear! Could you tell us more about what exactly solved your issue? Thanks in advance,
Cheers,
Hugo
2 March 2016 at 09:06 #6021BineshBlockedYes
I share the widget and set a timer to initializegl function for my second window. -
AuthorPosts
- You must be logged in to reply to this topic.