Add canvas to scene to write on canvas online by A-frame - aframe

I'm a newer in webvr. I want to add canvas to scene by A-frame to draw or write any thing online
Thanks.
Esraa

Related

BabylonJS scene switching stutters

Live Demo
I want to switch between 2 complex scenes for an intro animation. Both scenes load from .gltf or .babylon files and contain camera motion.
The issue that I'm experiencing is that when I switch from scene1 to 2, there's a freeze/stutter before the next scene animation begins. Once the scene is rendered the switching of scenes continues as normal. It may be hard to spot but there's definitely difference between the first switch and the consequent ones.
I've tried using scene2.render(); right after loading the scene and it helps a little but it also makes the first scene stutter while it's trying to render both scenes. Is there something that I may be missing about this? I couldn't find an example of an intro with scene switching that works well online. Only camera switch but that's not what I want.
this is because the shaders of the second scene need to be compiled (as they could be different from the ones used in the first scene).
Babylon.js v4 will support parallel shader compilation but this will not be available on all browsers.
The best option could be to force that compilation beforehand:
scene1.meshes.forEach(mesh => {
mesh.material.forceCompilation(mesh);
});

How to render a Scene in JavaFX? (2D Game)

I have to create a 2D rpg game for my project. In nearly every tutorial I read, they used canvas for drawing the Scene and it was possible with canvas to render the Scene.
Is there any way to render the Scene without canvas?
JavaFX has AnimationTimer, which is equivalent of drawing/updating a scene using canvas in Swing. This allows you to handle sprite movement and animations smoothly.
See: https://docs.oracle.com/javase/8/javafx/api/javafx/animation/AnimationTimer.html
Also, here is a good JavaFX game tutorial. It isn't an RPG game tutorial, but you can take a lot of information from the code, how AnimationTimer is used, and the overall structure of a game using JavaFX:
http://gamedevelopment.tutsplus.com/tutorials/introduction-to-javafx-for-game-development--cms-23835

Adjust Brightness for qvideowidget inserted into the QGraphicsscene and QGraphicsView

I am playing video using the Qgrpahicsscene, QgraphicsView, qvideowidget
videoWidget = new QVideoWidget;
QGraphicsScene *scene = new QGraphicsScene;
QGraphicsView *graphicsView = new QGraphicsView(scene);
scene->addWidget(videoWidget);
the video playing correctly, what i need is when i adjust brightness in videowidget it is not reflecting and i have checked the videowidget brightness level it is setting.
please share some ideas,
thanks in advance
Update the scene after the change of brightness. Like this:
videoWidget->setBrightness(bright);
scene->update(scene->sceneRect());
You can achieve pretty much all kinds of effects and corrections with the use of shaders, brightness in particular is a very simple fragment shader, just multiply each pixel's luminosity by a real multiplier. With QML you even have the ready to use shader effects as well as the QML video effects example.
Brightness/Contrast
All ready to use effects
QML video effects example
You could use shaders even with widgets if you go for a QGLWidget base widget and still get the great performance.

Trying to make Qt HUD in OSG, camera issue

I'm kind of newbie in both OSG and Qt, still I'm trying to make Qt HUD upon my OSG window, what I want is Qt interface elements fixed inside OSG scene, not spinning with the model. The thing is, I need Qt elements INSIDE osg scene, not OSG scene inside Qt window (like in OSGviewerQt example).
What I've got yet is OSGQtWidgets example with --useWidgetImage --fullscreen arguments, which shows fixed Qt controls ontop of OSG Model. The thing is, it creates new (FIXED) camera for qt element ontop of OSG model -- because of that, user cannot spin and move OSG model because camera is not transparent.
So the question is: is there a way to make transparent camera with useable Qt elements in it? Or is there some other way to achieve my goals?
Thank you in advance!
I am unable to try this out for myself first, but you can try setting a property on the Orthogonal "HUD" camera to let events pass through to the regular OSG viewer:
camera->setAllowEventFocus(false);
If you're using a recent version of osgQtWidgets.cpp, you'd want to add this around line 414.

How to draw QGraphicsItem in a MFC view

I'm starting using Qt in my application. My application is MFC based. I want to draw some QGraphicsItems in my currect MFC view, is it possible?
You may say that it could be done by hosting QGraphicsView with QWinWidget in the MFC view, that don't work, however. Because my Canvas (MFC view) supports zooming and rotating while the QGraphicsView itself don't. When I zooming the QGraphicsItem, the QGraphicsView shows scroll bar instead of enlarging itself.
Any suggestion? Thanks!
Theoretically you could use QGraphicsScene::paint to paint the scene with your QGraphicsItems in the buffer, and then draw it to MFC view, but it does not make any sense...
What is the problem with QGraphicsView anyway? Have you taken a look at the rotate(), scale(), translate() or shear() functions of it?
You can turn off the displaying of scroll bard of QGraphicsView by setting the ScrollBarPolcies to Qt::ScrollBarAlwaysOff. (QGraphicsView is a sub-class of QAbstractScrollArea.)
I am not sure I understand what you mean by rotating QGraphicsView itself instead of the content. Without the scroll bars, I don't see the difference. Also much of the functionality of QGraphicsItem like editing as you indicated, depends on event handling in QGraphicsScene and QGraphicsView to work. I don't think plugging just a QGraphicsItem into the MFC view will do what you want.

Resources