mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-06 05:03:10 +02:00
Updated test code for video on mac
This commit is contained in:
parent
6cb1421978
commit
d8aa5fcc30
6 changed files with 29 additions and 15 deletions
|
@ -61,17 +61,21 @@ Item {
|
|||
Rectangle {
|
||||
width: 5
|
||||
height: 5
|
||||
color: "red"
|
||||
ColorAnimation on color { loops: Animation.Infinite; from: "red"; to: "yellow"; duration: 1000 }
|
||||
color: "blue"
|
||||
ColorAnimation on color { loops: Animation.Infinite; from: "blue"; to: "yellow"; duration: 1000 }
|
||||
}
|
||||
|
||||
|
||||
WebEngineView {
|
||||
id: root
|
||||
url: "https://google.com/"
|
||||
x: 6; y: 6;
|
||||
width: parent.width * 0.8
|
||||
height: parent.height * 0.8
|
||||
url: "https://www.webrtc-experiment.com/Pluginfree-Screen-Sharing/#19583796789766627"
|
||||
// url: "https://vimeo.com/108650530"
|
||||
// url: "https://www.youtube.com/watch?v=7EWQOeQf32U&autoplay=1&loop=1"
|
||||
// x: 6; y: 6;
|
||||
anchors.fill: parent
|
||||
// width: parent.width * 0.8
|
||||
// height: parent.height * 0.8
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ void MacQml::init() {
|
|||
_surface->load(url, callback);
|
||||
_surface->resize(_window->size());
|
||||
_surface->resume();
|
||||
|
||||
_window->installEventFilter(_surface.get());
|
||||
}
|
||||
|
||||
void MacQml::draw() {
|
||||
|
|
|
@ -9,7 +9,7 @@ public:
|
|||
QmlPtr _surface;
|
||||
GLuint _fbo{ 0 };
|
||||
|
||||
MacQml(const QWindow* window) : Parent(window) {}
|
||||
MacQml(QWindow* window) : Parent(window) {}
|
||||
void update() override;
|
||||
void init() override;
|
||||
void draw() override;
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
std::array<std::array<QmlInfo, DIVISIONS_Y>, DIVISIONS_X> _surfaces;
|
||||
GLuint _fbo{ 0 };
|
||||
|
||||
StressWeb(const QWindow* window) : Parent(window) {}
|
||||
StressWeb(QWindow* window) : Parent(window) {}
|
||||
static QString getSourceUrl(bool video);
|
||||
void buildSurface(QmlInfo& qmlInfo, bool video);
|
||||
void destroySurface(QmlInfo& qmlInfo);
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
class TestCase {
|
||||
public:
|
||||
using QmlPtr = QSharedPointer<hifi::qml::OffscreenSurface>;
|
||||
using Builder = std::function<TestCase*(const QWindow*)>;
|
||||
TestCase(const QWindow* window) : _window(window) {}
|
||||
using Builder = std::function<TestCase*(QWindow*)>;
|
||||
TestCase(QWindow* window) : _window(window) {}
|
||||
virtual void init();
|
||||
virtual void destroy();
|
||||
virtual void update();
|
||||
|
@ -18,6 +18,6 @@ public:
|
|||
|
||||
protected:
|
||||
QOpenGLFunctions_4_1_Core _glf;
|
||||
const QWindow* _window;
|
||||
QWindow* _window;
|
||||
std::function<void(uint32_t, void*)> _discardLamdba;
|
||||
};
|
||||
|
|
|
@ -205,12 +205,22 @@ void TestWindow::resizeEvent(QResizeEvent* ev) {
|
|||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
#ifdef Q_OS_MAC
|
||||
auto format = getDefaultOpenGLSurfaceFormat();
|
||||
format.setVersion(4, 1);
|
||||
// Deal with some weirdness in the chromium context sharing on Mac.
|
||||
// The primary share context needs to be 3.2, so that the Chromium will
|
||||
// succeed in it's creation of it's command stub contexts.
|
||||
format.setVersion(3, 2);
|
||||
// This appears to resolve the issues with corrupted fonts on OSX. No
|
||||
// idea why.
|
||||
qputenv("QT_ENABLE_GLYPH_CACHE_WORKAROUND", "true");
|
||||
// https://i.kym-cdn.com/entries/icons/original/000/008/342/ihave.jpg
|
||||
QSurfaceFormat::setDefaultFormat(format);
|
||||
#endif
|
||||
|
||||
|
||||
QGuiApplication app(argc, argv);
|
||||
TestCase::Builder builder = [](const QWindow* window)->TestCase*{ return new MacQml(window); };
|
||||
TestCase::Builder builder = [](QWindow* window)->TestCase*{ return new MacQml(window); };
|
||||
TestWindow window(builder);
|
||||
return app.exec();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue