purge vestiges of opengl es 1 support
amends 0d5170256c
.
Change-Id: Ifa178d38f602bb7c66ef13334673ff47e332af5b
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
This commit is contained in:
parent
7d4bc536a2
commit
a4ec90175c
@ -1,51 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the config.tests of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <GLES/egl.h>
|
||||
|
||||
int main(int, char **)
|
||||
{
|
||||
EGLint x = 0;
|
||||
EGLDisplay dpy = 0;
|
||||
EGLContext ctx = 0;
|
||||
eglDestroyContext(dpy, ctx);
|
||||
return 0;
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
SOURCES = egl4gles1.cpp
|
||||
|
||||
for(p, QMAKE_LIBDIR_EGL) {
|
||||
exists($$p):LIBS += -L$$p
|
||||
}
|
||||
|
||||
!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL
|
||||
!isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL
|
||||
|
||||
CONFIG -= qt
|
@ -1,55 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the config.tests of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef BUILD_ON_MAC
|
||||
#include <OpenGLES/ES1/gl.h>
|
||||
#else
|
||||
#include <GLES/gl.h>
|
||||
#endif
|
||||
|
||||
int main(int, char **)
|
||||
{
|
||||
GLfloat a = 1.0f;
|
||||
glColor4f(a, a, a, a);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
SOURCES = opengles1.cpp
|
||||
INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES1
|
||||
|
||||
for(p, QMAKE_LIBDIR_OPENGL_ES1) {
|
||||
exists($$p):LIBS += -L$$p
|
||||
}
|
||||
|
||||
CONFIG -= qt
|
||||
LIBS += $$QMAKE_LIBS_OPENGL_ES1
|
||||
mac {
|
||||
DEFINES += BUILD_ON_MAC
|
||||
}
|
@ -5,6 +5,6 @@ CONFIG += no_docs_target
|
||||
|
||||
SUBDIRS += analogclock
|
||||
SUBDIRS += rasterwindow
|
||||
contains(QT_CONFIG, opengl(es1|es2)?) {
|
||||
contains(QT_CONFIG, opengl(es2)?) {
|
||||
SUBDIRS += openglwindow
|
||||
}
|
||||
|
@ -1,320 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
|
||||
** of its contributors may be used to endorse or promote products derived
|
||||
** from this software without specific prior written permission.
|
||||
**
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "glwindow.h"
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QScreen>
|
||||
#include <QTimer>
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
inline void CrossProduct(qreal &xOut, qreal &yOut, qreal &zOut, qreal x1, qreal y1, qreal z1, qreal x2, qreal y2, qreal z2)
|
||||
{
|
||||
xOut = y1 * z2 - z1 * y2;
|
||||
yOut = z1 * x2 - x1 * z2;
|
||||
zOut = x1 * y2 - y1 * x2;
|
||||
}
|
||||
|
||||
inline void Normalize(qreal &x, qreal &y, qreal &z)
|
||||
{
|
||||
qreal l = sqrt(x*x + y*y + z*z);
|
||||
x = x / l;
|
||||
y = y / l;
|
||||
z = z / l;
|
||||
}
|
||||
|
||||
GLWindow::GLWindow()
|
||||
{
|
||||
setSurfaceType(OpenGLSurface);
|
||||
|
||||
qtLogo = true;
|
||||
createdVertices = 0;
|
||||
createdNormals = 0;
|
||||
m_vertexNumber = 0;
|
||||
frames = 0;
|
||||
|
||||
m_fScale = 1;
|
||||
|
||||
QSurfaceFormat format;
|
||||
format.setDepthBufferSize(24);
|
||||
format.setMajorVersion(1);
|
||||
format.setMinorVersion(1);
|
||||
|
||||
setGeometry(QGuiApplication::primaryScreen()->availableGeometry());
|
||||
setFormat(format);
|
||||
create();
|
||||
|
||||
m_context = new QOpenGLContext;
|
||||
m_context->setFormat(format);
|
||||
m_context->create();
|
||||
|
||||
m_context->makeCurrent(this);
|
||||
initializeGL();
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->setInterval(16);
|
||||
connect(timer, SIGNAL(timeout()), this, SLOT(paintGL()));
|
||||
timer->start();
|
||||
}
|
||||
|
||||
GLWindow::~GLWindow()
|
||||
{
|
||||
if (createdVertices)
|
||||
delete[] createdVertices;
|
||||
if (createdNormals)
|
||||
delete[] createdNormals;
|
||||
|
||||
delete m_context;
|
||||
}
|
||||
|
||||
void GLWindow::paintQtLogo()
|
||||
{
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glVertexPointer(3,GL_FLOAT,0, createdVertices);
|
||||
glEnableClientState(GL_NORMAL_ARRAY);
|
||||
glNormalPointer(GL_FLOAT,0,createdNormals);
|
||||
glDrawArrays(GL_TRIANGLES, 0, m_vertexNumber / 3);
|
||||
}
|
||||
|
||||
void GLWindow::initializeGL ()
|
||||
{
|
||||
glClearColor(0.1f, 0.1f, 0.2f, 1.0f);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
|
||||
GLfloat aLightPosition[] = {0.0f,0.3f,1.0f,0.0f};
|
||||
|
||||
glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, aLightPosition);
|
||||
m_fAngle = 0;
|
||||
m_fScale = 1;
|
||||
createGeometry();
|
||||
}
|
||||
|
||||
void GLWindow::paintGL()
|
||||
{
|
||||
m_context->makeCurrent(this);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glPushMatrix();
|
||||
|
||||
//Since OpenGL ES does not support glPush/PopAttrib(GL_ALL_ATTRIB_BITS)
|
||||
//we have to take care of the states ourselves
|
||||
|
||||
glClearColor(0.1f, 0.1f, 0.2f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
|
||||
glShadeModel(GL_FLAT);
|
||||
glFrontFace(GL_CW);
|
||||
glCullFace(GL_FRONT);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
glRotatef(m_fAngle, 0.0f, 1.0f, 0.0f);
|
||||
glRotatef(m_fAngle, 1.0f, 0.0f, 0.0f);
|
||||
glRotatef(m_fAngle, 0.0f, 0.0f, 1.0f);
|
||||
glScalef(m_fScale, m_fScale,m_fScale);
|
||||
glTranslatef(0.0f,-0.2f,0.0f);
|
||||
|
||||
GLfloat matDiff[] = {0.40f, 1.0f, 0.0f, 1.0f};
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, matDiff);
|
||||
|
||||
paintQtLogo();
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glPopMatrix();
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_LIGHT0);
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
m_context->swapBuffers(this);
|
||||
|
||||
m_fAngle += 1.0f;
|
||||
}
|
||||
|
||||
void GLWindow::createGeometry()
|
||||
{
|
||||
vertices.clear();
|
||||
normals.clear();
|
||||
|
||||
qreal x1 = +0.06f;
|
||||
qreal y1 = -0.14f;
|
||||
qreal x2 = +0.14f;
|
||||
qreal y2 = -0.06f;
|
||||
qreal x3 = +0.08f;
|
||||
qreal y3 = +0.00f;
|
||||
qreal x4 = +0.30f;
|
||||
qreal y4 = +0.22f;
|
||||
|
||||
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 qreal Pi = 3.14159f;
|
||||
const int NumSectors = 100;
|
||||
|
||||
for (int i = 0; i < NumSectors; ++i) {
|
||||
qreal angle1 = (i * 2 * Pi) / NumSectors;
|
||||
qreal x5 = 0.30 * sin(angle1);
|
||||
qreal y5 = 0.30 * cos(angle1);
|
||||
qreal x6 = 0.20 * sin(angle1);
|
||||
qreal y6 = 0.20 * cos(angle1);
|
||||
|
||||
qreal angle2 = ((i + 1) * 2 * Pi) / NumSectors;
|
||||
qreal x7 = 0.20 * sin(angle2);
|
||||
qreal y7 = 0.20 * cos(angle2);
|
||||
qreal x8 = 0.30 * sin(angle2);
|
||||
qreal y8 = 0.30 * cos(angle2);
|
||||
|
||||
quad(x5, y5, x6, y6, x7, y7, x8, y8);
|
||||
|
||||
extrude(x6, y6, x7, y7);
|
||||
extrude(x8, y8, x5, y5);
|
||||
}
|
||||
|
||||
m_vertexNumber = vertices.size();
|
||||
createdVertices = new GLfloat[m_vertexNumber];
|
||||
createdNormals = new GLfloat[m_vertexNumber];
|
||||
for (int i = 0;i < m_vertexNumber;i++) {
|
||||
createdVertices[i] = vertices.at(i) * 2;
|
||||
createdNormals[i] = normals.at(i);
|
||||
}
|
||||
vertices.clear();
|
||||
normals.clear();
|
||||
}
|
||||
|
||||
void GLWindow::quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4)
|
||||
{
|
||||
qreal nx, ny, nz;
|
||||
|
||||
vertices << x1 << y1 << -0.05f;
|
||||
vertices << x2 << y2 << -0.05f;
|
||||
vertices << x4 << y4 << -0.05f;
|
||||
|
||||
vertices << x3 << y3 << -0.05f;
|
||||
vertices << x4 << y4 << -0.05f;
|
||||
vertices << x2 << y2 << -0.05f;
|
||||
|
||||
CrossProduct(nx, ny, nz, x2 - x1, y2 - y1, 0, x4 - x1, y4 - y1, 0);
|
||||
Normalize(nx, ny, nz);
|
||||
|
||||
normals << nx << ny << nz;
|
||||
normals << nx << ny << nz;
|
||||
normals << nx << ny << nz;
|
||||
|
||||
normals << nx << ny << nz;
|
||||
normals << nx << ny << nz;
|
||||
normals << nx << ny << nz;
|
||||
|
||||
vertices << x4 << y4 << 0.05f;
|
||||
vertices << x2 << y2 << 0.05f;
|
||||
vertices << x1 << y1 << 0.05f;
|
||||
|
||||
vertices << x2 << y2 << 0.05f;
|
||||
vertices << x4 << y4 << 0.05f;
|
||||
vertices << x3 << y3 << 0.05f;
|
||||
|
||||
CrossProduct(nx, ny, nz, x2 - x4, y2 - y4, 0, x1 - x4, y1 - y4, 0);
|
||||
Normalize(nx, ny, nz);
|
||||
|
||||
normals << nx << ny << nz;
|
||||
normals << nx << ny << nz;
|
||||
normals << nx << ny << nz;
|
||||
|
||||
normals << nx << ny << nz;
|
||||
normals << nx << ny << nz;
|
||||
normals << nx << ny << nz;
|
||||
}
|
||||
|
||||
void GLWindow::extrude(qreal x1, qreal y1, qreal x2, qreal y2)
|
||||
{
|
||||
qreal nx, ny, nz;
|
||||
|
||||
vertices << x1 << y1 << +0.05f;
|
||||
vertices << x2 << y2 << +0.05f;
|
||||
vertices << x1 << y1 << -0.05f;
|
||||
|
||||
vertices << x2 << y2 << -0.05f;
|
||||
vertices << x1 << y1 << -0.05f;
|
||||
vertices << x2 << y2 << +0.05f;
|
||||
|
||||
CrossProduct(nx, ny, nz, x2 - x1, y2 - y1, 0.0f, 0.0f, 0.0f, -0.1f);
|
||||
Normalize(nx, ny, nz);
|
||||
|
||||
normals << nx << ny << nz;
|
||||
normals << nx << ny << nz;
|
||||
normals << nx << ny << nz;
|
||||
|
||||
normals << nx << ny << nz;
|
||||
normals << nx << ny << nz;
|
||||
normals << nx << ny << nz;
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
|
||||
** of its contributors may be used to endorse or promote products derived
|
||||
** from this software without specific prior written permission.
|
||||
**
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef GLWINDOW_H
|
||||
#define GLWINDOW_H
|
||||
|
||||
#include <GLES/gl.h>
|
||||
|
||||
#include <QOpenGLContext>
|
||||
#include <QWindow>
|
||||
#include <QTime>
|
||||
|
||||
class GLWindow : public QWindow {
|
||||
Q_OBJECT
|
||||
public:
|
||||
GLWindow();
|
||||
~GLWindow();
|
||||
|
||||
protected slots:
|
||||
void paintGL();
|
||||
void initializeGL();
|
||||
|
||||
private:
|
||||
qreal m_fAngle;
|
||||
qreal m_fScale;
|
||||
QOpenGLContext *m_context;
|
||||
void paintQtLogo();
|
||||
void createGeometry();
|
||||
void quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4);
|
||||
void extrude(qreal x1, qreal y1, qreal x2, qreal y2);
|
||||
QList<qreal> vertices;
|
||||
QList<qreal> normals;
|
||||
GLfloat *createdVertices;
|
||||
GLfloat *createdNormals;
|
||||
int m_vertexNumber;
|
||||
bool qtLogo;
|
||||
int frames;
|
||||
QTime time;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,11 +0,0 @@
|
||||
QT += gui
|
||||
|
||||
SOURCES += main.cpp
|
||||
SOURCES += glwindow.cpp
|
||||
|
||||
HEADERS += glwindow.h
|
||||
|
||||
RESOURCES += texture.qrc
|
||||
|
||||
target.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl_es
|
||||
INSTALLS += target
|
@ -1,52 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
|
||||
** of its contributors may be used to endorse or promote products derived
|
||||
** from this software without specific prior written permission.
|
||||
**
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QGuiApplication>
|
||||
|
||||
#include "glwindow.h"
|
||||
|
||||
int main( int argc, char ** argv )
|
||||
{
|
||||
Q_INIT_RESOURCE(texture);
|
||||
QGuiApplication a( argc, argv );
|
||||
GLWindow window;
|
||||
window.show();
|
||||
return a.exec();
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 5.1 KiB |
@ -1,5 +0,0 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>qt.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -2,16 +2,8 @@ requires(qtHaveModule(opengl))
|
||||
|
||||
TEMPLATE = subdirs
|
||||
|
||||
contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2){
|
||||
contains(QT_CONFIG, opengles2) {
|
||||
SUBDIRS = hellogl_es2
|
||||
} else {
|
||||
SUBDIRS = hellogl_es
|
||||
}
|
||||
SUBDIRS += textures
|
||||
contains(QT_CONFIG, opengles1) {
|
||||
SUBDIRS += hellogl
|
||||
}
|
||||
contains(QT_CONFIG, opengles2) {
|
||||
SUBDIRS = hellogl_es2
|
||||
} else {
|
||||
SUBDIRS = 2dpainting \
|
||||
grabber \
|
||||
@ -19,13 +11,13 @@ contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2){
|
||||
overpainting \
|
||||
pbuffers \
|
||||
framebufferobject2 \
|
||||
samplebuffers \
|
||||
textures
|
||||
samplebuffers
|
||||
}
|
||||
|
||||
SUBDIRS += hellowindow \
|
||||
paintedwindow \
|
||||
contextinfo \
|
||||
cube
|
||||
cube \
|
||||
textures
|
||||
|
||||
EXAMPLE_FILES = shared
|
||||
|
@ -1,6 +1,6 @@
|
||||
INCLUDEPATH += $$PWD
|
||||
|
||||
qtHaveModule(opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2) {
|
||||
qtHaveModule(opengl)|contains(QT_CONFIG, opengles2) {
|
||||
DEFINES += QT_OPENGL_SUPPORT
|
||||
QT += opengl widgets
|
||||
}
|
||||
|
@ -22,11 +22,11 @@ SUBDIRS = \
|
||||
tutorials \
|
||||
widgets
|
||||
|
||||
contains(QT_CONFIG, opengl(es1|es2)?) {
|
||||
contains(QT_CONFIG, opengl(es2)?) {
|
||||
SUBDIRS += windowcontainer
|
||||
}
|
||||
|
||||
!contains(QT_CONFIG, opengl(es1|es2)?): SUBDIRS -= windowcontainer
|
||||
!contains(QT_CONFIG, opengl(es2)?): SUBDIRS -= windowcontainer
|
||||
contains(DEFINES, QT_NO_CURSOR): SUBDIRS -= mainwindows
|
||||
contains(DEFINES, QT_NO_DRAGANDDROP): SUBDIRS -= draganddrop
|
||||
mac:SUBDIRS += mac
|
||||
|
@ -186,7 +186,6 @@ QMAKE_LIBS_X11 =
|
||||
QMAKE_LIBS_THREAD =
|
||||
QMAKE_LIBS_EGL = -lEGL
|
||||
QMAKE_LIBS_OPENGL =
|
||||
QMAKE_LIBS_OPENGL_ES1 = -lGLESv1_CM
|
||||
QMAKE_LIBS_OPENGL_ES2 = -lGLESv2
|
||||
|
||||
!exists($$NDK_ROOT): error("You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.")
|
||||
|
@ -15,11 +15,6 @@ QMAKE_RANLIB = ranlib -s
|
||||
QMAKE_LINK = $$QMAKE_CXX
|
||||
QMAKE_LINK_SHLIB = $$QMAKE_CXX
|
||||
|
||||
# No OpenGL ES1
|
||||
QMAKE_INCDIR_OPENGL_ES1 =
|
||||
QMAKE_LIBDIR_OPENGL_ES1 =
|
||||
QMAKE_LIBS_OPENGL_ES1 =
|
||||
|
||||
# OpenGL ES2
|
||||
QMAKE_INCDIR_OPENGL_ES2 =
|
||||
QMAKE_LIBDIR_OPENGL_ES2 =
|
||||
|
@ -74,8 +74,6 @@ QMAKE_LIBDIR = $$ANDROID_SOURCES_CXX_STL_LIBDIR $$ANDROID_PLATFORM_PA
|
||||
QMAKE_INCDIR_X11 =
|
||||
QMAKE_LIBDIR_X11 =
|
||||
QMAKE_INCDIR_OPENGL =
|
||||
QMAKE_INCDIR_OPENGL_ES1 =
|
||||
QMAKE_LIBDIR_OPENGL_ES1 =
|
||||
QMAKE_INCDIR_OPENGL_ES2 =
|
||||
QMAKE_LIBDIR_OPENGL_ES2 =
|
||||
|
||||
@ -110,7 +108,6 @@ QMAKE_LIBS_QT_OPENGL =
|
||||
QMAKE_LIBS_QTOPIA =
|
||||
QMAKE_LIBS_THREAD =
|
||||
QMAKE_LIBS_OPENGL =
|
||||
QMAKE_LIBS_OPENGL_ES1 = -lGLESv1_CM
|
||||
QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 $$QMAKE_LIBS
|
||||
|
||||
load(qt_config)
|
||||
|
@ -13,8 +13,6 @@ QMAKE_INCDIR_X11 =
|
||||
QMAKE_LIBDIR_X11 =
|
||||
QMAKE_INCDIR_OPENGL =
|
||||
QMAKE_LIBDIR_OPENGL =
|
||||
QMAKE_INCDIR_OPENGL_ES1 = $$QMAKE_INCDIR_OPENGL
|
||||
QMAKE_LIBDIR_OPENGL_ES1 = $$QMAKE_LIBDIR_OPENGL
|
||||
QMAKE_INCDIR_OPENGL_ES2 = $$QMAKE_INCDIR_OPENGL
|
||||
QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_OPENGL
|
||||
QMAKE_INCDIR_EGL =
|
||||
@ -28,7 +26,6 @@ QMAKE_LIBS_X11 = -lXext -lX11 -lm
|
||||
QMAKE_LIBS_NIS = -lnsl
|
||||
QMAKE_LIBS_EGL = -lEGL
|
||||
QMAKE_LIBS_OPENGL = -lGL
|
||||
QMAKE_LIBS_OPENGL_ES1 = -lGLESv1_CM
|
||||
QMAKE_LIBS_OPENGL_ES2 = -lGLESv2
|
||||
QMAKE_LIBS_OPENVG = -lOpenVG
|
||||
QMAKE_LIBS_THREAD = -lpthread
|
||||
|
@ -29,7 +29,6 @@ QMAKE_LIBS = -lm
|
||||
QMAKE_LIBS_NETWORK = -lsocket
|
||||
|
||||
# OpenGL libraries have a dependency on libEGL
|
||||
QMAKE_LIBS_OPENGL_ES1 = -lGLES_CM -lEGL
|
||||
QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 -lEGL
|
||||
QMAKE_LIBS_EGL = -lEGL
|
||||
|
||||
|
@ -65,7 +65,6 @@ QMAKE_LIBS_COMPAT =
|
||||
QMAKE_EXTENSION_STATICLIB = lib
|
||||
|
||||
QMAKE_LIBS_EGL = libEGL.lib
|
||||
QMAKE_LIBS_OPENGL_ES1 = libGLES_CM.lib
|
||||
QMAKE_LIBS_OPENGL_ES2 = libGLESv2.lib
|
||||
|
||||
QMAKE_LIBS_QT_ENTRY = -lqtmain
|
||||
|
@ -1,23 +1,8 @@
|
||||
# On UNIX, we can use config tests to figure out if egl.h is in
|
||||
# EGL/egl.h or GLES/egl.h. Sadly, there are no config tests on WinCE
|
||||
# so we have to assume that for GLES 1.1 (CL), the EGL header is in
|
||||
# GLES/egl.h. We also assume there is no separate libEGL.lib library,
|
||||
# so we use the GL library instead.
|
||||
|
||||
wince*:contains(QT_CONFIG, opengles1) {
|
||||
INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES1
|
||||
LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES1
|
||||
for(p, QMAKE_LIBDIR_OPENGL_ES1) {
|
||||
exists($$p):LIBS_PRIVATE += -L$$p
|
||||
}
|
||||
DEFINES += QT_GLES_EGL
|
||||
} else {
|
||||
INCLUDEPATH += $$QMAKE_INCDIR_EGL
|
||||
LIBS_PRIVATE += $$QMAKE_LIBS_EGL
|
||||
QMAKE_CFLAGS += $$QMAKE_CFLAGS_EGL
|
||||
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_EGL
|
||||
LIBS += $$QMAKE_LFLAGS_EGL
|
||||
for(p, QMAKE_LIBDIR_EGL) {
|
||||
exists($$p):LIBS_PRIVATE += -L$$p
|
||||
}
|
||||
INCLUDEPATH += $$QMAKE_INCDIR_EGL
|
||||
LIBS_PRIVATE += $$QMAKE_LIBS_EGL
|
||||
QMAKE_CFLAGS += $$QMAKE_CFLAGS_EGL
|
||||
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_EGL
|
||||
LIBS += $$QMAKE_LFLAGS_EGL
|
||||
for(p, QMAKE_LIBDIR_EGL) {
|
||||
exists($$p): LIBS_PRIVATE += -L$$p
|
||||
}
|
||||
|
@ -1,2 +0,0 @@
|
||||
QMAKE_LIBS_OPENGL_ES2 =
|
||||
LIBS += $$QMAKE_LIBS_OPENGL_ES1
|
@ -1,9 +1,4 @@
|
||||
contains(QT_CONFIG, opengles1) {
|
||||
INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES1
|
||||
!isEmpty(QMAKE_LIBDIR_OPENGL_ES1):QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES1
|
||||
target_qt:LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES1
|
||||
else:LIBS += $$QMAKE_LIBS_OPENGL_ES1
|
||||
} else:contains(QT_CONFIG, opengles2) {
|
||||
contains(QT_CONFIG, opengles2) {
|
||||
INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2
|
||||
!isEmpty(QMAKE_LIBDIR_OPENGL_ES2):QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES2
|
||||
target_qt:LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES2
|
||||
|
@ -16,8 +16,6 @@ QMAKE_INCDIR_X11 = /usr/X11R6/include
|
||||
QMAKE_LIBDIR_X11 = /usr/X11R6/lib
|
||||
QMAKE_INCDIR_OPENGL = /usr/X11R6/include
|
||||
QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib
|
||||
QMAKE_INCDIR_OPENGL_ES1 = $$QMAKE_INCDIR_OPENGL
|
||||
QMAKE_LIBDIR_OPENGL_ES1 = $$QMAKE_LIBDIR_OPENGL
|
||||
QMAKE_INCDIR_OPENGL_ES2 = $$QMAKE_INCDIR_OPENGL
|
||||
QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_OPENGL
|
||||
QMAKE_INCDIR_EGL =
|
||||
@ -31,7 +29,6 @@ QMAKE_LIBS_X11 = -lXext -lX11 -lm
|
||||
QMAKE_LIBS_NIS = -lnsl
|
||||
QMAKE_LIBS_EGL = -lEGL
|
||||
QMAKE_LIBS_OPENGL = -lGL
|
||||
QMAKE_LIBS_OPENGL_ES1 = -lGLES_CM
|
||||
QMAKE_LIBS_OPENGL_ES2 = -lGLESv2
|
||||
QMAKE_LIBS_OPENVG = -lOpenVG
|
||||
QMAKE_LIBS_THREAD = -lpthread
|
||||
|
@ -130,8 +130,6 @@ QMAKE_LIBDIR = ${ANDROID_PRODUCT_OUT}/obj/lib
|
||||
QMAKE_INCDIR_X11 =
|
||||
QMAKE_LIBDIR_X11 =
|
||||
QMAKE_INCDIR_OPENGL =
|
||||
QMAKE_INCDIR_OPENGL_ES1 =
|
||||
QMAKE_LIBDIR_OPENGL_ES1 =
|
||||
QMAKE_INCDIR_OPENGL_ES2 =
|
||||
QMAKE_LIBDIR_OPENGL_ES2 =
|
||||
|
||||
@ -172,7 +170,6 @@ QMAKE_LIBS_QT_OPENGL =
|
||||
QMAKE_LIBS_QTOPIA =
|
||||
QMAKE_LIBS_THREAD =
|
||||
QMAKE_LIBS_OPENGL =
|
||||
QMAKE_LIBS_OPENGL_ES1 = -lGLESv1_CM
|
||||
QMAKE_LIBS_OPENGL_ES2 = -lEGL -lGLESv2 $$QMAKE_LIBS
|
||||
|
||||
CONFIG += linux-android-9 android-9 linux-android android android-no-sdk android_app
|
||||
|
@ -85,8 +85,6 @@ QMAKE_INCDIR_X11 =
|
||||
QMAKE_LIBDIR_X11 =
|
||||
QMAKE_INCDIR_OPENGL =
|
||||
QMAKE_LIBDIR_OPENGL =
|
||||
QMAKE_INCDIR_OPENGL_ES1 = $$QMAKE_INCDIR_OPENGL
|
||||
QMAKE_LIBDIR_OPENGL_ES1 = $$QMAKE_LIBDIR_OPENGL
|
||||
QMAKE_INCDIR_OPENGL_ES2 = $$QMAKE_INCDIR_OPENGL
|
||||
QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_OPENGL
|
||||
QMAKE_INCDIR_EGL =
|
||||
@ -100,7 +98,6 @@ QMAKE_LIBS_X11 = -lXext -lX11 -lm
|
||||
QMAKE_LIBS_NIS = -lnsl
|
||||
QMAKE_LIBS_EGL = -lEGL
|
||||
QMAKE_LIBS_OPENGL = -lGL
|
||||
QMAKE_LIBS_OPENGL_ES1 = -lGLES_CM
|
||||
QMAKE_LIBS_OPENGL_ES2 = -lGLESv2
|
||||
QMAKE_LIBS_OPENVG = -lOpenVG
|
||||
QMAKE_LIBS_THREAD = -lpthread
|
||||
|
@ -1696,11 +1696,10 @@
|
||||
If the OpenGL implementation uses EGL (most OpenGL/ES systems),
|
||||
then QMAKE_INCDIR_EGL may also need to be set.
|
||||
|
||||
\section1 QMAKE_INCDIR_OPENGL_ES1, QMAKE_INCDIR_OPENGL_ES2
|
||||
\section1 QMAKE_INCDIR_OPENGL_ES2
|
||||
|
||||
These variables specify the location of OpenGL headers files to be added
|
||||
to \l{INCLUDEPATH} when building a target with OpenGL ES 1
|
||||
or OpenGL ES 2 support respectively.
|
||||
This variable specifies the location of OpenGL header files to be added
|
||||
to \l{INCLUDEPATH} when building a target with OpenGL ES 2 support.
|
||||
|
||||
The value of this variable is typically handled by qmake or
|
||||
\l{#QMAKESPEC}{qmake.conf} and rarely
|
||||
|
@ -67,14 +67,7 @@ contains(QT_CONFIG, angle) {
|
||||
!isEmpty(QMAKE_LIBDIR_EGL): CMAKE_EGL_LIBDIR += $$cmakeTargetPath($$QMAKE_LIBDIR_EGL)
|
||||
}
|
||||
|
||||
contains(QT_CONFIG, opengles1) {
|
||||
!isEmpty(QMAKE_INCDIR_OPENGL_ES1): CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL_ES1)
|
||||
CMAKE_OPENGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_OPENGL_ES1)
|
||||
CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL_ES1)
|
||||
!isEmpty(QMAKE_LIBDIR_OPENGL_ES1): CMAKE_OPENGL_LIBDIR = $$cmakePortablePaths($$QMAKE_LIBDIR_OPENGL_ES1)
|
||||
CMAKE_GL_HEADER_NAME = GLES/gl.h
|
||||
CMAKE_QT_OPENGL_IMPLEMENTATION = GLES
|
||||
} else:contains(QT_CONFIG, opengles2) {
|
||||
contains(QT_CONFIG, opengles2) {
|
||||
!isEmpty(QMAKE_INCDIR_OPENGL_ES2): CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL_ES2)
|
||||
CMAKE_OPENGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_OPENGL_ES2)
|
||||
CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL_ES2)
|
||||
|
@ -1030,7 +1030,6 @@ void *QOpenGLContext::openGLModuleHandle()
|
||||
|
||||
\value DesktopGL Desktop OpenGL
|
||||
\value GLES2 OpenGL ES 2.0 or higher
|
||||
\value GLES1 OpenGL ES 1.x
|
||||
|
||||
\since 5.3
|
||||
*/
|
||||
@ -1058,8 +1057,6 @@ QOpenGLContext::OpenGLModuleType QOpenGLContext::openGLModuleType()
|
||||
return QGuiApplicationPrivate::instance()->platformIntegration()->openGLModuleType();
|
||||
#elif defined(QT_OPENGL_ES_2)
|
||||
return GLES2;
|
||||
#elif defined(QT_OPENGL_ES)
|
||||
return GLES1;
|
||||
#else
|
||||
return DesktopGL;
|
||||
#endif
|
||||
|
@ -196,8 +196,7 @@ public:
|
||||
|
||||
enum OpenGLModuleType {
|
||||
DesktopGL,
|
||||
GLES2,
|
||||
GLES1
|
||||
GLES2
|
||||
};
|
||||
|
||||
static OpenGLModuleType openGLModuleType();
|
||||
|
@ -333,20 +333,18 @@ void QOpenGLBuffer::destroy()
|
||||
bool QOpenGLBuffer::read(int offset, void *data, int count)
|
||||
{
|
||||
#if !defined(QT_OPENGL_ES)
|
||||
if (QOpenGLContext::openGLModuleType() != QOpenGLContext::GLES1) {
|
||||
Q_D(QOpenGLBuffer);
|
||||
if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id())
|
||||
return false;
|
||||
while (d->funcs->glGetError() != GL_NO_ERROR) ; // Clear error state.
|
||||
d->funcs->glGetBufferSubData(d->type, offset, count, data);
|
||||
return d->funcs->glGetError() == GL_NO_ERROR;
|
||||
}
|
||||
Q_D(QOpenGLBuffer);
|
||||
if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id())
|
||||
return false;
|
||||
while (d->funcs->glGetError() != GL_NO_ERROR) ; // Clear error state.
|
||||
d->funcs->glGetBufferSubData(d->type, offset, count, data);
|
||||
return d->funcs->glGetError() == GL_NO_ERROR;
|
||||
#else
|
||||
Q_UNUSED(offset);
|
||||
Q_UNUSED(data);
|
||||
Q_UNUSED(count);
|
||||
#endif
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -256,7 +256,7 @@ QOpenGLExtensions::QOpenGLExtensions(QOpenGLContext *context)
|
||||
static int qt_gl_resolve_features()
|
||||
{
|
||||
QOpenGLContext *ctx = QOpenGLContext::currentContext();
|
||||
if (ctx->isES() && QOpenGLContext::openGLModuleType() != QOpenGLContext::GLES1) {
|
||||
if (ctx->isES()) {
|
||||
// OpenGL ES 2
|
||||
int features = QOpenGLFunctions::Multitexture |
|
||||
QOpenGLFunctions::Shaders |
|
||||
@ -277,26 +277,6 @@ static int qt_gl_resolve_features()
|
||||
features |= QOpenGLFunctions::NPOTTextures |
|
||||
QOpenGLFunctions::NPOTTextureRepeat;
|
||||
return features;
|
||||
} else if (ctx->isES()) {
|
||||
// OpenGL ES 1
|
||||
int features = QOpenGLFunctions::Multitexture |
|
||||
QOpenGLFunctions::Buffers |
|
||||
QOpenGLFunctions::CompressedTextures |
|
||||
QOpenGLFunctions::Multisample;
|
||||
QOpenGLExtensionMatcher extensions;
|
||||
if (extensions.match("GL_OES_framebuffer_object"))
|
||||
features |= QOpenGLFunctions::Framebuffers;
|
||||
if (extensions.match("GL_OES_blend_equation_separate"))
|
||||
features |= QOpenGLFunctions::BlendEquationSeparate;
|
||||
if (extensions.match("GL_OES_blend_func_separate"))
|
||||
features |= QOpenGLFunctions::BlendFuncSeparate;
|
||||
if (extensions.match("GL_OES_blend_subtract"))
|
||||
features |= QOpenGLFunctions::BlendSubtract;
|
||||
if (extensions.match("GL_OES_texture_npot"))
|
||||
features |= QOpenGLFunctions::NPOTTextures;
|
||||
if (extensions.match("GL_IMG_texture_npot"))
|
||||
features |= QOpenGLFunctions::NPOTTextures;
|
||||
return features;
|
||||
} else {
|
||||
// OpenGL
|
||||
int features = 0;
|
||||
|
@ -11,7 +11,6 @@ QMAKE_DOCS = $$PWD/doc/qtopengl.qdocconf
|
||||
load(qt_module)
|
||||
|
||||
contains(QT_CONFIG, opengl):CONFIG += opengl
|
||||
contains(QT_CONFIG, opengles1):CONFIG += opengles1
|
||||
contains(QT_CONFIG, opengles2):CONFIG += opengles2
|
||||
contains(QT_CONFIG, egl):CONFIG += egl
|
||||
|
||||
|
@ -344,20 +344,18 @@ void QGLBuffer::destroy()
|
||||
bool QGLBuffer::read(int offset, void *data, int count)
|
||||
{
|
||||
#if !defined(QT_OPENGL_ES)
|
||||
if (QOpenGLContext::openGLModuleType() != QOpenGLContext::GLES1) {
|
||||
Q_D(QGLBuffer);
|
||||
if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id())
|
||||
return false;
|
||||
while (glGetError() != GL_NO_ERROR) ; // Clear error state.
|
||||
d->funcs->glGetBufferSubData(d->type, offset, count, data);
|
||||
return glGetError() == GL_NO_ERROR;
|
||||
}
|
||||
Q_D(QGLBuffer);
|
||||
if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id())
|
||||
return false;
|
||||
while (glGetError() != GL_NO_ERROR) ; // Clear error state.
|
||||
d->funcs->glGetBufferSubData(d->type, offset, count, data);
|
||||
return glGetError() == GL_NO_ERROR;
|
||||
#else
|
||||
Q_UNUSED(offset);
|
||||
Q_UNUSED(data);
|
||||
Q_UNUSED(count);
|
||||
#endif
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -223,7 +223,7 @@ QGLFunctions::QGLFunctions(const QGLContext *context)
|
||||
static int qt_gl_resolve_features()
|
||||
{
|
||||
QOpenGLContext *ctx = QOpenGLContext::currentContext();
|
||||
if (ctx->isES() && QOpenGLContext::openGLModuleType() != QOpenGLContext::GLES1) {
|
||||
if (ctx->isES()) {
|
||||
// OpenGL ES 2
|
||||
int features = QGLFunctions::Multitexture |
|
||||
QGLFunctions::Shaders |
|
||||
@ -243,26 +243,6 @@ static int qt_gl_resolve_features()
|
||||
if (extensions.match("GL_IMG_texture_npot"))
|
||||
features |= QGLFunctions::NPOTTextures;
|
||||
return features;
|
||||
} else if (ctx->isES()) {
|
||||
// OpenGL ES 1
|
||||
int features = QGLFunctions::Multitexture |
|
||||
QGLFunctions::Buffers |
|
||||
QGLFunctions::CompressedTextures |
|
||||
QGLFunctions::Multisample;
|
||||
QOpenGLExtensionMatcher extensions;
|
||||
if (extensions.match("GL_OES_framebuffer_object"))
|
||||
features |= QGLFunctions::Framebuffers;
|
||||
if (extensions.match("GL_OES_blend_equation_separate"))
|
||||
features |= QGLFunctions::BlendEquationSeparate;
|
||||
if (extensions.match("GL_OES_blend_func_separate"))
|
||||
features |= QGLFunctions::BlendFuncSeparate;
|
||||
if (extensions.match("GL_OES_blend_subtract"))
|
||||
features |= QGLFunctions::BlendSubtract;
|
||||
if (extensions.match("GL_OES_texture_npot"))
|
||||
features |= QGLFunctions::NPOTTextures;
|
||||
if (extensions.match("GL_IMG_texture_npot"))
|
||||
features |= QGLFunctions::NPOTTextures;
|
||||
return features;
|
||||
} else {
|
||||
// OpenGL
|
||||
int features = 0;
|
||||
|
@ -2,7 +2,6 @@ TARGET = QtOpenGLExtensions
|
||||
CONFIG += static
|
||||
|
||||
contains(QT_CONFIG, opengl):CONFIG += opengl
|
||||
contains(QT_CONFIG, opengles1):CONFIG += opengles1
|
||||
contains(QT_CONFIG, opengles2):CONFIG += opengles2
|
||||
|
||||
load(qt_module)
|
||||
|
@ -142,13 +142,13 @@ contains(QT_CONFIG, concurrent):SUBDIRS += src_concurrent
|
||||
src_gui.depends += src_angle
|
||||
}
|
||||
SUBDIRS += src_gui src_platformsupport
|
||||
contains(QT_CONFIG, opengl(es1|es2)?):SUBDIRS += src_openglextensions
|
||||
contains(QT_CONFIG, opengl(es2)?):SUBDIRS += src_openglextensions
|
||||
src_plugins.depends += src_gui src_platformsupport
|
||||
!contains(QT_CONFIG, no-widgets) {
|
||||
SUBDIRS += src_tools_uic src_widgets
|
||||
TOOLS += src_tools_uic
|
||||
src_plugins.depends += src_widgets
|
||||
contains(QT_CONFIG, opengl(es1|es2)?):!contains(QT_CONFIG, dynamicgl) {
|
||||
contains(QT_CONFIG, opengl(es2)?):!contains(QT_CONFIG, dynamicgl) {
|
||||
SUBDIRS += src_opengl
|
||||
src_plugins.depends += src_opengl
|
||||
}
|
||||
|
@ -10,9 +10,7 @@ add_definitions(${Qt5Gui_DEFINITIONS})
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Gui_EXECUTABLE_COMPILE_FLAGS}")
|
||||
|
||||
if (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL GLES)
|
||||
add_definitions(-DGL_IMPLEMENTATION_GLES1)
|
||||
elseif (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL GLESv2)
|
||||
if (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL GLESv2)
|
||||
add_definitions(-DGL_IMPLEMENTATION_GLES2)
|
||||
elseif (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL GL)
|
||||
add_definitions(-DGL_IMPLEMENTATION_GL)
|
||||
|
@ -40,9 +40,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#if GL_IMPLEMENTATION_GLES1
|
||||
#include <GLES/gl.h>
|
||||
#elif GL_IMPLEMENTATION_GLES2
|
||||
#if GL_IMPLEMENTATION_GLES2
|
||||
#include <GLES2/gl2.h>
|
||||
#elif GL_IMPLEMENTATION_GL
|
||||
|
||||
|
@ -12,4 +12,4 @@ SUBDIRS = \
|
||||
util \
|
||||
itemmodels \
|
||||
|
||||
!contains(QT_CONFIG, opengl(es1|es2)?): SUBDIRS -= qopengl
|
||||
!contains(QT_CONFIG, opengl(es2)?): SUBDIRS -= qopengl
|
||||
|
@ -676,9 +676,6 @@ void Configure::parseCmdLine()
|
||||
else if (configCmdLine.at(i) == "-no-opengl") {
|
||||
dictionary[ "OPENGL" ] = "no";
|
||||
dictionary[ "OPENGL_ES_2" ] = "no";
|
||||
} else if (configCmdLine.at(i) == "-opengl-es-cm") {
|
||||
dictionary[ "OPENGL" ] = "yes";
|
||||
dictionary[ "OPENGL_ES_CM" ] = "yes";
|
||||
} else if (configCmdLine.at(i) == "-opengl-es-2") {
|
||||
dictionary[ "OPENGL" ] = "yes";
|
||||
dictionary[ "OPENGL_ES_2" ] = "yes";
|
||||
@ -689,9 +686,7 @@ void Configure::parseCmdLine()
|
||||
break;
|
||||
|
||||
dictionary[ "OPENGL_ES_2" ] = "no";
|
||||
if (configCmdLine.at(i) == "es1") {
|
||||
dictionary[ "OPENGL_ES_CM" ] = "yes";
|
||||
} else if ( configCmdLine.at(i) == "es2" ) {
|
||||
if ( configCmdLine.at(i) == "es2" ) {
|
||||
dictionary[ "OPENGL_ES_2" ] = "yes";
|
||||
} else if ( configCmdLine.at(i) == "desktop" ) {
|
||||
// OPENGL=yes suffices
|
||||
@ -1819,7 +1814,6 @@ bool Configure::displayHelp()
|
||||
"Available values for <api>:");
|
||||
desc("", "no", "", " desktop - Enable support for Desktop OpenGL", ' ');
|
||||
desc("", "no", "", " dynamic - Enable support for dynamically loaded OpenGL (either desktop or ES)", ' ');
|
||||
desc("OPENGL_ES_CM", "no", "", " es1 - Enable support for OpenGL ES Common Profile", ' ');
|
||||
desc("OPENGL_ES_2", "yes", "", " es2 - Enable support for OpenGL ES 2.0\n", ' ');
|
||||
|
||||
desc("OPENVG", "no","-no-openvg", "Disables OpenVG functionality.");
|
||||
@ -2213,8 +2207,6 @@ bool Configure::checkAvailability(const QString &part)
|
||||
available = findFile("ibase.h") && (findFile("gds32_ms.lib") || findFile("gds32.lib"));
|
||||
else if (part == "IWMMXT")
|
||||
available = (dictionary.value("XQMAKESPEC").startsWith("wince"));
|
||||
else if (part == "OPENGL_ES_CM")
|
||||
available = (dictionary.value("XQMAKESPEC").startsWith("wince"));
|
||||
else if (part == "OPENGL_ES_2")
|
||||
available = (dictionary.value("XQMAKESPEC").startsWith("wince"));
|
||||
else if (part == "SSE2")
|
||||
@ -2784,11 +2776,6 @@ void Configure::generateOutputVars()
|
||||
if (dictionary[ "OPENGL" ] == "yes")
|
||||
qtConfig += "opengl";
|
||||
|
||||
if (dictionary["OPENGL_ES_CM"] == "yes") {
|
||||
qtConfig += "opengles1";
|
||||
qtConfig += "egl";
|
||||
}
|
||||
|
||||
if (dictionary["OPENGL_ES_2"] == "yes") {
|
||||
qtConfig += "opengles2";
|
||||
qtConfig += "egl";
|
||||
@ -3500,10 +3487,7 @@ void Configure::generateConfigfiles()
|
||||
if (dictionary["HARFBUZZ"] == "no") qconfigList += "QT_NO_HARFBUZZ";
|
||||
if (dictionary["NATIVE_GESTURES"] == "no") qconfigList += "QT_NO_NATIVE_GESTURES";
|
||||
|
||||
if (dictionary["OPENGL_ES_CM"] == "yes" ||
|
||||
dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES";
|
||||
|
||||
if (dictionary["OPENGL_ES_CM"] == "yes") qconfigList += "QT_OPENGL_ES_1";
|
||||
if (dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES";
|
||||
if (dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES_2";
|
||||
if (dictionary["DYNAMICGL"] == "yes") qconfigList += "QT_OPENGL_DYNAMIC";
|
||||
if (dictionary["SQL_MYSQL"] == "yes") qconfigList += "QT_SQL_MYSQL";
|
||||
|
Loading…
Reference in New Issue
Block a user