Giter VIP home page Giter VIP logo

Comments (8)

MasDennis avatar MasDennis commented on June 15, 2024

GL_SMOOTH and GL_FLAT are 1.1 fixed pipeline functionality. You can use DiffuseMaterial or PhongMaterial instead.
Do you mean the camera's maxZ? mCamera.setFarPlane().

from rajawali.

 avatar commented on June 15, 2024

thanks! And how to use transparency? So ALPHA_TEST, GL_GREATER > 0.1f (cut
the alpha png-s) in 2.0? this is a shader too?

thanks,
Leslie

On Wed, May 30, 2012 at 6:57 PM, Dennis Ippel <
[email protected]

wrote:

GL_SMOOTH and GL_FLAT are 1.1 fixed pipeline functionality. You can use
DiffuseMaterial or PhongMaterial instead.
Do you mean the camera's maxZ? mCamera.setFarPlane().


Reply to this email directly or view it on GitHub:
#42 (comment)

from rajawali.

MasDennis avatar MasDennis commented on June 15, 2024

my3DObject.setTransparent(true);

from rajawali.

 avatar commented on June 15, 2024

no

i dont want to use this:

GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);

i d like to use this:

    gl.glEnable(GL10.GL_ALPHA_TEST);
    gl.glAlphaFunc(GL11.GL_GREATER, 0.1f);

but glAlphaFunc is not exists (non fixed pipeline)

from rajawali.

MasDennis avatar MasDennis commented on June 15, 2024

I bet you do, but that's using GL10, not GLES20. Fixed pipeline functionality as well.

from rajawali.

 avatar commented on June 15, 2024

ok the code is: (a shader) please add this to yout project if u like it (this is ignoring the alpha<0.2f values)


package rajawali.materials;

/*
 * created by lacroix (lacasrac)
 */

public class AlphatestMaterial extends AMaterial {
    protected static final String mVShader = 
        "uniform mat4 uMVPMatrix;\n" +

        "attribute vec4 aPosition;\n" +
        "attribute vec2 aTextureCoord;\n" +
        "attribute vec4 aColor;\n" +

        "varying vec2 vTextureCoord;\n" +
        "varying vec4 vColor;\n" +      
        
        "void main() {\n" +
        "   gl_Position = uMVPMatrix * aPosition;\n" +
        "   vTextureCoord = aTextureCoord;\n" +
        "   vColor = aColor;\n" +
        "}\n";
    
    protected static final String mFShader = 
        "precision mediump float;\n" +

        "varying vec2 vTextureCoord;\n" +
        "uniform sampler2D uDiffuseTexture;\n" +
        "varying vec4 vColor;\n" +

        "void main() {\n" +
        "#ifdef TEXTURED \n" +
        "   vec4 color  = texture2D(uDiffuseTexture, vTextureCoord);\n" +
        "   if(color.a > 0.2)\n"+
        "       gl_FragColor = color;\n"+
        "   else\n"+
        "       discard;\n"+
        "#else\n" +
        "   gl_FragColor = vColor;\n" +
        "#endif\n" +
        "}\n";
    
    public AlphatestMaterial() {
        super(mVShader, mFShader, false);
        setShaders();
    }
    
    public AlphatestMaterial(String vertexShader, String fragmentShader) {
        super(vertexShader, fragmentShader, false);
        setShaders();
    }
}

from rajawali.

MasDennis avatar MasDennis commented on June 15, 2024

Cheers man, very much appreciated.
Why not fork Rajawali, make the changes and then submit a pull request?
Will save me some work and we'll use the true power of Github :-)

from rajawali.

 avatar commented on June 15, 2024

Hello!

I am new here, I can't use this site yet at the moment, but I will help, if you like my work.

Best regards,
Lacroix

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.