mmtalaie
4 years ago
commit
2a7d7aaa66
8 changed files with 985 additions and 0 deletions
@ -0,0 +1,481 @@ |
|||
#include <QImageReader> |
|||
#include <QOpenGLFunctions> |
|||
#include <QOpenGLBuffer> |
|||
|
|||
#include "OpenGLHandler.h" |
|||
|
|||
OpenGLHandler::OpenGLHandler() : _texture(QOpenGLTexture::Target2D) |
|||
{ |
|||
if(!_context.create()) |
|||
{ |
|||
qDebug() << "Can't create GL _context."; |
|||
|
|||
return; |
|||
} |
|||
_surface.setFormat(_context.format()); |
|||
_surface.create(); |
|||
|
|||
if(!_surface.isValid()) |
|||
{ |
|||
qDebug() << "_surface not valid."; |
|||
|
|||
return; |
|||
} |
|||
|
|||
if(!_context.makeCurrent(&_surface)) |
|||
{ |
|||
qDebug() << "Can't make _context current."; |
|||
|
|||
return; |
|||
} |
|||
_image = new QImage("/home/mmt/Desktop/Projects/OpenGLOffscreen/sono.jpg"); |
|||
_fbo = new QOpenGLFramebufferObject(_image->size()); |
|||
|
|||
_context.functions()->glViewport(0, 0, _image->width(), _image->height()); |
|||
fun = new QOpenGLFunctions_3_3_Core(); |
|||
|
|||
if(!fun->initializeOpenGLFunctions()) |
|||
{ |
|||
qDebug() << "Can't init GL functions."; |
|||
|
|||
return; |
|||
} |
|||
_shader = new QOpenGLShaderProgram(&_context); |
|||
loadChars(); |
|||
} |
|||
|
|||
bool OpenGLHandler::prepareShader(QString vertexShader, QString fragmentShader) |
|||
{ |
|||
if(!_shader->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, vertexShader)) |
|||
{ |
|||
qDebug() << "Can't add vertex shader."; |
|||
|
|||
return false; |
|||
} |
|||
if(!_shader->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, fragmentShader)) |
|||
{ |
|||
qDebug() << "Can't add fragment shader."; |
|||
|
|||
return {}; |
|||
} |
|||
if(!_shader->link()) |
|||
{ |
|||
qDebug() << "Can't link program."; |
|||
|
|||
return false; |
|||
} |
|||
if(!_shader->bind()) |
|||
{ |
|||
qDebug() << "Can't bind program."; |
|||
|
|||
return false; |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
|
|||
bool OpenGLHandler::prepareTexture(const QImage& image) |
|||
{ |
|||
_texture.setData(image); |
|||
_texture.bind(); |
|||
if(!_texture.isBound()) |
|||
{ |
|||
qDebug() << "Texture not bound."; |
|||
|
|||
return false; |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
|
|||
bool OpenGLHandler::prepareCoords(QOpenGLBuffer vertexBuf, QOpenGLBuffer indexBuf) |
|||
{ |
|||
VertexData vertices[] = |
|||
{ |
|||
{{ -0.5f, +0.5f }, { 0.0f, 0.0f }}, //top-left
|
|||
{{ +0.5f, +0.5f }, { 1.0f, 0.0f }}, //top-right
|
|||
{{ -0.5f, -0.5f }, { 0.0f, 1.0f }}, //bottom-left
|
|||
{{ +0.5f, -0.5f }, { 1.0f, 1.0f }} //bottom-right
|
|||
//{{ -0.5f, +0.5f }, { 0.0f, 0.0f }}, //top-left
|
|||
//{{ +0.5f, +0.5f }, { 1.0f, 0.0f }}, //top-right
|
|||
//{{ -0.5f, -0.5f }, { 0.0f, 1.0f }}, //bottom-left
|
|||
//{{ +0.5f, -0.5f }, { 1.0f, 1.0f }} //bottom-right
|
|||
}; |
|||
|
|||
GLuint indices[] = |
|||
{ |
|||
0, 1, 2, 3 |
|||
}; |
|||
|
|||
if(!vertexBuf.create()) |
|||
{ |
|||
qDebug() << "Can't create vertex buffer."; |
|||
|
|||
return {}; |
|||
} |
|||
|
|||
if(!indexBuf.create()) |
|||
{ |
|||
qDebug() << "Can't create index buffer."; |
|||
|
|||
return {}; |
|||
} |
|||
|
|||
if(!vertexBuf.bind()) |
|||
{ |
|||
qDebug() << "Can't bind vertex buffer."; |
|||
|
|||
return {}; |
|||
} |
|||
vertexBuf.allocate(vertices, 4 * sizeof(VertexData)); |
|||
if(!indexBuf.bind()) |
|||
{ |
|||
qDebug() << "Can't bind index buffer."; |
|||
|
|||
return {}; |
|||
} |
|||
indexBuf.allocate(indices, 4 * sizeof(GLuint)); |
|||
|
|||
return true; |
|||
} |
|||
|
|||
void OpenGLHandler::loadChars() |
|||
{ |
|||
if(FT_Init_FreeType(&_ft)) |
|||
{ |
|||
qDebug() << "ERROR::FREETYPE: Could not init FreeType Library"; |
|||
} |
|||
|
|||
if(FT_New_Face(_ft, "/home/mmt/.fonts/Roboto-Black.ttf", 0, &_face)) |
|||
{ |
|||
qDebug() << "ERROR::FREETYPE: Failed to load font"; |
|||
} |
|||
FT_Set_Pixel_Sizes(_face, 0, 48); |
|||
if(FT_Load_Char(_face, 'X', FT_LOAD_RENDER)) |
|||
{ |
|||
qDebug() << "ERROR::FREETYTPE: Failed to load Glyph"; |
|||
} |
|||
|
|||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); //disable byte-alignment restriction
|
|||
|
|||
int i = 0; |
|||
for(unsigned char c = 0; c < 128; c++) |
|||
{ |
|||
//load character glyph
|
|||
if(FT_Load_Char(_face, c, FT_LOAD_RENDER)) |
|||
{ |
|||
qDebug() << "ERROR::FREETYTPE: Failed to load Glyph\n"; |
|||
continue; |
|||
} |
|||
//// generate texture
|
|||
unsigned int texture; |
|||
glGenTextures(1, &texture); |
|||
glBindTexture(GL_TEXTURE_2D, texture); |
|||
glTexImage2D( |
|||
GL_TEXTURE_2D, |
|||
0, |
|||
GL_RED, |
|||
_face->glyph->bitmap.width, |
|||
_face->glyph->bitmap.rows, |
|||
0, |
|||
GL_RED, |
|||
GL_UNSIGNED_BYTE, |
|||
_face->glyph->bitmap.buffer |
|||
); |
|||
//qDebug() << _face->glyph->bitmap.palette_mode;
|
|||
//QImage chImage(_face->glyph->bitmap.buffer, _face->glyph->bitmap.width,
|
|||
//_face->glyph->bitmap.rows,
|
|||
//QImage::Format::Format_Grayscale8);
|
|||
//chImage.save("/home/mmt/Desktop/chr/" + static_cast<QString>(i++) + ".png");
|
|||
|
|||
//// set texture options
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
|||
//now store character for later use
|
|||
Character character = { |
|||
texture, |
|||
glm::ivec2(_face->glyph->bitmap.width, _face->glyph->bitmap.rows), |
|||
glm::ivec2(_face->glyph->bitmap_left, _face->glyph->bitmap_top), |
|||
_face->glyph->advance.x |
|||
}; |
|||
_characters.insert(c, character); |
|||
} |
|||
glBindTexture(GL_TEXTURE_2D, 0); |
|||
FT_Done_Face(_face); |
|||
FT_Done_FreeType(_ft); |
|||
} |
|||
|
|||
void OpenGLHandler::processText() |
|||
{ |
|||
QString vertexShadre = |
|||
"#version 330 core\n" |
|||
"layout (location = 4) in vec4 vertex;" |
|||
"out vec2 TexCoords;" |
|||
"uniform mat4 projection;" |
|||
"void main()" |
|||
"{" |
|||
" gl_Position = projection * vec4(vertex.xy, 0.0, 1.0);" |
|||
" TexCoords.x = vertex.z;" |
|||
" TexCoords.y = vertex.w;" |
|||
"}"; |
|||
QString fragShadre = |
|||
"#version 330 core\n" |
|||
"in vec2 TexCoords;" |
|||
"out vec4 color;" |
|||
"uniform sampler2D text;" |
|||
"uniform vec3 textColor;" |
|||
"void main()" |
|||
"{" |
|||
" vec4 sampled = vec4(1.0, 1.0, 1.0, texture(text, TexCoords).r);" |
|||
" color = vec4(textColor, 1.00) * sampled;" |
|||
"}"; |
|||
prepareShader(vertexShadre, fragShadre); |
|||
//_shader->link();
|
|||
//_shader->bind();
|
|||
//fun->glEnable(GL_CULL_FACE);
|
|||
fun->glEnable(GL_BLEND); |
|||
//glBlendFunc(GL_ONE, GL_ZERO);
|
|||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
|||
QMatrix4x4 qProjection; |
|||
QRect temp(0.0f, static_cast<float>(320), 0.0f, static_cast<float>(480)); |
|||
qProjection.ortho(temp); |
|||
_shader->setUniformValueArray(_shader->uniformLocation("projection"), &qProjection, 1); |
|||
fun->glGenVertexArrays(1, &chVAO); |
|||
fun->glGenBuffers(1, &chVBO); |
|||
fun->glBindVertexArray(chVAO); |
|||
fun->glBindBuffer(GL_ARRAY_BUFFER, chVBO); |
|||
fun->glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 6 * 4, NULL, GL_DYNAMIC_DRAW); |
|||
fun->glEnableVertexAttribArray(4); |
|||
fun->glVertexAttribPointer(4, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(float), 0); |
|||
fun->glBindBuffer(GL_ARRAY_BUFFER, 0); |
|||
fun->glBindVertexArray(0); |
|||
|
|||
RenderText("This is sample text", -0.8f, -.8f, .003f, glm::vec3(0.5, 0.8f, 0.2f)); |
|||
RenderText("(C) LearnOpenGL.com", -0.5f, 0.00f, 0.005f, glm::vec3(0.3, 0.7f, 0.9f)); |
|||
//glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)
|
|||
//-------------------------------------------------------------------------------
|
|||
//glfwSwapBuffers(_window);
|
|||
//glfwPollEvents();
|
|||
auto log = _shader->log(); |
|||
if(log != "") |
|||
{ |
|||
qDebug() << "log : " << log; |
|||
} |
|||
|
|||
fun->glDeleteVertexArrays(1, &chVAO); |
|||
fun->glDeleteBuffers(1, &chVBO); |
|||
_shader->removeAllShaders(); |
|||
fun->glDisable(GL_BLEND); |
|||
glDisable(GL_CULL_FACE); |
|||
} |
|||
|
|||
void OpenGLHandler::RenderText(std::string text, float x, float y, float scale, glm::vec3 color) |
|||
{ |
|||
//activate corresponding render state
|
|||
_shader->setUniformValue(_shader->uniformLocation("textColor"), color.x, color.y, color.z); |
|||
glActiveTexture(GL_TEXTURE0); |
|||
fun->glBindVertexArray(chVAO); |
|||
|
|||
//iterate through all characters
|
|||
std::string::const_iterator c; |
|||
for(c = text.begin(); c != text.end(); c++) |
|||
{ |
|||
//qDebug() << "here";
|
|||
Character ch = _characters[*c]; |
|||
|
|||
float xpos = x + ch.Bearing.x * scale; |
|||
float ypos = y - (ch.Size.y - ch.Bearing.y) * scale; |
|||
//qDebug() << "xpos = " << xpos;
|
|||
float w = ch.Size.x * scale; |
|||
float h = ch.Size.y * scale; |
|||
//qDebug() << ypos + h;
|
|||
//update VBO for each character
|
|||
float vertices[6][4] = { |
|||
{ xpos, ypos + h, 0.0f, 0.0f }, |
|||
{ xpos, ypos, 0.0f, 1.0f }, |
|||
{ xpos + w, ypos, 1.0f, 1.0f }, |
|||
|
|||
{ xpos, ypos + h, 0.0f, 0.0f }, |
|||
{ xpos + w, ypos, 1.0f, 1.0f }, |
|||
{ xpos + w, ypos + h, 1.0f, 0.0f } |
|||
}; |
|||
//render glyph texture over quad
|
|||
glBindTexture(GL_TEXTURE_2D, ch.TextureID); |
|||
//update content of VBO memory
|
|||
fun->glBindBuffer(GL_ARRAY_BUFFER, chVBO); |
|||
fun->glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices); //be sure to use
|
|||
//glBufferSubData and not
|
|||
//glBufferData
|
|||
|
|||
fun->glBindBuffer(GL_ARRAY_BUFFER, 0); |
|||
//render quad
|
|||
glDrawArrays(GL_TRIANGLES, 0, 6); |
|||
//now advance cursors for next glyph (note that advance is number of 1/64 pixels)
|
|||
x += (ch.Advance >> 6) * scale; //bitshift by 6 to get value in pixels (2^6 = 64 (divide
|
|||
//amount of 1/64th pixels by 64 to get amount of pixels))
|
|||
} |
|||
fun->glBindVertexArray(0); |
|||
glBindTexture(GL_TEXTURE_2D, 0); |
|||
} |
|||
|
|||
bool OpenGLHandler::prepareCoords2(QOpenGLBuffer vertexBuf, QOpenGLBuffer indexBuf) |
|||
{ |
|||
VertexData vertices[] = |
|||
{ |
|||
{{ -1.0f, +1.0f }, { 0.0f, 1.0f }}, //top-left
|
|||
{{ +1.0f, +1.0f }, { 1.0f, 1.0f }}, //top-right
|
|||
{{ -1.0f, -1.0f }, { 0.0f, 0.0f }}, //bottom-left
|
|||
{{ +1.0f, -1.0f }, { 1.0f, 0.0f }} //bottom-right
|
|||
}; |
|||
|
|||
GLuint indices[] = |
|||
{ |
|||
0, 1, 2, 3 |
|||
}; |
|||
|
|||
if(!vertexBuf.create()) |
|||
{ |
|||
qDebug() << "Can't create vertex buffer."; |
|||
|
|||
return {}; |
|||
} |
|||
|
|||
if(!indexBuf.create()) |
|||
{ |
|||
qDebug() << "Can't create index buffer."; |
|||
|
|||
return {}; |
|||
} |
|||
|
|||
if(!vertexBuf.bind()) |
|||
{ |
|||
qDebug() << "Can't bind vertex buffer."; |
|||
|
|||
return {}; |
|||
} |
|||
vertexBuf.allocate(vertices, 4 * sizeof(VertexData)); |
|||
if(!indexBuf.bind()) |
|||
{ |
|||
qDebug() << "Can't bind index buffer."; |
|||
|
|||
return {}; |
|||
} |
|||
indexBuf.allocate(indices, 4 * sizeof(GLuint)); |
|||
|
|||
return true; |
|||
} |
|||
|
|||
QString OpenGLHandler::getImage(QImage img) |
|||
{ |
|||
QByteArray byteArray; |
|||
QBuffer buffer(&byteArray); |
|||
buffer.open(QIODevice::WriteOnly); |
|||
img.save(&buffer, "png"); |
|||
//save image data in string
|
|||
QString image("data:image/png;base64,"); |
|||
image.append(QString::fromLatin1(byteArray.toBase64().data())); |
|||
|
|||
return image; |
|||
} |
|||
|
|||
OpenGLHandler::~OpenGLHandler() |
|||
{ |
|||
delete _image; |
|||
delete _fbo; |
|||
delete _shader; |
|||
} |
|||
|
|||
void OpenGLHandler::processImage(const QImage& image, |
|||
const QString& vertexShader, |
|||
const QString& fragmentShader, |
|||
const QString& textureVar, |
|||
const QString& vertexPosVar, |
|||
const QString& textureCoordVar) |
|||
{ |
|||
//fun->glEnable(GL_BLEND);
|
|||
bool a; |
|||
QOpenGLBuffer vertexBuf(QOpenGLBuffer::VertexBuffer); |
|||
QOpenGLBuffer indexBuf(QOpenGLBuffer::IndexBuffer); |
|||
a = prepareShader(vertexShader, fragmentShader); |
|||
a = prepareTexture(image); |
|||
a = prepareCoords(vertexBuf, indexBuf); |
|||
|
|||
int offset = 0; |
|||
_shader->enableAttributeArray(vertexPosVar.toLatin1().data()); |
|||
_shader->setAttributeBuffer(vertexPosVar.toLatin1().data(), GL_FLOAT, offset, 2, |
|||
sizeof(VertexData)); |
|||
offset += sizeof(QVector2D); |
|||
_shader->enableAttributeArray(textureCoordVar.toLatin1().data()); |
|||
_shader->setAttributeBuffer(textureCoordVar.toLatin1().data(), GL_FLOAT, offset, 2, |
|||
sizeof(VertexData)); |
|||
|
|||
_shader->setUniformValue(textureVar.toLatin1().data(), 0); |
|||
|
|||
fun->glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT, Q_NULLPTR); |
|||
|
|||
_shader->disableAttributeArray(vertexPosVar.toLatin1().data()); |
|||
_shader->disableAttributeArray(textureCoordVar.toLatin1().data()); |
|||
_shader->disableAttributeArray(textureVar.toLatin1().data()); |
|||
|
|||
_shader->removeAllShaders(); |
|||
} |
|||
|
|||
void OpenGLHandler::flipImage() |
|||
{ |
|||
QString textureVar = "texture"; |
|||
QString vertexPosVar = "aPosition"; |
|||
QString textureCoordVar = "aTexCoord"; |
|||
QString flipVertexShader = |
|||
"attribute vec4 aPosition;\n" |
|||
"attribute vec2 aTexCoord;\n" |
|||
"varying vec2 vTexCoord;\n" |
|||
"void main()\n" |
|||
"{\n" |
|||
" gl_Position = aPosition;\n" |
|||
" vTexCoord.x = -aTexCoord.x;\n" |
|||
" vTexCoord.y = aTexCoord.y;\n" |
|||
"}"; |
|||
QString flipFragmentShader = |
|||
"uniform sampler2D texture;\n" |
|||
"varying vec2 vTexCoord;\n" |
|||
"void main()\n" |
|||
"{\n" |
|||
" gl_FragColor = texture2D(texture, vTexCoord);\n" |
|||
"}"; |
|||
prepareShader(flipVertexShader, ""); |
|||
QOpenGLBuffer vertexBuf(QOpenGLBuffer::VertexBuffer); |
|||
QOpenGLBuffer indexBuf(QOpenGLBuffer::IndexBuffer); |
|||
prepareCoords2(vertexBuf, indexBuf); |
|||
|
|||
int offset = 0; |
|||
_shader->enableAttributeArray(vertexPosVar.toLatin1().data()); |
|||
_shader->setAttributeBuffer(vertexPosVar.toLatin1().data(), GL_FLOAT, offset, 2, |
|||
sizeof(VertexData)); |
|||
offset += sizeof(QVector2D); |
|||
_shader->enableAttributeArray(textureCoordVar.toLatin1().data()); |
|||
_shader->setAttributeBuffer(textureCoordVar.toLatin1().data(), GL_FLOAT, offset, 2, |
|||
sizeof(VertexData)); |
|||
|
|||
_shader->setUniformValue(textureVar.toLatin1().data(), 0); |
|||
fun->glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT, Q_NULLPTR); |
|||
_shader->disableAttributeArray(vertexPosVar.toLatin1().data()); |
|||
_shader->disableAttributeArray(textureCoordVar.toLatin1().data()); |
|||
_shader->disableAttributeArray(textureVar.toLatin1().data()); |
|||
_shader->removeAllShaders(); |
|||
} |
|||
|
|||
void OpenGLHandler::run() |
|||
{ |
|||
//fun->glClearColor(0, 1, 1, 1);
|
|||
//fun->glClear(GL_COLOR_BUFFER_BIT);
|
|||
processImage(*_image, vertexShader, fragmentShader, "texture", "aPosition", |
|||
"aTexCoord"); |
|||
processText(); |
|||
//flipImage();
|
|||
auto ret = _fbo->toImage(true); |
|||
//auto address = getImage(ret);
|
|||
|
|||
ret.save("/home/mmt/Desktop/test.png"); |
|||
} |
@ -0,0 +1,90 @@ |
|||
#ifndef OPENGLHANDLER_H |
|||
#define OPENGLHANDLER_H |
|||
|
|||
#include <QtCore> |
|||
#include <QImage> |
|||
#include <QOpenGLContext> |
|||
#include <QOffscreenSurface> |
|||
#include <QOpenGLFramebufferObject> |
|||
#include <QOpenGLShaderProgram> |
|||
#include <QOpenGLTexture> |
|||
#include <QOpenGLBuffer> |
|||
#include <ft2build.h> |
|||
#include <glm/glm.hpp> |
|||
#include <glm/gtc/matrix_transform.hpp> |
|||
#include <glm/gtc/type_ptr.hpp> |
|||
#include <QtGui/QOpenGLFunctions_3_3_Core> |
|||
|
|||
#include FT_FREETYPE_H |
|||
|
|||
struct VertexData |
|||
{ |
|||
QVector2D position; |
|||
QVector2D texCoord; |
|||
}; |
|||
|
|||
struct Character { |
|||
unsigned int TextureID; //ID handle of the glyph texture
|
|||
glm::ivec2 Size; //Size of glyph
|
|||
glm::ivec2 Bearing; //Offset from baseline to left/top of glyph
|
|||
long Advance; //Offset to advance to next glyph
|
|||
}; |
|||
|
|||
class OpenGLHandler |
|||
{ |
|||
public: |
|||
OpenGLHandler(); |
|||
~OpenGLHandler(); |
|||
|
|||
void run(); |
|||
void processImage(const QImage& image, |
|||
const QString& vertexShader, |
|||
const QString& fragmentShader, |
|||
const QString& textureVar, |
|||
const QString& vertexPosVar, |
|||
const QString& textureCoordVar); |
|||
|
|||
private: |
|||
QOpenGLFunctions_3_3_Core* fun; |
|||
QOpenGLContext _context; |
|||
QOffscreenSurface _surface; |
|||
QOpenGLFramebufferObject* _fbo; |
|||
QImage* _image; |
|||
QOpenGLShaderProgram* _shader; |
|||
QOpenGLTexture _texture; |
|||
FT_Library _ft; |
|||
FT_Face _face; |
|||
QMap<char, Character> _characters; |
|||
|
|||
QString vertexShader = |
|||
"attribute vec4 aPosition;\n" |
|||
"attribute vec2 aTexCoord;\n" |
|||
"varying vec2 vTexCoord;\n" |
|||
"void main()\n" |
|||
"{\n" |
|||
" gl_Position = aPosition;\n" |
|||
" vTexCoord = aTexCoord;\n" |
|||
"}"; |
|||
|
|||
QString fragmentShader = |
|||
"uniform sampler2D texture;\n" |
|||
"varying vec2 vTexCoord;\n" |
|||
"void main()\n" |
|||
"{\n" |
|||
" gl_FragColor = texture2D(texture, vTexCoord);\n" |
|||
"}"; |
|||
|
|||
unsigned int chVAO, chVBO; |
|||
bool prepareShader(QString vertexShader, QString fragmentShader); |
|||
bool prepareTexture(const QImage& image); |
|||
bool prepareCoords(QOpenGLBuffer vertexBuf, QOpenGLBuffer indexBuf); |
|||
|
|||
void loadChars(); |
|||
void processText(); |
|||
void RenderText(std::string text, float x, float y, float scale, glm::vec3 color); |
|||
bool prepareCoords2(QOpenGLBuffer vertexBuf, QOpenGLBuffer indexBuf); |
|||
void flipImage(); |
|||
QString getImage(QImage img); |
|||
}; |
|||
|
|||
#endif //OPENGLHANDLER_H
|
@ -0,0 +1,38 @@ |
|||
QT += quick |
|||
|
|||
CONFIG += c++11 |
|||
|
|||
# The following define makes your compiler emit warnings if you use |
|||
# any Qt feature that has been marked deprecated (the exact warnings |
|||
# depend on your compiler). Refer to the documentation for the |
|||
# deprecated API to know how to port your code away from it. |
|||
DEFINES += QT_DEPRECATED_WARNINGS |
|||
|
|||
# You can also make your code fail to compile if it uses deprecated APIs. |
|||
# In order to do so, uncomment the following line. |
|||
# You can also select to disable deprecated APIs only up to a certain version of Qt. |
|||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 |
|||
|
|||
SOURCES += \ |
|||
OpenGLHandler.cpp \ |
|||
main.cpp |
|||
|
|||
RESOURCES += qml.qrc |
|||
|
|||
# Additional import path used to resolve QML modules in Qt Creator's code model |
|||
QML_IMPORT_PATH = |
|||
|
|||
# Additional import path used to resolve QML modules just for Qt Quick Designer |
|||
QML_DESIGNER_IMPORT_PATH = |
|||
|
|||
# Default rules for deployment. |
|||
qnx: target.path = /tmp/$${TARGET}/bin |
|||
else: unix:!android: target.path = /opt/$${TARGET}/bin |
|||
!isEmpty(target.path): INSTALLS += target |
|||
|
|||
HEADERS += \ |
|||
OpenGLHandler.h |
|||
|
|||
unix|win32: LIBS += -lfreetype |
|||
|
|||
unix|win32: LIBS += -lglfw |
@ -0,0 +1,335 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE QtCreatorProject> |
|||
<!-- Written by QtCreator 4.10.1, 2021-05-18T14:05:05. --> |
|||
<qtcreator> |
|||
<data> |
|||
<variable>EnvironmentId</variable> |
|||
<value type="QByteArray">{b555296d-4153-4375-9ee0-d02c6b22be92}</value> |
|||
</data> |
|||
<data> |
|||
<variable>ProjectExplorer.Project.ActiveTarget</variable> |
|||
<value type="int">0</value> |
|||
</data> |
|||
<data> |
|||
<variable>ProjectExplorer.Project.EditorSettings</variable> |
|||
<valuemap type="QVariantMap"> |
|||
<value type="bool" key="EditorConfiguration.AutoIndent">true</value> |
|||
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> |
|||
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> |
|||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> |
|||
<value type="QString" key="language">Cpp</value> |
|||
<valuemap type="QVariantMap" key="value"> |
|||
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value> |
|||
</valuemap> |
|||
</valuemap> |
|||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> |
|||
<value type="QString" key="language">QmlJS</value> |
|||
<valuemap type="QVariantMap" key="value"> |
|||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> |
|||
</valuemap> |
|||
</valuemap> |
|||
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> |
|||
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> |
|||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> |
|||
<value type="int" key="EditorConfiguration.IndentSize">4</value> |
|||
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> |
|||
<value type="int" key="EditorConfiguration.MarginColumn">80</value> |
|||
<value type="bool" key="EditorConfiguration.MouseHiding">true</value> |
|||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value> |
|||
<value type="int" key="EditorConfiguration.PaddingMode">1</value> |
|||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> |
|||
<value type="bool" key="EditorConfiguration.ShowMargin">false</value> |
|||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> |
|||
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value> |
|||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> |
|||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> |
|||
<value type="int" key="EditorConfiguration.TabSize">8</value> |
|||
<value type="bool" key="EditorConfiguration.UseGlobal">true</value> |
|||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> |
|||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> |
|||
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value> |
|||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> |
|||
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value> |
|||
</valuemap> |
|||
</data> |
|||
<data> |
|||
<variable>ProjectExplorer.Project.PluginSettings</variable> |
|||
<valuemap type="QVariantMap"> |
|||
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey"/> |
|||
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value> |
|||
</valuemap> |
|||
</data> |
|||
<data> |
|||
<variable>ProjectExplorer.Project.Target.0</variable> |
|||
<valuemap type="QVariantMap"> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.13.2 GCC 64bit</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.13.2 GCC 64bit</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5132.gcc_64_kit</value> |
|||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
|||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
|||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
|||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/mmt/Desktop/Projects/build-OpenGLOffscreen-Desktop_Qt_5_13_2_GCC_64bit-Debug</value> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value> |
|||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value> |
|||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value> |
|||
</valuemap> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/> |
|||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value> |
|||
</valuemap> |
|||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|||
</valuemap> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/> |
|||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value> |
|||
</valuemap> |
|||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|||
</valuemap> |
|||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> |
|||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|||
</valuemap> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> |
|||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/mmt/Desktop/Projects/build-OpenGLOffscreen-Desktop_Qt_5_13_2_GCC_64bit-Release</value> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value> |
|||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value> |
|||
</valuemap> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/> |
|||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value> |
|||
</valuemap> |
|||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|||
</valuemap> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/> |
|||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value> |
|||
</valuemap> |
|||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|||
</valuemap> |
|||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|||
</valuemap> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2"> |
|||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/mmt/Desktop/Projects/build-OpenGLOffscreen-Desktop_Qt_5_13_2_GCC_64bit-Profile</value> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value> |
|||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value> |
|||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value> |
|||
</valuemap> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/> |
|||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value> |
|||
</valuemap> |
|||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|||
</valuemap> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/> |
|||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value> |
|||
</valuemap> |
|||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|||
</valuemap> |
|||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|||
</valuemap> |
|||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|||
</valuemap> |
|||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy Configuration</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|||
</valuemap> |
|||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|||
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value> |
|||
<valuelist type="QVariantList" key="Analyzer.Perf.Events"> |
|||
<value type="QString">cpu-cycles</value> |
|||
</valuelist> |
|||
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/> |
|||
<value type="int" key="Analyzer.Perf.Frequency">250</value> |
|||
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value> |
|||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value> |
|||
<value type="int" key="Analyzer.Perf.StackSize">4096</value> |
|||
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value> |
|||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value> |
|||
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value> |
|||
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value> |
|||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> |
|||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|||
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value> |
|||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
|||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
|||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
|||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
|||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|||
<value type="int">0</value> |
|||
<value type="int">1</value> |
|||
<value type="int">2</value> |
|||
<value type="int">3</value> |
|||
<value type="int">4</value> |
|||
<value type="int">5</value> |
|||
<value type="int">6</value> |
|||
<value type="int">7</value> |
|||
<value type="int">8</value> |
|||
<value type="int">9</value> |
|||
<value type="int">10</value> |
|||
<value type="int">11</value> |
|||
<value type="int">12</value> |
|||
<value type="int">13</value> |
|||
<value type="int">14</value> |
|||
</valuelist> |
|||
<value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">OpenGLOffscreen</value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/mmt/Desktop/Projects/OpenGLOffscreen/OpenGLOffscreen.pro</value> |
|||
<value type="QString" key="RunConfiguration.Arguments"></value> |
|||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value> |
|||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> |
|||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value> |
|||
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
|||
<value type="QString" key="RunConfiguration.WorkingDirectory"></value> |
|||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/mmt/Desktop/Projects/build-OpenGLOffscreen-Desktop_Qt_5_13_2_GCC_64bit-Debug</value> |
|||
</valuemap> |
|||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
|||
</valuemap> |
|||
</data> |
|||
<data> |
|||
<variable>ProjectExplorer.Project.TargetCount</variable> |
|||
<value type="int">1</value> |
|||
</data> |
|||
<data> |
|||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
|||
<value type="int">22</value> |
|||
</data> |
|||
<data> |
|||
<variable>Version</variable> |
|||
<value type="int">22</value> |
|||
</data> |
|||
</qtcreator> |
@ -0,0 +1,27 @@ |
|||
#include <QGuiApplication> |
|||
#include <QQmlApplicationEngine> |
|||
|
|||
#include "OpenGLHandler.h" |
|||
|
|||
int main(int argc, char* argv[]) |
|||
{ |
|||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); |
|||
|
|||
QGuiApplication app(argc, argv); |
|||
|
|||
QQmlApplicationEngine engine; |
|||
const QUrl url(QStringLiteral("qrc:/main.qml")); |
|||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, |
|||
&app, [url](QObject* obj, const QUrl& objUrl) { |
|||
if(!obj && url == objUrl) |
|||
{ |
|||
QCoreApplication::exit(-1); |
|||
} |
|||
}, Qt::QueuedConnection); |
|||
engine.load(url); |
|||
|
|||
OpenGLHandler op; |
|||
op.run(); |
|||
|
|||
return app.exec(); |
|||
} |
@ -0,0 +1,9 @@ |
|||
import QtQuick 2.13 |
|||
import QtQuick.Window 2.13 |
|||
|
|||
Window { |
|||
visible: true |
|||
width: 640 |
|||
height: 480 |
|||
title: qsTr("Hello World") |
|||
} |
@ -0,0 +1,5 @@ |
|||
<RCC> |
|||
<qresource prefix="/"> |
|||
<file>main.qml</file> |
|||
</qresource> |
|||
</RCC> |
After Width: | Height: | Size: 122 KiB |
Loading…
Reference in new issue