summaryrefslogtreecommitdiffstats
path: root/src/datavisualization/utils/texturehelper.cpp
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2014-09-25 15:04:44 +0300
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2014-09-26 10:06:52 +0300
commit0ab45b018fa98e9ef6cffd70178f208eb4f16550 (patch)
tree77d324f47ccb52cc543df9e8990153b82ead2688 /src/datavisualization/utils/texturehelper.cpp
parent36bc54f5720bddb9899e64d665117ac1e1b5bc94 (diff)
Implement zooming to cursor
Zooming to cursor is now default operating mode of the default input handler. Task-number: QTRD-3263 Change-Id: I5699fc0ce7393059538972cd52f31f06d87e3d8d Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'src/datavisualization/utils/texturehelper.cpp')
-rw-r--r--src/datavisualization/utils/texturehelper.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/datavisualization/utils/texturehelper.cpp b/src/datavisualization/utils/texturehelper.cpp
index 5e21b5cd..9dbf0613 100644
--- a/src/datavisualization/utils/texturehelper.cpp
+++ b/src/datavisualization/utils/texturehelper.cpp
@@ -218,6 +218,31 @@ GLuint TextureHelper::createSelectionTexture(const QSize &size, GLuint &frameBuf
return textureid;
}
+GLuint TextureHelper::createCursorPositionTexture(const QSize &size, GLuint &frameBuffer)
+{
+ GLuint textureid;
+ glGenTextures(1, &textureid);
+ glBindTexture(GL_TEXTURE_2D, textureid);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width(), size.height(), 0, GL_RGBA,
+ GL_UNSIGNED_BYTE, NULL);
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+ glGenFramebuffers(1, &frameBuffer);
+ glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
+ textureid, 0);
+
+ GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+ if (status != GL_FRAMEBUFFER_COMPLETE) {
+ qCritical() << "Cursor position mapper frame buffer creation failed:" << status;
+ glDeleteTextures(1, &textureid);
+ textureid = 0;
+ }
+ glBindFramebuffer(GL_FRAMEBUFFER, 0);
+
+ return textureid;
+}
+
GLuint TextureHelper::createUniformTexture(const QColor &color)
{
QImage image(QSize(int(uniformTextureWidth), int(uniformTextureHeight)),