mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-24 12:25:03 +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 {
|
Rectangle {
|
||||||
width: 5
|
width: 5
|
||||||
height: 5
|
height: 5
|
||||||
color: "red"
|
color: "blue"
|
||||||
ColorAnimation on color { loops: Animation.Infinite; from: "red"; to: "yellow"; duration: 1000 }
|
ColorAnimation on color { loops: Animation.Infinite; from: "blue"; to: "yellow"; duration: 1000 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WebEngineView {
|
WebEngineView {
|
||||||
id: root
|
id: root
|
||||||
url: "https://google.com/"
|
url: "https://www.webrtc-experiment.com/Pluginfree-Screen-Sharing/#19583796789766627"
|
||||||
x: 6; y: 6;
|
// url: "https://vimeo.com/108650530"
|
||||||
width: parent.width * 0.8
|
// url: "https://www.youtube.com/watch?v=7EWQOeQf32U&autoplay=1&loop=1"
|
||||||
height: parent.height * 0.8
|
// 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->load(url, callback);
|
||||||
_surface->resize(_window->size());
|
_surface->resize(_window->size());
|
||||||
_surface->resume();
|
_surface->resume();
|
||||||
|
_window->installEventFilter(_surface.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacQml::draw() {
|
void MacQml::draw() {
|
||||||
|
|
|
@ -9,7 +9,7 @@ public:
|
||||||
QmlPtr _surface;
|
QmlPtr _surface;
|
||||||
GLuint _fbo{ 0 };
|
GLuint _fbo{ 0 };
|
||||||
|
|
||||||
MacQml(const QWindow* window) : Parent(window) {}
|
MacQml(QWindow* window) : Parent(window) {}
|
||||||
void update() override;
|
void update() override;
|
||||||
void init() override;
|
void init() override;
|
||||||
void draw() override;
|
void draw() override;
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
std::array<std::array<QmlInfo, DIVISIONS_Y>, DIVISIONS_X> _surfaces;
|
std::array<std::array<QmlInfo, DIVISIONS_Y>, DIVISIONS_X> _surfaces;
|
||||||
GLuint _fbo{ 0 };
|
GLuint _fbo{ 0 };
|
||||||
|
|
||||||
StressWeb(const QWindow* window) : Parent(window) {}
|
StressWeb(QWindow* window) : Parent(window) {}
|
||||||
static QString getSourceUrl(bool video);
|
static QString getSourceUrl(bool video);
|
||||||
void buildSurface(QmlInfo& qmlInfo, bool video);
|
void buildSurface(QmlInfo& qmlInfo, bool video);
|
||||||
void destroySurface(QmlInfo& qmlInfo);
|
void destroySurface(QmlInfo& qmlInfo);
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
class TestCase {
|
class TestCase {
|
||||||
public:
|
public:
|
||||||
using QmlPtr = QSharedPointer<hifi::qml::OffscreenSurface>;
|
using QmlPtr = QSharedPointer<hifi::qml::OffscreenSurface>;
|
||||||
using Builder = std::function<TestCase*(const QWindow*)>;
|
using Builder = std::function<TestCase*(QWindow*)>;
|
||||||
TestCase(const QWindow* window) : _window(window) {}
|
TestCase(QWindow* window) : _window(window) {}
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual void destroy();
|
virtual void destroy();
|
||||||
virtual void update();
|
virtual void update();
|
||||||
|
@ -18,6 +18,6 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QOpenGLFunctions_4_1_Core _glf;
|
QOpenGLFunctions_4_1_Core _glf;
|
||||||
const QWindow* _window;
|
QWindow* _window;
|
||||||
std::function<void(uint32_t, void*)> _discardLamdba;
|
std::function<void(uint32_t, void*)> _discardLamdba;
|
||||||
};
|
};
|
||||||
|
|
|
@ -205,12 +205,22 @@ void TestWindow::resizeEvent(QResizeEvent* ev) {
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
auto format = getDefaultOpenGLSurfaceFormat();
|
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);
|
QSurfaceFormat::setDefaultFormat(format);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
QGuiApplication app(argc, argv);
|
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);
|
TestWindow window(builder);
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue