summaryrefslogtreecommitdiffstats
path: root/examples/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'examples/opengl')
-rw-r--r--examples/opengl/2dpainting/2dpainting.pro2
-rw-r--r--examples/opengl/framebufferobject/bubbles.svg13
-rw-r--r--examples/opengl/framebufferobject/framebufferobject.pro2
-rw-r--r--examples/opengl/framebufferobject2/framebufferobject2.pro2
-rw-r--r--examples/opengl/grabber/grabber.pro2
-rw-r--r--examples/opengl/hellogl/glwidget.cpp52
-rw-r--r--examples/opengl/hellogl/hellogl.pro2
-rw-r--r--examples/opengl/opengl.pro2
-rw-r--r--examples/opengl/overpainting/overpainting.pro2
-rw-r--r--examples/opengl/pbuffers/pbuffers.pro2
-rw-r--r--examples/opengl/pbuffers2/bubbles.svg13
-rw-r--r--examples/opengl/pbuffers2/pbuffers2.pro2
-rw-r--r--examples/opengl/samplebuffers/glwidget.cpp36
-rw-r--r--examples/opengl/samplebuffers/samplebuffers.pro2
-rw-r--r--examples/opengl/textures/textures.pro2
15 files changed, 50 insertions, 86 deletions
diff --git a/examples/opengl/2dpainting/2dpainting.pro b/examples/opengl/2dpainting/2dpainting.pro
index c45b764..01df1da 100644
--- a/examples/opengl/2dpainting/2dpainting.pro
+++ b/examples/opengl/2dpainting/2dpainting.pro
@@ -15,3 +15,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/opengl/2dpainting
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 2dpainting.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/2dpainting
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
diff --git a/examples/opengl/framebufferobject/bubbles.svg b/examples/opengl/framebufferobject/bubbles.svg
index 65867da..3d7971d 100644
--- a/examples/opengl/framebufferobject/bubbles.svg
+++ b/examples/opengl/framebufferobject/bubbles.svg
@@ -78,10 +78,6 @@
<!-- Define a shadow for each sphere. -->
<circle id="shadow" fill="url(#shadowGrad)" cx="0" cy="0" r="100" />
<g id="bubble">
- <circle fill="black" cx="0" cy="0" r="50" />
- <circle fill="#a6ce39" cx="0" cy="0" r="33" />
- <path fill="black" d="M 37,50 L 50,37 L 12,-1 L 22,-11 L 10,-24 L -24,10
- L -11,22 L -1,12 Z" />
<circle cx="0" cy="0" r="100" />
</g>
</defs>
@@ -180,15 +176,6 @@
</g>
</g>
<g transform="translate(200,0)" >
- <g transform="translate(200,490) scale(2.0,1.0) rotate(45)" >
- <rect fill="#a6ce39" x="-69" y="-69" width="138" height="138" />
- <circle fill="black" cx="0" cy="0" r="50" />
- <circle fill="#a6ce39" cx="0" cy="0" r="33" />
- <path fill="black" d="M 37,50 L 50,37 L 12,-1 L 22,-11 L 10,-24 L -24,10
- L -11,22 L -1,12 Z" />
- <animateTransform attributeName="transform" type="rotate" values="0; 360"
- begin="0s" dur="10s" fill="freeze" repeatCount="indefinite" />
- </g>
<g transform="translate(200,375)">
<use xlink:href="#shadow" transform="translate(25,55) scale(1.0,0.5)" />
<circle fill="url(#blueSphere)" cx="0" cy="0" r="100" />
diff --git a/examples/opengl/framebufferobject/framebufferobject.pro b/examples/opengl/framebufferobject/framebufferobject.pro
index 4bc667c..a5927ec 100644
--- a/examples/opengl/framebufferobject/framebufferobject.pro
+++ b/examples/opengl/framebufferobject/framebufferobject.pro
@@ -20,3 +20,5 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.png *.svg
sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/framebufferobject
INSTALLS += target sources
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
+
diff --git a/examples/opengl/framebufferobject2/framebufferobject2.pro b/examples/opengl/framebufferobject2/framebufferobject2.pro
index 9f1644c..076f98c 100644
--- a/examples/opengl/framebufferobject2/framebufferobject2.pro
+++ b/examples/opengl/framebufferobject2/framebufferobject2.pro
@@ -9,3 +9,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/opengl/framebufferobject2
sources.files = $$SOURCES $$HEADERS $$RESOURCES framebufferobject2.pro *.png
sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/framebufferobject2
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
diff --git a/examples/opengl/grabber/grabber.pro b/examples/opengl/grabber/grabber.pro
index 15eaf02..23a0c4a 100644
--- a/examples/opengl/grabber/grabber.pro
+++ b/examples/opengl/grabber/grabber.pro
@@ -10,3 +10,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/opengl/grabber
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS grabber.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/grabber
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
diff --git a/examples/opengl/hellogl/glwidget.cpp b/examples/opengl/hellogl/glwidget.cpp
index d81e7e6..fbca829 100644
--- a/examples/opengl/hellogl/glwidget.cpp
+++ b/examples/opengl/hellogl/glwidget.cpp
@@ -183,46 +183,30 @@ GLuint GLWidget::makeObject()
glBegin(GL_QUADS);
- GLdouble x1 = +0.06;
- GLdouble y1 = -0.14;
- GLdouble x2 = +0.14;
- GLdouble y2 = -0.06;
- GLdouble x3 = +0.08;
- GLdouble y3 = +0.00;
- GLdouble x4 = +0.30;
- GLdouble y4 = +0.22;
-
- quad(x1, y1, x2, y2, y2, x2, y1, x1);
- quad(x3, y3, x4, y4, y4, x4, y3, x3);
-
- extrude(x1, y1, x2, y2);
- extrude(x2, y2, y2, x2);
- extrude(y2, x2, y1, x1);
- extrude(y1, x1, x1, y1);
- extrude(x3, y3, x4, y4);
- extrude(x4, y4, y4, x4);
- extrude(y4, x4, y3, x3);
-
const double Pi = 3.14159265358979323846;
const int NumSectors = 200;
- for (int i = 0; i < NumSectors; ++i) {
- double angle1 = (i * 2 * Pi) / NumSectors;
- GLdouble x5 = 0.30 * sin(angle1);
- GLdouble y5 = 0.30 * cos(angle1);
- GLdouble x6 = 0.20 * sin(angle1);
- GLdouble y6 = 0.20 * cos(angle1);
+ for (int j = 0; j < 2; ++j) {
+ double r = 0.1 + (j * 0.2);
+
+ for (int i = 0; i < NumSectors; ++i) {
+ double angle1 = (i * 2 * Pi) / NumSectors;
+ GLdouble x5 = (r + 0.1) * sin(angle1);
+ GLdouble y5 = (r + 0.1) * cos(angle1);
+ GLdouble x6 = r * sin(angle1);
+ GLdouble y6 = r * cos(angle1);
- double angle2 = ((i + 1) * 2 * Pi) / NumSectors;
- GLdouble x7 = 0.20 * sin(angle2);
- GLdouble y7 = 0.20 * cos(angle2);
- GLdouble x8 = 0.30 * sin(angle2);
- GLdouble y8 = 0.30 * cos(angle2);
+ double angle2 = ((i + 1) * 2 * Pi) / NumSectors;
+ GLdouble x7 = r * sin(angle2);
+ GLdouble y7 = r * cos(angle2);
+ GLdouble x8 = (r + 0.1) * sin(angle2);
+ GLdouble y8 = (r + 0.1) * cos(angle2);
- quad(x5, y5, x6, y6, x7, y7, x8, y8);
+ quad(x5, y5, x6, y6, x7, y7, x8, y8);
- extrude(x6, y6, x7, y7);
- extrude(x8, y8, x5, y5);
+ extrude(x6, y6, x7, y7);
+ extrude(x8, y8, x5, y5);
+ }
}
glEnd();
diff --git a/examples/opengl/hellogl/hellogl.pro b/examples/opengl/hellogl/hellogl.pro
index ce9c8e8..77034cc 100644
--- a/examples/opengl/hellogl/hellogl.pro
+++ b/examples/opengl/hellogl/hellogl.pro
@@ -10,3 +10,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS hellogl.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
diff --git a/examples/opengl/opengl.pro b/examples/opengl/opengl.pro
index a4c2a22..7b76d86 100644
--- a/examples/opengl/opengl.pro
+++ b/examples/opengl/opengl.pro
@@ -27,3 +27,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/opengl
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS opengl.pro README
sources.path = $$[QT_INSTALL_EXAMPLES]/opengl
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
diff --git a/examples/opengl/overpainting/overpainting.pro b/examples/opengl/overpainting/overpainting.pro
index b8e79eb..3603260 100644
--- a/examples/opengl/overpainting/overpainting.pro
+++ b/examples/opengl/overpainting/overpainting.pro
@@ -11,3 +11,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/opengl/overpainting
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS overpainting.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/overpainting
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
diff --git a/examples/opengl/pbuffers/pbuffers.pro b/examples/opengl/pbuffers/pbuffers.pro
index c1060e2..72f20f8 100644
--- a/examples/opengl/pbuffers/pbuffers.pro
+++ b/examples/opengl/pbuffers/pbuffers.pro
@@ -9,3 +9,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/opengl/pbuffers
sources.files = $$SOURCES $$HEADERS $$RESOURCES pbuffers.pro *.png
sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/pbuffers
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
diff --git a/examples/opengl/pbuffers2/bubbles.svg b/examples/opengl/pbuffers2/bubbles.svg
index 65867da..3d7971d 100644
--- a/examples/opengl/pbuffers2/bubbles.svg
+++ b/examples/opengl/pbuffers2/bubbles.svg
@@ -78,10 +78,6 @@
<!-- Define a shadow for each sphere. -->
<circle id="shadow" fill="url(#shadowGrad)" cx="0" cy="0" r="100" />
<g id="bubble">
- <circle fill="black" cx="0" cy="0" r="50" />
- <circle fill="#a6ce39" cx="0" cy="0" r="33" />
- <path fill="black" d="M 37,50 L 50,37 L 12,-1 L 22,-11 L 10,-24 L -24,10
- L -11,22 L -1,12 Z" />
<circle cx="0" cy="0" r="100" />
</g>
</defs>
@@ -180,15 +176,6 @@
</g>
</g>
<g transform="translate(200,0)" >
- <g transform="translate(200,490) scale(2.0,1.0) rotate(45)" >
- <rect fill="#a6ce39" x="-69" y="-69" width="138" height="138" />
- <circle fill="black" cx="0" cy="0" r="50" />
- <circle fill="#a6ce39" cx="0" cy="0" r="33" />
- <path fill="black" d="M 37,50 L 50,37 L 12,-1 L 22,-11 L 10,-24 L -24,10
- L -11,22 L -1,12 Z" />
- <animateTransform attributeName="transform" type="rotate" values="0; 360"
- begin="0s" dur="10s" fill="freeze" repeatCount="indefinite" />
- </g>
<g transform="translate(200,375)">
<use xlink:href="#shadow" transform="translate(25,55) scale(1.0,0.5)" />
<circle fill="url(#blueSphere)" cx="0" cy="0" r="100" />
diff --git a/examples/opengl/pbuffers2/pbuffers2.pro b/examples/opengl/pbuffers2/pbuffers2.pro
index cbd0cb5..7f12483 100644
--- a/examples/opengl/pbuffers2/pbuffers2.pro
+++ b/examples/opengl/pbuffers2/pbuffers2.pro
@@ -19,3 +19,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/opengl/pbuffers2
sources.files = $$SOURCES $$HEADERS $$RESOURCES pbuffers2.pro *.png *.svg
sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/pbuffers2
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
diff --git a/examples/opengl/samplebuffers/glwidget.cpp b/examples/opengl/samplebuffers/glwidget.cpp
index 381ff95..0bc17aa 100644
--- a/examples/opengl/samplebuffers/glwidget.cpp
+++ b/examples/opengl/samplebuffers/glwidget.cpp
@@ -109,44 +109,28 @@ void GLWidget::makeObject()
QColor trolltechGreen(QColor::fromCmykF(0.40, 0.0, 1.0, 0.0));
const double Pi = 3.14159265358979323846;
const int NumSectors = 15;
- GLdouble x1 = +0.06;
- GLdouble y1 = -0.14;
- GLdouble x2 = +0.14;
- GLdouble y2 = -0.06;
- GLdouble x3 = +0.08;
- GLdouble y3 = +0.00;
- GLdouble x4 = +0.30;
- GLdouble y4 = +0.22;
list = glGenLists(1);
glNewList(list, GL_COMPILE);
{
for (int i = 0; i < NumSectors; ++i) {
double angle1 = (i * 2 * Pi) / NumSectors;
- GLdouble x5 = 0.30 * sin(angle1);
- GLdouble y5 = 0.30 * cos(angle1);
- GLdouble x6 = 0.20 * sin(angle1);
- GLdouble y6 = 0.20 * cos(angle1);
+ GLdouble x1 = 0.30 * sin(angle1);
+ GLdouble y1 = 0.30 * cos(angle1);
+ GLdouble x2 = 0.20 * sin(angle1);
+ GLdouble y2 = 0.20 * cos(angle1);
double angle2 = ((i + 1) * 2 * Pi) / NumSectors;
- GLdouble x7 = 0.20 * sin(angle2);
- GLdouble y7 = 0.20 * cos(angle2);
- GLdouble x8 = 0.30 * sin(angle2);
- GLdouble y8 = 0.30 * cos(angle2);
+ GLdouble x3 = 0.20 * sin(angle2);
+ GLdouble y3 = 0.20 * cos(angle2);
+ GLdouble x4 = 0.30 * sin(angle2);
+ GLdouble y4 = 0.30 * cos(angle2);
qglColor(trolltechGreen);
- quad(GL_QUADS, x5, y5, x6, y6, x7, y7, x8, y8);
+ quad(GL_QUADS, x1, y1, x2, y2, x3, y3, x4, y4);
qglColor(Qt::black);
- quad(GL_LINE_LOOP, x5, y5, x6, y6, x7, y7, x8, y8);
+ quad(GL_LINE_LOOP, x1, y1, x2, y2, x3, y3, x4, y4);
}
-
- qglColor(trolltechGreen);
- quad(GL_QUADS, x1, y1, x2, y2, y2, x2, y1, x1);
- quad(GL_QUADS, x3, y3, x4, y4, y4, x4, y3, x3);
-
- qglColor(Qt::black);
- quad(GL_LINE_LOOP, x1, y1, x2, y2, y2, x2, y1, x1);
- quad(GL_LINE_LOOP, x3, y3, x4, y4, y4, x4, y3, x3);
}
glEndList();
}
diff --git a/examples/opengl/samplebuffers/samplebuffers.pro b/examples/opengl/samplebuffers/samplebuffers.pro
index 9eb5f58..de09a71 100644
--- a/examples/opengl/samplebuffers/samplebuffers.pro
+++ b/examples/opengl/samplebuffers/samplebuffers.pro
@@ -8,3 +8,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/opengl/samplebuffers
sources.files = $$SOURCES $$HEADERS samplebuffers.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/samplebuffers
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
diff --git a/examples/opengl/textures/textures.pro b/examples/opengl/textures/textures.pro
index cd98a68..086c9ac 100644
--- a/examples/opengl/textures/textures.pro
+++ b/examples/opengl/textures/textures.pro
@@ -11,3 +11,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/opengl/textures
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS textures.pro images
sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/textures
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)