Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
5f4b6916
Commit
5f4b6916
authored
May 30, 2011
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cached texture created for subpicture rendering (opengl).
It avoids creating/destroying texture uselessly.
parent
0a5dcfef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
17 deletions
+43
-17
modules/video_output/opengl.c
modules/video_output/opengl.c
+43
-17
No files found.
modules/video_output/opengl.c
View file @
5f4b6916
...
...
@@ -563,10 +563,9 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
}
#endif
for
(
int
i
=
0
;
i
<
vgl
->
region_count
;
i
++
)
{
glDeleteTextures
(
1
,
&
vgl
->
region
[
i
].
texture
);
}
free
(
vgl
->
region
);
int
last_count
=
vgl
->
region_count
;
gl_region_t
*
last
=
vgl
->
region
;
vgl
->
region_count
=
0
;
vgl
->
region
=
NULL
;
...
...
@@ -595,21 +594,48 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
glr
->
right
=
2
.
0
*
(
r
->
i_x
+
r
->
fmt
.
i_visible_width
)
/
subpicture
->
i_original_picture_width
-
1
.
0
;
glr
->
bottom
=
-
2
.
0
*
(
r
->
i_y
+
r
->
fmt
.
i_visible_height
)
/
subpicture
->
i_original_picture_height
+
1
.
0
;
glGenTextures
(
1
,
&
glr
->
texture
);
glBindTexture
(
GL_TEXTURE_2D
,
glr
->
texture
);
glTexParameterf
(
GL_TEXTURE_2D
,
GL_TEXTURE_PRIORITY
,
1
.
0
);
glTexEnvf
(
GL_TEXTURE_ENV
,
GL_TEXTURE_ENV_MODE
,
GL_MODULATE
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MAG_FILTER
,
GL_LINEAR
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MIN_FILTER
,
GL_LINEAR
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_WRAP_S
,
GL_CLAMP_TO_EDGE
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_WRAP_T
,
GL_CLAMP_TO_EDGE
);
/* TODO set GL_UNPACK_ALIGNMENT */
glPixelStorei
(
GL_UNPACK_ROW_LENGTH
,
r
->
p_picture
->
p
->
i_pitch
/
r
->
p_picture
->
p
->
i_pixel_pitch
);
glTexImage2D
(
GL_TEXTURE_2D
,
0
,
glr
->
format
,
glr
->
width
,
glr
->
height
,
0
,
glr
->
format
,
glr
->
type
,
r
->
p_picture
->
p
->
p_pixels
);
glr
->
texture
=
0
;
for
(
int
j
=
0
;
j
<
last_count
;
j
++
)
{
if
(
last
[
i
].
texture
&&
last
[
i
].
width
==
glr
->
width
&&
last
[
i
].
height
==
glr
->
height
&&
last
[
i
].
format
==
glr
->
format
&&
last
[
i
].
type
==
glr
->
type
)
{
glr
->
texture
=
last
[
i
].
texture
;
memset
(
&
last
[
i
],
0
,
sizeof
(
last
[
i
]));
break
;
}
}
if
(
glr
->
texture
)
{
glBindTexture
(
GL_TEXTURE_2D
,
glr
->
texture
);
/* TODO set GL_UNPACK_ALIGNMENT */
glPixelStorei
(
GL_UNPACK_ROW_LENGTH
,
r
->
p_picture
->
p
->
i_pitch
/
r
->
p_picture
->
p
->
i_pixel_pitch
);
glTexSubImage2D
(
GL_TEXTURE_2D
,
0
,
0
,
0
,
glr
->
width
,
glr
->
height
,
glr
->
format
,
glr
->
type
,
r
->
p_picture
->
p
->
p_pixels
);
}
else
{
glGenTextures
(
1
,
&
glr
->
texture
);
glBindTexture
(
GL_TEXTURE_2D
,
glr
->
texture
);
glTexParameterf
(
GL_TEXTURE_2D
,
GL_TEXTURE_PRIORITY
,
1
.
0
);
glTexEnvf
(
GL_TEXTURE_ENV
,
GL_TEXTURE_ENV_MODE
,
GL_MODULATE
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MAG_FILTER
,
GL_LINEAR
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MIN_FILTER
,
GL_LINEAR
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_WRAP_S
,
GL_CLAMP_TO_EDGE
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_WRAP_T
,
GL_CLAMP_TO_EDGE
);
/* TODO set GL_UNPACK_ALIGNMENT */
glPixelStorei
(
GL_UNPACK_ROW_LENGTH
,
r
->
p_picture
->
p
->
i_pitch
/
r
->
p_picture
->
p
->
i_pixel_pitch
);
glTexImage2D
(
GL_TEXTURE_2D
,
0
,
glr
->
format
,
glr
->
width
,
glr
->
height
,
0
,
glr
->
format
,
glr
->
type
,
r
->
p_picture
->
p
->
p_pixels
);
}
}
}
for
(
int
i
=
0
;
i
<
last_count
;
i
++
)
{
if
(
last
[
i
].
texture
)
glDeleteTextures
(
1
,
&
last
[
i
].
texture
);
}
free
(
last
);
vlc_gl_Unlock
(
vgl
->
gl
);
VLC_UNUSED
(
subpicture
);
...
...
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