Skip to content
This repository has been archived by the owner on Jan 1, 2020. It is now read-only.

discard statement #19

Closed
ptmt opened this issue Oct 12, 2015 · 9 comments
Closed

discard statement #19

ptmt opened this issue Oct 12, 2015 · 9 comments
Labels

Comments

@ptmt
Copy link
Contributor

ptmt commented Oct 12, 2015

It is possible to tell the fragment shader it shouldn't write any pixel. This can be done using the "discard" statement.

https://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/discard.php

The desired behavior: https://www.shadertoy.com/view/XlBXRy

The same (?) code on Rnplay.org which doesn't work as expected (maybe it shouldn't?): https://rnplay.org/apps/PUJnuw

@ptmt
Copy link
Contributor Author

ptmt commented Oct 12, 2015

Or is there any way to use previous computed fragment as a texture for next pass?

@gre
Copy link
Owner

gre commented Oct 12, 2015

There is nothing to do such thing yet. We currently always clear, this is why there are no accumulation of pixels.

I guess having a way to map the previous content as a texture would be a great feature as you suggested.

@gre gre added the feature label Oct 12, 2015
@gre
Copy link
Owner

gre commented Oct 12, 2015

Also on the RNPlay example, it's weird that it black-blinks, do you also get this in the phone?

@ptmt
Copy link
Contributor Author

ptmt commented Oct 12, 2015

No, it's okay on the simulator and device.

Thanks for a quick answer. I will try to make a proof-of-concept pull request. I'm also working on React Native for OS X and would be super nice to get GLSL on that eventually, so learning gl-react makes a lot of sense.

@gre
Copy link
Owner

gre commented Oct 12, 2015

Cool :)

I'm not sure what's the simplest way to implement this, my first thoughts are:
we need some way to copy the previous drawing buffer into a framebuffer.
Maybe using glBlitFramebuffer for this? However i'm not sure we have it in the OpenGL version we are using. It also is not available in WebGL (for future gl-react impl). But one solution is to use a "copy" shader.

Now on the user side:
I think we can introduce a new type of texture: GL.DrawingBuffer which means "use the previous drawing buffer".

<GL.View ... uniforms={{ backbuffer: GL.DrawingBuffer }} />

@ptmt
Copy link
Contributor Author

ptmt commented Oct 27, 2015

I just want to say that I was able to solve my issue with replacing shaders partially with ReactART instead.

It definetly would be much powerful to achieve that in gl-react way, hope to find time to figure out how. I also tried to not clearing buffer on the each iteration and of course the screen was blinking.

@gre
Copy link
Owner

gre commented Oct 27, 2015

https://github.com/ProjectSeptemberInc/gl-react/issues/25 should be able to address this via storing into a preserved framebuffer, there are some work involved and a bit more thoughts on the API / internal formats / implementations.

@gre
Copy link
Owner

gre commented Feb 17, 2016

I'm approaching a spec solution to solve this (and much more) see https://github.com/ProjectSeptemberInc/gl-react/issues/27#issuecomment-174298635
I'm closing this issue in favor of that one

@gre gre closed this as completed Feb 17, 2016
@ptmt
Copy link
Contributor Author

ptmt commented Feb 17, 2016

Thanks! Awesome project, one of the best in the RN world.

On Wed, 17 Feb 2016 at 16:13 Gaëtan Renaudeau notifications@github.com
wrote:

I'm approaching a spec solution to solve this (and much more) see ProjectSeptemberInc/gl-react#27
(comment)
https://github.com/ProjectSeptemberInc/gl-react/issues/27#issuecomment-174298635
I'm closing this issue in favor of that one


Reply to this email directly or view it on GitHub
#19 (comment)
.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants