Commit 48d85ad7 by Ludmány Balázs

Resize framebuffer to screen size

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