diff options
-rw-r--r-- | examples/opengl/framebufferobject/bubbles.svg | 13 | ||||
-rw-r--r-- | examples/opengl/hellogl/glwidget.cpp | 52 | ||||
-rw-r--r-- | examples/opengl/pbuffers2/bubbles.svg | 13 | ||||
-rw-r--r-- | examples/opengl/samplebuffers/glwidget.cpp | 29 |
4 files changed, 79 insertions, 28 deletions
diff --git a/examples/opengl/framebufferobject/bubbles.svg b/examples/opengl/framebufferobject/bubbles.svg index 3d7971d..65867da 100644 --- a/examples/opengl/framebufferobject/bubbles.svg +++ b/examples/opengl/framebufferobject/bubbles.svg @@ -78,6 +78,10 @@ <!-- 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> @@ -176,6 +180,15 @@ </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/hellogl/glwidget.cpp b/examples/opengl/hellogl/glwidget.cpp index 86d5d8c..877e1ca 100644 --- a/examples/opengl/hellogl/glwidget.cpp +++ b/examples/opengl/hellogl/glwidget.cpp @@ -183,30 +183,46 @@ 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 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); + 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); - 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); + 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); - 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/pbuffers2/bubbles.svg b/examples/opengl/pbuffers2/bubbles.svg index 3d7971d..65867da 100644 --- a/examples/opengl/pbuffers2/bubbles.svg +++ b/examples/opengl/pbuffers2/bubbles.svg @@ -78,6 +78,10 @@ <!-- 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> @@ -176,6 +180,15 @@ </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/samplebuffers/glwidget.cpp b/examples/opengl/samplebuffers/glwidget.cpp index 95651b3..9a41f51 100644 --- a/examples/opengl/samplebuffers/glwidget.cpp +++ b/examples/opengl/samplebuffers/glwidget.cpp @@ -109,28 +109,37 @@ void GLWidget::makeObject() QColor qtGreen(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 x1 = 0.30 * sin(angle1); - GLdouble y1 = 0.30 * cos(angle1); - GLdouble x2 = 0.20 * sin(angle1); - GLdouble y2 = 0.20 * cos(angle1); + GLdouble x5 = 0.30 * sin(angle1); + GLdouble y5 = 0.30 * cos(angle1); + GLdouble x6 = 0.20 * sin(angle1); + GLdouble y6 = 0.20 * cos(angle1); double angle2 = ((i + 1) * 2 * Pi) / NumSectors; - GLdouble x3 = 0.20 * sin(angle2); - GLdouble y3 = 0.20 * cos(angle2); - GLdouble x4 = 0.30 * sin(angle2); - GLdouble y4 = 0.30 * cos(angle2); + GLdouble x7 = 0.20 * sin(angle2); + GLdouble y7 = 0.20 * cos(angle2); + GLdouble x8 = 0.30 * sin(angle2); + GLdouble y8 = 0.30 * cos(angle2); qglColor(qtGreen); - quad(GL_QUADS, x1, y1, x2, y2, x3, y3, x4, y4); + quad(GL_QUADS, x5, y5, x6, y6, x7, y7, x8, y8); qglColor(Qt::black); - quad(GL_LINE_LOOP, x1, y1, x2, y2, x3, y3, x4, y4); + quad(GL_LINE_LOOP, x5, y5, x6, y6, x7, y7, x8, y8); } + qglColor(qtGreen); quad(GL_QUADS, x1, y1, x2, y2, y2, x2, y1, x1); quad(GL_QUADS, x3, y3, x4, y4, y4, x4, y3, x3); |