Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Ludmány Balázs
/
thin-client
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
48d85ad7
authored
Jul 20, 2016
by
Ludmány Balázs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resize framebuffer to screen size
parent
c7e27e43
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
33 additions
and
29 deletions
+33
-29
dispatcher.cpp
+3
-3
dispatcher.h
+1
-1
draw_shader.fsh
+2
-2
draw_shader.vsh
+6
-7
main.qml
+4
-4
qvnc.cpp
+1
-1
qvnc.h
+1
-1
uploader.cpp
+4
-2
vncrenderer.cpp
+11
-8
No files found.
dispatcher.cpp
View file @
48d85ad7
...
@@ -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
por
t
)
void
Dispatcher
::
open
(
const
QString
host
,
const
int
port
,
const
int
width
,
const
int
heigh
t
)
{
{
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__
...
...
dispatcher.h
View file @
48d85ad7
...
@@ -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
();
};
};
...
...
draw_shader.fsh
View file @
48d85ad7
uniform sampler2D texture;
uniform sampler2D texture;
varying
high
p vec2 vartexcoord;
varying
low
p vec2 vartexcoord;
varying
high
p vec3 varcolor;
varying
low
p vec3 varcolor;
void main(void)
void main(void)
{
{
...
...
draw_shader.vsh
View file @
48d85ad7
uniform
high
p mat4 ortho;
uniform
low
p mat4 ortho;
uniform lowp vec3 colormax;
uniform lowp vec3 colormax;
attribute
high
p vec2 position;
attribute
low
p vec2 position;
attribute
high
p vec3 color;
attribute
low
p vec3 color;
attribute
high
p vec2 texcoord;
attribute
low
p vec2 texcoord;
varying
high
p vec3 varcolor;
varying
low
p vec3 varcolor;
varying
high
p vec2 vartexcoord;
varying
low
p 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;
}
}
main.qml
View file @
48d85ad7
...
@@ -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
}
}
}
}
qvnc.cpp
View file @
48d85ad7
...
@@ -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
()
...
...
qvnc.h
View file @
48d85ad7
...
@@ -50,7 +50,7 @@ private:
...
@@ -50,7 +50,7 @@ private:
ulong
m_lastMouseEvent
;
ulong
m_lastMouseEvent
;
signals
:
signals
:
void
open_connection
(
QString
host
,
int
por
t
);
void
open_connection
(
const
QString
host
,
const
int
port
,
const
int
width
,
const
int
heigh
t
);
void
terminate_connection
();
void
terminate_connection
();
void
hostChanged
(
QString
host
);
void
hostChanged
(
QString
host
);
...
...
uploader.cpp
View file @
48d85ad7
...
@@ -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
);
...
...
vncrenderer.cpp
View file @
48d85ad7
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment