Java Code Examples for android.opengl.GLES20#glUniform1iv()

The following examples show how to use android.opengl.GLES20#glUniform1iv() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MD360VideoTexture.java    From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean texture(MD360Program program) {
    int glSurfaceTexture = getCurrentTextureId();
    if (isEmpty(glSurfaceTexture)) return false;
    if (mSurfaceTexture == null) return false;

    mSurfaceTexture.updateTexImage();

    // surface transform get
    mSurfaceTexture.getTransformMatrix(mTransformMatrix);
    GLES20.glUniform1iv(program.getUseTextureTransformHandle(), 1, sUseTransform, 0);
    GLES20.glUniformMatrix4fv(program.getSTMatrixHandle(), 1, false, mTransformMatrix, 0);
    return true;
}
 
Example 2
Source File: MD360VideoTexture.java    From MD360Player4Android with Apache License 2.0 5 votes vote down vote up
@Override
public boolean texture(MD360Program program) {
    int glSurfaceTexture = getCurrentTextureId();
    if (isEmpty(glSurfaceTexture)) return false;
    if (mSurfaceTexture == null) return false;

    mSurfaceTexture.updateTexImage();

    // surface transform get
    mSurfaceTexture.getTransformMatrix(mTransformMatrix);
    GLES20.glUniform1iv(program.getUseTextureTransformHandle(), 1, sUseTransform, 0);
    GLES20.glUniformMatrix4fv(program.getSTMatrixHandle(), 1, false, mTransformMatrix, 0);
    return true;
}
 
Example 3
Source File: MD360CubemapTexture.java    From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean texture(MD360Program program) {
    if (mTextureDirty.get()){
        mTextureDirty.set(false);
        currentFaceLoading = CUBE_FRONT;

        loadTexture();

        mIsReady = false;
    }


    AsyncCallback asyncCallback = mTmpAsyncCallback;
    int textureId = getCurrentTextureId();

    if (!mIsReady && asyncCallback != null) {

        if (asyncCallback.hasBitmap()){
            Bitmap bitmap = asyncCallback.getBitmap();
            Log.d(TAG, "Set texture "+currentFaceLoading);

            textureInThread(textureId, program, bitmap, currentFaceLoading);
            asyncCallback.releaseBitmap();

            currentFaceLoading++;
            if(currentFaceLoading < 6)
                requestBitmap();
        }

        if(currentFaceLoading >= 6) {
            mIsReady = true;

            if(mCubemapProvider != null) {
                MDMainHandler.sharedHandler().post(new Runnable() {
                    @Override
                    public void run() {
                        mCubemapProvider.onReady();
                    }
                });
            }
        }
    }

    if (isReady() && textureId != 0){
        // Bind texture
        // Set texture 0 as active texture
        GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
        // Bind the cube map texture to the active opengl texture
        GLES20.glBindTexture(GLES20.GL_TEXTURE_CUBE_MAP, textureId);
        // Set shader texture variable to texture 0
        GLES20.glUniform1i(program.getTextureUniformHandle(), 0);
        // Set shader isSkybox flag to true
        GLES20.glUniform1iv(program.getIsSkyboxHandle(), 1, sIsSkybox, 0);
    }

    return true;
}
 
Example 4
Source File: MD360CubemapTexture.java    From MD360Player4Android with Apache License 2.0 4 votes vote down vote up
@Override
public boolean texture(MD360Program program) {
    if (mTextureDirty.get()){
        mTextureDirty.set(false);
        currentFaceLoading = CUBE_FRONT;

        loadTexture();

        mIsReady = false;
    }


    AsyncCallback asyncCallback = mTmpAsyncCallback;
    int textureId = getCurrentTextureId();

    if (!mIsReady && asyncCallback != null) {

        if (asyncCallback.hasBitmap()){
            Bitmap bitmap = asyncCallback.getBitmap();
            Log.d(TAG, "Set texture "+currentFaceLoading);

            textureInThread(textureId, program, bitmap, currentFaceLoading);
            asyncCallback.releaseBitmap();

            currentFaceLoading++;
            if(currentFaceLoading < 6)
                requestBitmap();
        }

        if(currentFaceLoading >= 6) {
            mIsReady = true;

            if(mCubemapProvider != null) {
                MDMainHandler.sharedHandler().post(new Runnable() {
                    @Override
                    public void run() {
                        mCubemapProvider.onReady();
                    }
                });
            }
        }
    }

    if (isReady() && textureId != 0){
        // Bind texture
        // Set texture 0 as active texture
        GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
        // Bind the cube map texture to the active opengl texture
        GLES20.glBindTexture(GLES20.GL_TEXTURE_CUBE_MAP, textureId);
        // Set shader texture variable to texture 0
        GLES20.glUniform1i(program.getTextureUniformHandle(), 0);
        // Set shader isSkybox flag to true
        GLES20.glUniform1iv(program.getIsSkyboxHandle(), 1, sIsSkybox, 0);
    }

    return true;
}
 
Example 5
Source File: AndroidGL.java    From trekarta with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void uniform1iv(int location, int count, IntBuffer v) {
    GLES20.glUniform1iv(location, count, v);

}
 
Example 6
Source File: AndroidGL.java    From trekarta with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void uniform1iv(int location, int count, int[] v, int offset) {
    GLES20.glUniform1iv(location, count, v, offset);
}