Commit 48d85ad7 by Ludmány Balázs

Resize framebuffer to screen size

parent c7e27e43
...@@ -87,7 +87,7 @@ Uploader *Dispatcher::uploader() const ...@@ -87,7 +87,7 @@ Uploader *Dispatcher::uploader() const
return m_uploader; return m_uploader;
} }
void Dispatcher::open(QString host, int port) void Dispatcher::open(const QString host, const int port, const int width, const int height)
{ {
QByteArray tmp = host.toLocal8Bit(); QByteArray tmp = host.toLocal8Bit();
m_client = rfbGetClient(8, 3, 4); m_client = rfbGetClient(8, 3, 4);
...@@ -105,8 +105,8 @@ void Dispatcher::open(QString host, int port) ...@@ -105,8 +105,8 @@ void Dispatcher::open(QString host, int port)
m_client->appData.useRemoteCursor = TRUE; m_client->appData.useRemoteCursor = TRUE;
// Set the format requested by the user // Set the format requested by the user
m_client->width = 1024; m_client->width = width;
m_client->height = 768; m_client->height = height;
m_client->appData.compressLevel = 0; m_client->appData.compressLevel = 0;
m_client->appData.qualityLevel = 0; m_client->appData.qualityLevel = 0;
#ifdef __BIG_ENDIAN__ #ifdef __BIG_ENDIAN__
......
...@@ -56,7 +56,7 @@ signals: ...@@ -56,7 +56,7 @@ signals:
void error(); void error();
public slots: public slots:
// manage VNC connection // manage VNC connection
void open(QString host, int port); void open(QString host, int port, const int width, const int height);
void refresh(); void refresh();
void terminate(); void terminate();
}; };
......
uniform sampler2D texture; uniform sampler2D texture;
varying highp vec2 vartexcoord; varying lowp vec2 vartexcoord;
varying highp vec3 varcolor; varying lowp vec3 varcolor;
void main(void) void main(void)
{ {
......
uniform highp mat4 ortho; uniform lowp mat4 ortho;
uniform lowp vec3 colormax; uniform lowp vec3 colormax;
attribute highp vec2 position; attribute lowp vec2 position;
attribute highp vec3 color; attribute lowp vec3 color;
attribute highp vec2 texcoord; attribute lowp vec2 texcoord;
varying highp vec3 varcolor; varying lowp vec3 varcolor;
varying highp vec2 vartexcoord; varying lowp vec2 vartexcoord;
void main(void) void main(void)
{ {
gl_Position = ortho * vec4(position, 0.0, 1.0); gl_Position = ortho * vec4(position, 0.0, 1.0);
varcolor = color / colormax; varcolor = color / colormax;
// varcolor = vec3(1.0, 1.0, 0.0);
vartexcoord = texcoord; vartexcoord = texcoord;
} }
...@@ -4,8 +4,8 @@ import thinclient 1.3 ...@@ -4,8 +4,8 @@ import thinclient 1.3
ApplicationWindow { ApplicationWindow {
visible: true visible: true
width: vnc.width; visibility: "Maximized"
height: tab.height + vnc.height id: window
header: TabBar { header: TabBar {
id: tab id: tab
...@@ -27,7 +27,7 @@ ApplicationWindow { ...@@ -27,7 +27,7 @@ ApplicationWindow {
id: vnc id: vnc
host: "vm.ik.bme.hu" host: "vm.ik.bme.hu"
port: 10495 port: 10495
width: 1024 width: window.width
height: 768 height: window.height - tab.height
} }
} }
...@@ -52,7 +52,7 @@ QVnc::~QVnc() ...@@ -52,7 +52,7 @@ QVnc::~QVnc()
void QVnc::open() void QVnc::open()
{ {
emit open_connection(this->m_host, this->m_port); emit open_connection(this->m_host, this->m_port, (int) this->width(), (int) this->height());
} }
void QVnc::terminate() void QVnc::terminate()
......
...@@ -50,7 +50,7 @@ private: ...@@ -50,7 +50,7 @@ private:
ulong m_lastMouseEvent; ulong m_lastMouseEvent;
signals: signals:
void open_connection(QString host, int port); void open_connection(const QString host, const int port, const int width, const int height);
void terminate_connection(); void terminate_connection();
void hostChanged(QString host); void hostChanged(QString host);
......
...@@ -225,10 +225,12 @@ int Uploader::gotJpeg(const quint32 x, const quint32 y, const quint32 width, con ...@@ -225,10 +225,12 @@ int Uploader::gotJpeg(const quint32 x, const quint32 y, const quint32 width, con
m_functions->glBindTexture(GL_TEXTURE_2D, id); m_functions->glBindTexture(GL_TEXTURE_2D, id);
#ifdef GL_RGB8 #ifdef GL_RGB8
m_functions->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, real_width, real_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); m_functions->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, real_width, real_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
#elif GL_RGB8_OES
m_functions->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8_OES, real_width, real_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
#else #else
#ifdef GL_RGB8_OES
m_functions->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8_OES, real_width, real_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
#else
m_functions->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, real_width, real_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); m_functions->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, real_width, real_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
#endif
#endif #endif
m_textures->append(id); m_textures->append(id);
......
...@@ -20,9 +20,9 @@ VncRenderer::VncRenderer(QQuickWindow *window, ...@@ -20,9 +20,9 @@ VncRenderer::VncRenderer(QQuickWindow *window,
void VncRenderer::render() void VncRenderer::render()
{ {
static QTime frameTime; /*static QTime frameTime;
qDebug() << qRound(1000.0 / frameTime.elapsed()) << m_textures->length(); qDebug() << qRound(1000.0 / frameTime.elapsed()) << m_textures->length();
frameTime.restart(); frameTime.restart();*/
m_program.bind(); m_program.bind();
m_vertices.bind(); m_vertices.bind();
...@@ -50,6 +50,7 @@ void VncRenderer::render() ...@@ -50,6 +50,7 @@ void VncRenderer::render()
QOpenGLFramebufferObject *VncRenderer::createFramebufferObject(const QSize &size) QOpenGLFramebufferObject *VncRenderer::createFramebufferObject(const QSize &size)
{ {
qDebug() << size;
QMatrix4x4 ortho; QMatrix4x4 ortho;
ortho.ortho(QRect(QPoint(0, size.height()), QSize(size.width(), -1 * size.height()))); ortho.ortho(QRect(QPoint(0, size.height()), QSize(size.width(), -1 * size.height())));
m_program.bind(); m_program.bind();
...@@ -57,14 +58,16 @@ QOpenGLFramebufferObject *VncRenderer::createFramebufferObject(const QSize &size ...@@ -57,14 +58,16 @@ QOpenGLFramebufferObject *VncRenderer::createFramebufferObject(const QSize &size
m_program.release(); m_program.release();
QOpenGLFramebufferObjectFormat format; QOpenGLFramebufferObjectFormat format;
/* format.setTextureTarget(GL_TEXTURE_2D); format.setTextureTarget(GL_TEXTURE_2D);
#ifdef GL_RGB8 #ifdef GL_RGBA8
format.setInternalTextureFormat(GL_RGB8); format.setInternalTextureFormat(GL_RGBA8);
#ifdef GL_RGB8_OES
format.setInternalTextureFormat(GL_RGB8_OES);
#else #else
#ifdef GL_RGBA8_OES
format.setInternalTextureFormat(GL_RGBA8_OES);
#else
format.setInternalTextureFormat(GL_RGBA); format.setInternalTextureFormat(GL_RGBA);
#endif*/ #endif
#endif
QOpenGLFramebufferObject *framebufferObject = new QOpenGLFramebufferObject(size, format); QOpenGLFramebufferObject *framebufferObject = new QOpenGLFramebufferObject(size, format);
emit FBOTextureChanged(framebufferObject->texture(), ortho); emit FBOTextureChanged(framebufferObject->texture(), ortho);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment