Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gl-react-native-v2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ym
gl-react-native-v2
Commits
3c217d7e
Commit
3c217d7e
authored
Mar 09, 2016
by
Gaëtan Renaudeau
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #70 from exponentjs/master
add ability to set vertex shader from JS
parents
89c2d7e7
56e855c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
ios/RNGLContext.m
ios/RNGLContext.m
+11
-3
No files found.
ios/RNGLContext.m
View file @
3c217d7e
...
@@ -49,13 +49,17 @@ RCT_EXPORT_MODULE()
...
@@ -49,13 +49,17 @@ RCT_EXPORT_MODULE()
withConfig
:(
NSDictionary
*
)
config
withConfig
:(
NSDictionary
*
)
config
withOnCompile
:(
RCTResponseSenderBlock
)
onCompile
withOnCompile
:(
RCTResponseSenderBlock
)
onCompile
{
{
NSString
*
vert
=
[
RCTConvert
NSString
:
config
[
@"vert"
]];
NSString
*
frag
=
[
RCTConvert
NSString
:
config
[
@"frag"
]];
NSString
*
frag
=
[
RCTConvert
NSString
:
config
[
@"frag"
]];
NSString
*
name
=
[
RCTConvert
NSString
:
config
[
@"name"
]];
NSString
*
name
=
[
RCTConvert
NSString
:
config
[
@"name"
]];
if
(
!
vert
)
{
vert
=
fullViewportVert
;
}
if
(
!
frag
)
{
if
(
!
frag
)
{
RCTLogError
(
@"Shader '%@': missing frag field"
,
name
);
RCTLogError
(
@"Shader '%@': missing frag field"
,
name
);
return
;
return
;
}
}
GLShader
*
shader
=
[[
GLShader
alloc
]
initWithContext
:
_context
withName
:
name
withVert
:
fullViewportV
ert
withFrag
:
frag
];
GLShader
*
shader
=
[[
GLShader
alloc
]
initWithContext
:
_context
withName
:
name
withVert
:
v
ert
withFrag
:
frag
];
NSError
*
error
;
NSError
*
error
;
bool
success
=
[
shader
ensureCompiles
:
&
error
];
bool
success
=
[
shader
ensureCompiles
:
&
error
];
if
(
onCompile
)
{
if
(
onCompile
)
{
...
@@ -112,13 +116,17 @@ NSDictionary* glTypesString (NSDictionary *types) {
...
@@ -112,13 +116,17 @@ NSDictionary* glTypesString (NSDictionary *types) {
RCT_EXPORT_METHOD
(
addShader
:
(
nonnull
NSNumber
*
)
id
RCT_EXPORT_METHOD
(
addShader
:
(
nonnull
NSNumber
*
)
id
withConfig
:
(
NSDictionary
*
)
config
withConfig
:
(
NSDictionary
*
)
config
withOnCompile
:
(
RCTResponseSenderBlock
)
onCompile
)
{
withOnCompile
:
(
RCTResponseSenderBlock
)
onCompile
)
{
NSString
*
vert
=
[
RCTConvert
NSString
:
config
[
@"vert"
]];
NSString
*
frag
=
[
RCTConvert
NSString
:
config
[
@"frag"
]];
NSString
*
frag
=
[
RCTConvert
NSString
:
config
[
@"frag"
]];
NSString
*
name
=
[
RCTConvert
NSString
:
config
[
@"name"
]];
NSString
*
name
=
[
RCTConvert
NSString
:
config
[
@"name"
]];
if
(
!
vert
)
{
vert
=
fullViewportVert
;
}
if
(
!
frag
)
{
if
(
!
frag
)
{
RCTLogError
(
@"Shader '%@': missing frag field"
,
name
);
RCTLogError
(
@"Shader '%@': missing frag field"
,
name
);
return
;
return
;
}
}
GLShader
*
shader
=
[[
GLShader
alloc
]
initWithContext
:
_context
withName
:
name
withVert
:
fullViewportV
ert
withFrag
:
frag
];
GLShader
*
shader
=
[[
GLShader
alloc
]
initWithContext
:
_context
withName
:
name
withVert
:
v
ert
withFrag
:
frag
];
NSError
*
error
;
NSError
*
error
;
bool
success
=
[
shader
ensureCompiles
:
&
error
];
bool
success
=
[
shader
ensureCompiles
:
&
error
];
if
(
onCompile
)
{
if
(
onCompile
)
{
...
@@ -158,4 +166,4 @@ RCT_EXPORT_METHOD(removeShader:(nonnull NSNumber *)id) {
...
@@ -158,4 +166,4 @@ RCT_EXPORT_METHOD(removeShader:(nonnull NSNumber *)id) {
return
[
self
moduleForClass
:[
RNGLContext
class
]];
return
[
self
moduleForClass
:[
RNGLContext
class
]];
}
}
@end
@end
\ No newline at end of file
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