Comments (2)
This should help:
https://github.com/MasDennis/RajawaliExamples/blob/master/src/com/monyetmabuk/rajawali/tutorials/RajawaliRipplesRenderer.java
https://github.com/MasDennis/RajawaliExamples/blob/master/src/com/monyetmabuk/rajawali/tutorials/RajawaliRipplesActivity.java
On Jun 3, 2012 3:48 PM, "Chalres" <
[email protected]>
wrote:
I have a customer shader that will generate a heart beat animation.
https://gist.github.com/2863517My questions is, how can I utilise the onTouch event to pass in an
additional uniform variable to change the color of the heart.I have tried to create a setter use below lines
public void setTouch(float color) {
// TODO Auto-generated method stub
GLES20.glUniform1f(muColorHandle, color);
}And also create a getter in the setShaders method
@OverRide
public void setShaders(String vertexShader, String fragmentShader)
{
super.setShaders(vertexShader, fragmentShader);
muTimeHandle = GLES20.glGetUniformLocation(mProgram,
"uTime");
muColorHandle = GLES20.glGetUniformLocation(mProgram,
"uColor");
if(muTimeHandle == -1) {
throw new RuntimeException("Could not get uniform
location for uTime");
}
}And modify the mCustomFShader string to add an additional variable
"uniform float uColor;\n" +The problem is when I try to invoke the mouse setter from the custom
render,
@OverRide
public void onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
super.onTouchEvent(event);
mCustomMaterial.setTouch(event.getX());
}nothing seems to happen and I receive following error message from Eclipse
logcat.
06-03 23:44:06.583: E/libEGL(31527): call to OpenGL ES API with no current
context (logged once per thread)Can you please kindly review the code and suggest what is the best way to
pass in additional variable into custom shader
Reply to this email directly or view it on GitHub:
https://github.com/MasDennis/Rajawali/issues/56
from rajawali.
you have to add it in a Que:
mSurfaceView.queueEvent(
new Runnable()
{
public void run()
{
mCustomMaterial.setTouch(event.getX());
}
}
);
from rajawali.
Related Issues (20)
- build issue com.github.ben-manes.versions not found HOT 3
- jcenter repository has been depracated
- Seeking Luminance based desaturation
- Seeking Lighten and Darken Blend Modes
- Seeking point texture plugin
- improving SpriteSheetMaterialPlugin efficiency HOT 1
- Seeking Flexible Sprite Sheet Animation
- Seeking runtime adjustment of AlphaMask threshold
- Please restore AnimatedSpritesFragment to example app
- Stencil Buffer is not initializing corrrectly,
- Some `ScreenQuad` materials spew error messages at frame rate
- Objects starts to render with delay when camera if far from them HOT 1
- How to translate object with touch screen?
- anyway to implement ray in the library?
- Create Sphere with phiStart, phiLength, thetaStart, thetaLength HOT 1
- LoaderFBX.java:347 ArrayIndexOutOfBoundsException
- display obj model in AR
- Examples are broken
- When will the new version be released?
- load obj file fail,NumberFormatException: For input string: "nan"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rajawali.