Git Product home page Git Product logo

Comments (8)

MasDennis avatar MasDennis commented on July 20, 2024

Where do you set the uniforms in the material?
If you set them in the setters it will not work properly. The right way to do this is to store the value in a class variable and then update the uniforms in the useProgram() method.

from rajawali.

 avatar commented on July 20, 2024

Hello Dennis!

http://pastebin.com/7TqrLR06

Here is the code, can you fix this? If yes, you can update it to your code, this is a simple class for Blending two images on one plane. Like in the old way: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

Calling with shaders:

planematerial=new MultiTextureBlendMaterial(
MultiTextureBlendMaterial.FactorType.GL_SRC_ALPHA,
MultiTextureBlendMaterial.FactorType.GL_ONE);

Thanks,
Leslie (lacroix)

from rajawali.

MasDennis avatar MasDennis commented on July 20, 2024

The problem is that you're setting the uniforms in the setters.
The solution is to create two class variables, mTime and mAlpha:

private float mTime;
private float mAlpha;

Change your setters to:

public void setTime(float time) {
    mTime = time;
}

public void setAlpha(float alpha) {
    mAlpha = alpha;
}

Now you can set the uniforms in the useProgram() method:

public void useProgram() {
    super.useProgram();
    GLES20.glUniform1f(mTimeHandle, mTime);
    GLES20.glUniform1f(mAlphaHandle, mAlpha);
}

from rajawali.

 avatar commented on July 20, 2024

Thanks I will try that

from rajawali.

 avatar commented on July 20, 2024

so basically every time when a change is happening I need to call useProgram?

    planematerial2.setTime(mTime); 
    planematerial2.setAlpha(lnpAlpha.value()); 
    planematerial2.useProgram();

Leslie

from rajawali.

MasDennis avatar MasDennis commented on July 20, 2024

No, useProgram is already called by RajawaliRenderer. You just need to override it in your material.

from rajawali.

 avatar commented on July 20, 2024

Now it is working (on GS1, GS2), only probleme is:

http://i50.tinypic.com/vol92d.png

it is on Galaxy Tab 10.1v
How can fix this?

from rajawali.

MasDennis avatar MasDennis commented on July 20, 2024

Hi Leslie,
Do you still have this problem? If so, can you send me the source code?
Thanks
Dennis

from rajawali.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.