Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
a5300639
Commit
a5300639
authored
Feb 25, 2004
by
Eric Petit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx/vout* : fixed OpenGL fullscreen (still needs some cleaning)
parent
d743958e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
26 deletions
+105
-26
modules/gui/macosx/vout.h
modules/gui/macosx/vout.h
+11
-7
modules/gui/macosx/vout.m
modules/gui/macosx/vout.m
+94
-19
No files found.
modules/gui/macosx/vout.h
View file @
a5300639
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* vout.h: MacOS X interface module
* vout.h: MacOS X interface module
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* Copyright (C) 2001-2003 VideoLAN
* $Id: vout.h,v 1.2
3 2004/02/09 13:28:32
titer Exp $
* $Id: vout.h,v 1.2
4 2004/02/25 19:27:23
titer Exp $
*
*
* Authors: Colin Delacroix <colin@zoy.org>
* Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org>
* Florian G. Pflug <fgp@phlo.org>
...
@@ -65,11 +65,15 @@
...
@@ -65,11 +65,15 @@
unsigned
long
i_texture
;
unsigned
long
i_texture
;
float
f_x
;
float
f_x
;
float
f_y
;
float
f_y
;
NSOpenGLContext
*
fullScreenContext
;
NSOpenGLContext
*
currentContext
;
}
}
-
(
id
)
initWithFrame
:
(
NSRect
)
frame
vout
:
(
vout_thread_t
*
)
p_vout
;
-
(
id
)
initWithFrame
:
(
NSRect
)
frame
vout
:
(
vout_thread_t
*
)
p_vout
;
-
(
void
)
initTextures
;
-
(
void
)
initTextures
;
-
(
void
)
reloadTexture
;
-
(
void
)
reloadTexture
;
-
(
void
)
goFullScreen
;
-
(
void
)
exitFullScreen
;
@end
@end
...
...
modules/gui/macosx/vout.m
View file @
a5300639
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* vout.m: MacOS X video output module
* vout.m: MacOS X video output module
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* Copyright (C) 2001-2003 VideoLAN
* $Id: vout.m,v 1.8
1 2004/02/12 17:35:05
titer Exp $
* $Id: vout.m,v 1.8
2 2004/02/25 19:27:23
titer Exp $
*
*
* Authors: Colin Delacroix <colin@zoy.org>
* Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org>
* Florian G. Pflug <fgp@phlo.org>
...
@@ -571,7 +571,15 @@ static int CoToggleFullscreen( vout_thread_t *p_vout )
...
@@ -571,7 +571,15 @@ static int CoToggleFullscreen( vout_thread_t *p_vout )
{
{
if
(
p_vout
->
p_sys
->
i_opengl
)
if
(
p_vout
->
p_sys
->
i_opengl
)
{
{
/* TODO */
p_vout
->
b_fullscreen
=
!
p_vout
->
b_fullscreen
;
if
(
p_vout
->
b_fullscreen
)
{
[
p_vout
->
p_sys
->
o_glview
goFullScreen
];
}
else
{
[
p_vout
->
p_sys
->
o_glview
exitFullScreen
];
}
return
0
;
return
0
;
}
}
...
@@ -1299,14 +1307,15 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
...
@@ -1299,14 +1307,15 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
if
(
!
fmt
)
if
(
!
fmt
)
{
{
fprintf
(
stderr
,
"Cannot create NSOpenGLPixelFormat
\n
"
);
msg_Warn
(
p_vout
,
"Cannot create NSOpenGLPixelFormat
"
);
return
nil
;
return
nil
;
}
}
self
=
[
super
initWithFrame
:
frame
pixelFormat
:
fmt
];
self
=
[
super
initWithFrame
:
frame
pixelFormat
:
fmt
];
[[
self
openGLContext
]
makeCurrentContext
];
currentContext
=
[
self
openGLContext
];
[[
self
openGLContext
]
update
];
[
currentContext
makeCurrentContext
];
[
currentContext
update
];
/* Black background */
/* Black background */
glClearColor
(
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
);
glClearColor
(
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
);
...
@@ -1357,7 +1366,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
...
@@ -1357,7 +1366,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
-
(
void
)
reshape
-
(
void
)
reshape
{
{
[
[
self
openGLContext
]
makeCurrentContext
];
[
currentContext
makeCurrentContext
];
NSRect
bounds
=
[
self
bounds
];
NSRect
bounds
=
[
self
bounds
];
...
@@ -1365,7 +1374,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
...
@@ -1365,7 +1374,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
(
GLint
)
bounds
.
size
.
height
);
(
GLint
)
bounds
.
size
.
height
);
/* Quad size is set in order to preserve the aspect ratio */
/* Quad size is set in order to preserve the aspect ratio */
if
(
bounds
.
size
.
height
*
p_vout
->
output
.
i_aspect
<
if
(
bounds
.
size
.
height
*
p_vout
->
render
.
i_aspect
<
bounds
.
size
.
width
*
VOUT_ASPECT_FACTOR
)
bounds
.
size
.
width
*
VOUT_ASPECT_FACTOR
)
{
{
f_x
=
bounds
.
size
.
height
*
p_vout
->
render
.
i_aspect
/
f_x
=
bounds
.
size
.
height
*
p_vout
->
render
.
i_aspect
/
...
@@ -1382,7 +1391,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
...
@@ -1382,7 +1391,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
-
(
void
)
initTextures
-
(
void
)
initTextures
{
{
[
[
self
openGLContext
]
makeCurrentContext
];
[
currentContext
makeCurrentContext
];
/* Create textures */
/* Create textures */
glGenTextures
(
1
,
&
i_texture
);
glGenTextures
(
1
,
&
i_texture
);
...
@@ -1424,7 +1433,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
...
@@ -1424,7 +1433,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
-
(
void
)
reloadTexture
-
(
void
)
reloadTexture
{
{
[
[
self
openGLContext
]
makeCurrentContext
];
[
currentContext
makeCurrentContext
];
glBindTexture
(
GL_TEXTURE_RECTANGLE_EXT
,
i_texture
);
glBindTexture
(
GL_TEXTURE_RECTANGLE_EXT
,
i_texture
);
...
@@ -1437,6 +1446,78 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
...
@@ -1437,6 +1446,78 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
PP_OUTPUTPICTURE
[
0
]
->
p_data
);
PP_OUTPUTPICTURE
[
0
]
->
p_data
);
}
}
-
(
void
)
goFullScreen
{
NSOpenGLPixelFormatAttribute
attribs
[]
=
{
NSOpenGLPFAAccelerated
,
NSOpenGLPFANoRecovery
,
NSOpenGLPFADoubleBuffer
,
NSOpenGLPFAColorSize
,
24
,
NSOpenGLPFAAlphaSize
,
8
,
NSOpenGLPFADepthSize
,
24
,
NSOpenGLPFAFullScreen
,
NSOpenGLPFAScreenMask
,
CGDisplayIDToOpenGLDisplayMask
(
kCGDirectMainDisplay
),
0
};
NSOpenGLPixelFormat
*
fmt
=
[[
NSOpenGLPixelFormat
alloc
]
initWithAttributes:
attribs
];
if
(
!
fmt
)
{
msg_Warn
(
p_vout
,
"Cannot create NSOpenGLPixelFormat"
);
return
;
}
fullScreenContext
=
[[
NSOpenGLContext
alloc
]
initWithFormat:
fmt
shareContext
:
[
self
openGLContext
]];
if
(
!
fullScreenContext
)
{
msg_Warn
(
p_vout
,
"Failed to create new NSOpenGLContext"
);
return
;
}
currentContext
=
fullScreenContext
;
if
(
CGCaptureAllDisplays
()
!=
CGDisplayNoErr
)
{
msg_Warn
(
p_vout
,
"CGCaptureAllDisplays() failed"
);
return
;
}
[
fullScreenContext
setFullScreen
];
[
fullScreenContext
makeCurrentContext
];
unsigned
width
=
CGDisplayPixelsWide
(
kCGDirectMainDisplay
);
unsigned
height
=
CGDisplayPixelsHigh
(
kCGDirectMainDisplay
);
if
(
height
*
p_vout
->
output
.
i_aspect
<
width
*
VOUT_ASPECT_FACTOR
)
{
f_x
=
(
float
)
height
*
p_vout
->
output
.
i_aspect
/
width
/
VOUT_ASPECT_FACTOR
;
f_y
=
1
.
0
;
}
else
{
f_x
=
1
.
0
;
f_y
=
(
float
)
width
*
VOUT_ASPECT_FACTOR
/
p_vout
->
output
.
i_aspect
/
height
;
}
glViewport
(
0
,
0
,
width
,
height
);
[
self
initTextures
];
}
-
(
void
)
exitFullScreen
{
[
NSOpenGLContext
clearCurrentContext
];
[
fullScreenContext
clearDrawable
];
[
fullScreenContext
release
];
CGReleaseAllDisplays
();
currentContext
=
[
self
openGLContext
];
[
self
reshape
];
}
-
(
void
)
drawQuad
-
(
void
)
drawQuad
{
{
glBegin
(
GL_QUADS
);
glBegin
(
GL_QUADS
);
...
@@ -1529,7 +1610,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
...
@@ -1529,7 +1610,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
-
(
void
)
drawRect
:
(
NSRect
)
rect
-
(
void
)
drawRect
:
(
NSRect
)
rect
{
{
[
[
self
openGLContext
]
makeCurrentContext
];
[
currentContext
makeCurrentContext
];
/* Swap buffers only during the vertical retrace of the monitor.
/* Swap buffers only during the vertical retrace of the monitor.
http://developer.apple.com/documentation/GraphicsImaging/
http://developer.apple.com/documentation/GraphicsImaging/
...
@@ -1543,7 +1624,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
...
@@ -1543,7 +1624,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
if
(
!
b_init_done
)
if
(
!
b_init_done
)
{
{
[
[
self
openGLContext
]
flushBuffer
];
[
currentContext
flushBuffer
];
return
;
return
;
}
}
...
@@ -1561,7 +1642,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
...
@@ -1561,7 +1642,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
}
}
/* Wait for the job to be done */
/* Wait for the job to be done */
[
[
self
openGLContext
]
flushBuffer
];
[
currentContext
flushBuffer
];
}
}
@end
@end
...
@@ -1609,13 +1690,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
...
@@ -1609,13 +1690,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
}
}
}
}
if
(
p_vout
->
p_sys
->
i_opengl
)
if
(
p_vout
->
b_fullscreen
&&
!
p_vout
->
p_sys
->
i_opengl
)
{
/* XXX Fix fullscreen mode */
p_vout
->
b_fullscreen
=
0
;
}
if
(
p_vout
->
b_fullscreen
)
{
{
NSRect
screen_rect
=
[
o_screen
frame
];
NSRect
screen_rect
=
[
o_screen
frame
];
screen_rect
.
origin
.
x
=
screen_rect
.
origin
.
y
=
0
;
screen_rect
.
origin
.
x
=
screen_rect
.
origin
.
y
=
0
;
...
...
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