summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-11-06 17:09:27 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-11-06 17:09:27 (GMT)
commit7ee944a14582cd7202b4a8e94adc06e7ae5855a6 (patch)
tree0684ab4a4e02dc72c2e1f5bc72baaf55f0d0310f /demos
parentcd58bc13a4a37543d76a79b3cee7cd95bde0a14b (diff)
parent12d14efb2e1df3188c7c0001492f24fd193a11a9 (diff)
downloadQt-7ee944a14582cd7202b4a8e94adc06e7ae5855a6.zip
Qt-7ee944a14582cd7202b4a8e94adc06e7ae5855a6.tar.gz
Qt-7ee944a14582cd7202b4a8e94adc06e7ae5855a6.tar.bz2
Merge commit 'origin/4.6' into 4.6
Conflicts: dist/changes-4.6.0
Diffstat (limited to 'demos')
-rw-r--r--demos/boxes/scene.cpp34
-rw-r--r--demos/qmediaplayer/mediaplayer.h2
2 files changed, 19 insertions, 17 deletions
diff --git a/demos/boxes/scene.cpp b/demos/boxes/scene.cpp
index a06e8a1..06dc0f9 100644
--- a/demos/boxes/scene.cpp
+++ b/demos/boxes/scene.cpp
@@ -552,14 +552,15 @@ void Scene::initGL()
{
m_box = new GLRoundedBox(0.25f, 1.0f, 10);
- m_vertexShader = new QGLShader(":/res/boxes/basic.vsh", QGLShader::VertexShader);
+ m_vertexShader = new QGLShader(QGLShader::Vertex);
+ m_vertexShader->compileSourceFile(QLatin1String(":/res/boxes/basic.vsh"));
QStringList list;
list << ":/res/boxes/cubemap_posx.jpg" << ":/res/boxes/cubemap_negx.jpg" << ":/res/boxes/cubemap_posy.jpg"
<< ":/res/boxes/cubemap_negy.jpg" << ":/res/boxes/cubemap_posz.jpg" << ":/res/boxes/cubemap_negz.jpg";
m_environment = new GLTextureCube(list, qMin(1024, m_maxTextureSize));
- m_environmentShader = new QGLShader(QGLShader::FragmentShader);
- m_environmentShader->compile(environmentShaderText);
+ m_environmentShader = new QGLShader(QGLShader::Fragment);
+ m_environmentShader->compileSourceCode(environmentShaderText);
m_environmentProgram = new QGLShaderProgram;
m_environmentProgram->addShader(m_vertexShader);
m_environmentProgram->addShader(m_environmentShader);
@@ -616,7 +617,8 @@ void Scene::initGL()
files = QDir(":/res/boxes/").entryInfoList(filter, QDir::Files | QDir::Readable);
foreach (QFileInfo file, files) {
QGLShaderProgram *program = new QGLShaderProgram;
- QGLShader* shader = new QGLShader(file.absoluteFilePath(), QGLShader::FragmentShader);
+ QGLShader* shader = new QGLShader(QGLShader::Fragment);
+ shader->compileSourceFile(file.absoluteFilePath());
// The program does not take ownership over the shaders, so store them in a vector so they can be deleted afterwards.
program->addShader(m_vertexShader);
program->addShader(shader);
@@ -638,9 +640,9 @@ void Scene::initGL()
m_programs << program;
m_renderOptions->addShader(file.baseName());
- program->enable();
+ program->bind();
m_cubemaps << ((program->uniformLocation("env") != -1) ? new GLRenderTargetCube(qMin(256, m_maxTextureSize)) : 0);
- program->disable();
+ program->release();
}
if (m_programs.size() == 0)
@@ -697,12 +699,12 @@ void Scene::renderBoxes(const QMatrix4x4 &view, int excludeBox)
// Don't render the environment if the environment texture can't be set for the correct sampler.
if (glActiveTexture) {
m_environment->bind();
- m_environmentProgram->enable();
+ m_environmentProgram->bind();
m_environmentProgram->setUniformValue("tex", GLint(0));
m_environmentProgram->setUniformValue("env", GLint(1));
m_environmentProgram->setUniformValue("noise", GLint(2));
m_box->draw();
- m_environmentProgram->disable();
+ m_environmentProgram->release();
m_environment->unbind();
}
@@ -730,14 +732,14 @@ void Scene::renderBoxes(const QMatrix4x4 &view, int excludeBox)
else
m_environment->bind();
}
- m_programs[i]->enable();
+ m_programs[i]->bind();
m_programs[i]->setUniformValue("tex", GLint(0));
m_programs[i]->setUniformValue("env", GLint(1));
m_programs[i]->setUniformValue("noise", GLint(2));
m_programs[i]->setUniformValue("view", view);
m_programs[i]->setUniformValue("invView", invView);
m_box->draw();
- m_programs[i]->disable();
+ m_programs[i]->release();
if (glActiveTexture) {
if (m_dynamicCubemap && m_cubemaps[i])
@@ -760,14 +762,14 @@ void Scene::renderBoxes(const QMatrix4x4 &view, int excludeBox)
m_environment->bind();
}
- m_programs[m_currentShader]->enable();
+ m_programs[m_currentShader]->bind();
m_programs[m_currentShader]->setUniformValue("tex", GLint(0));
m_programs[m_currentShader]->setUniformValue("env", GLint(1));
m_programs[m_currentShader]->setUniformValue("noise", GLint(2));
m_programs[m_currentShader]->setUniformValue("view", view);
m_programs[m_currentShader]->setUniformValue("invView", invView);
m_box->draw();
- m_programs[m_currentShader]->disable();
+ m_programs[m_currentShader]->release();
if (glActiveTexture) {
if (m_dynamicCubemap)
@@ -1046,9 +1048,9 @@ void Scene::setColorParameter(const QString &name, QRgb color)
{
// set the color in all programs
foreach (QGLShaderProgram *program, m_programs) {
- program->enable();
+ program->bind();
program->setUniformValue(program->uniformLocation(name), QColor(color));
- program->disable();
+ program->release();
}
}
@@ -1056,9 +1058,9 @@ void Scene::setFloatParameter(const QString &name, float value)
{
// set the color in all programs
foreach (QGLShaderProgram *program, m_programs) {
- program->enable();
+ program->bind();
program->setUniformValue(program->uniformLocation(name), value);
- program->disable();
+ program->release();
}
}
diff --git a/demos/qmediaplayer/mediaplayer.h b/demos/qmediaplayer/mediaplayer.h
index 83f14e8..08db0e5 100644
--- a/demos/qmediaplayer/mediaplayer.h
+++ b/demos/qmediaplayer/mediaplayer.h
@@ -93,7 +93,6 @@ public slots:
void playPause();
void scaleChanged(QAction *);
void aspectChanged(QAction *);
- void hasVideoChanged(bool);
private slots:
void setAspect(int);
@@ -109,6 +108,7 @@ private slots:
void bufferStatus(int percent);
void openUrl();
void configureEffect();
+ void hasVideoChanged(bool);
private:
QIcon playIcon;