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
57bc440b
Commit
57bc440b
authored
Oct 24, 2011
by
Ryan C. Gordon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More cleanup in SDL_uikitopenglview.m
parent
ac5be095
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
29 deletions
+17
-29
SDL_uikitopenglview.m
src/video/uikit/SDL_uikitopenglview.m
+17
-29
No files found.
src/video/uikit/SDL_uikitopenglview.m
View file @
57bc440b
...
...
@@ -43,37 +43,22 @@
stencilBits
:
(
int
)
stencilBits
majorVersion
:
(
int
)
majorVersion
{
const
BOOL
useStencilBuffer
=
(
stencilBits
!=
0
);
const
BOOL
useDepthBuffer
=
(
depthBits
!=
0
);
NSString
*
colorFormat
=
nil
;
if
(
rBits
==
8
&&
gBits
==
8
&&
bBits
==
8
)
{
/* if user specifically requests rbg888 or some color format higher than 16bpp */
colorFormat
=
kEAGLColorFormatRGBA8
;
}
else
{
/* default case (faster) */
colorFormat
=
kEAGLColorFormatRGB565
;
}
depthBufferFormat
=
0
;
if
(
useDepthBuffer
)
{
if
(
depthBits
==
24
)
{
depthBufferFormat
=
GL_DEPTH_COMPONENT24_OES
;
}
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
*/
depthBufferFormat
=
GL_DEPTH_COMPONENT16_OES
;
if
(
(
self
=
[
super
initWithFrame
:
frame
])
)
{
const
BOOL
useStencilBuffer
=
(
stencilBits
!=
0
);
const
BOOL
useDepthBuffer
=
(
depthBits
!=
0
)
;
NSString
*
colorFormat
=
nil
;
if
(
rBits
==
8
&&
gBits
==
8
&&
bBits
==
8
)
{
/*
if user specifically requests rbg888 or some color format higher than 16bpp */
colorFormat
=
kEAGLColorFormatRGBA8
;
}
else
{
/* default case (faster)
*/
colorFormat
=
kEAGLColorFormatRGB565
;
}
}
if
((
self
=
[
super
initWithFrame
:
frame
]))
{
// Get the layer
/* Get the layer */
CAEAGLLayer
*
eaglLayer
=
(
CAEAGLLayer
*
)
self
.
layer
;
eaglLayer
.
opaque
=
YES
;
...
...
@@ -104,10 +89,13 @@
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.
/* Apparently you need to pack stencil and depth into one buffer. */
depthBufferFormat
=
GL_DEPTH24_STENCIL8_OES
;
}
else
if
(
useDepthBuffer
)
{
/* iOS only has 24-bit depth buffers, even with GL_DEPTH_COMPONENT16_OES */
depthBufferFormat
=
GL_DEPTH_COMPONENT24_OES
;
}
glGenRenderbuffersOES
(
1
,
&
depthRenderbuffer
);
glBindRenderbufferOES
(
GL_RENDERBUFFER_OES
,
depthRenderbuffer
);
glRenderbufferStorageOES
(
GL_RENDERBUFFER_OES
,
depthBufferFormat
,
backingWidth
,
backingHeight
);
...
...
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