Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
ac5be095
Commit
ac5be095
authored
Oct 22, 2011
by
Ryan C. Gordon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added stencil buffer support on iOS.
Thanks to Brian Barnes for the initial work on this patch!
parent
0b68d080
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
18 deletions
+29
-18
SDL_uikitopengles.m
src/video/uikit/SDL_uikitopengles.m
+1
-0
SDL_uikitopenglview.h
src/video/uikit/SDL_uikitopenglview.h
+1
-0
SDL_uikitopenglview.m
src/video/uikit/SDL_uikitopenglview.m
+27
-18
No files found.
src/video/uikit/SDL_uikitopengles.m
View file @
ac5be095
...
...
@@ -112,6 +112,7 @@ SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window)
bBits
:
_
this
->
gl
_
config
.
blue
_
size
aBits
:
_
this
->
gl
_
config
.
alpha
_
size
depthBits
:
_
this
->
gl
_
config
.
depth
_
size
stencilBits
:
_
this
->
gl
_
config
.
stencil
_
size
majorVersion
:
_
this
->
gl
_
config
.
major
_
version
]
;
data
->
view
=
view
;
...
...
src/video/uikit/SDL_uikitopenglview.h
View file @
ac5be095
...
...
@@ -60,6 +60,7 @@
bBits
:(
int
)
bBits
aBits
:(
int
)
aBits
depthBits
:(
int
)
depthBits
stencilBits
:(
int
)
stencilBits
majorVersion
:(
int
)
majorVersion
;
-
(
void
)
updateFrame
;
...
...
src/video/uikit/SDL_uikitopenglview.m
View file @
ac5be095
...
...
@@ -40,10 +40,12 @@
bBits
:
(
int
)
bBits
aBits
:
(
int
)
aBits
depthBits
:
(
int
)
depthBits
stencilBits
:
(
int
)
stencilBits
majorVersion
:
(
int
)
majorVersion
{
const
BOOL
useStencilBuffer
=
(
stencilBits
!=
0
);
const
BOOL
useDepthBuffer
=
(
depthBits
!=
0
);
NSString
*
colorFormat
=
nil
;
BOOL
useDepthBuffer
;
if
(
rBits
==
8
&&
gBits
==
8
&&
bBits
==
8
)
{
/* if user specifically requests rbg888 or some color format higher than 16bpp */
...
...
@@ -56,22 +58,19 @@
depthBufferFormat
=
0
;
if
(
useDepthBuffer
)
{
if
(
depthBits
==
24
)
{
useDepthBuffer
=
YES
;
depthBufferFormat
=
GL_DEPTH_COMPONENT24_OES
;
}
else
if
(
depthBits
==
0
)
{
useDepthBuffer
=
NO
;
}
else
{
/* default case when depth buffer is not disabled */
/*
strange, even when we use this, we seem to get a 24 bit depth buffer on iPhone.
perhaps that's the only depth format iPhone actually supports
*/
useDepthBuffer
=
YES
;
depthBufferFormat
=
GL_DEPTH_COMPONENT16_OES
;
}
}
if
((
self
=
[
super
initWithFrame
:
frame
]))
{
// Get the layer
...
...
@@ -103,12 +102,22 @@
glGetRenderbufferParameterivOES
(
GL_RENDERBUFFER_OES
,
GL_RENDERBUFFER_WIDTH_OES
,
&
backingWidth
);
glGetRenderbufferParameterivOES
(
GL_RENDERBUFFER_OES
,
GL_RENDERBUFFER_HEIGHT_OES
,
&
backingHeight
);
if
(
useDepthBuffer
)
{
if
((
useDepthBuffer
)
||
(
useStencilBuffer
))
{
if
(
useStencilBuffer
)
{
// Apparently you need to pack stencil and depth into one buffer.
// !!! FIXME: this is the only thing (currently) supported. May not always be true.
depthBufferFormat
=
GL_DEPTH24_STENCIL8_OES
;
}
glGenRenderbuffersOES
(
1
,
&
depthRenderbuffer
);
glBindRenderbufferOES
(
GL_RENDERBUFFER_OES
,
depthRenderbuffer
);
glRenderbufferStorageOES
(
GL_RENDERBUFFER_OES
,
depthBufferFormat
,
backingWidth
,
backingHeight
);
if
(
useDepthBuffer
)
{
glFramebufferRenderbufferOES
(
GL_FRAMEBUFFER_OES
,
GL_DEPTH_ATTACHMENT_OES
,
GL_RENDERBUFFER_OES
,
depthRenderbuffer
);
}
if
(
useStencilBuffer
)
{
glFramebufferRenderbufferOES
(
GL_FRAMEBUFFER_OES
,
GL_STENCIL_ATTACHMENT_OES
,
GL_RENDERBUFFER_OES
,
depthRenderbuffer
);
}
}
if
(
glCheckFramebufferStatusOES
(
GL_FRAMEBUFFER_OES
)
!=
GL_FRAMEBUFFER_COMPLETE_OES
)
{
return
NO
;
...
...
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