当前位置: 首页>>代码示例>>Java>>正文


Java GLES20.glUniform3fv方法代码示例

本文整理汇总了Java中android.opengl.GLES20.glUniform3fv方法的典型用法代码示例。如果您正苦于以下问题:Java GLES20.glUniform3fv方法的具体用法?Java GLES20.glUniform3fv怎么用?Java GLES20.glUniform3fv使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.opengl.GLES20的用法示例。


在下文中一共展示了GLES20.glUniform3fv方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDrawFrame

import android.opengl.GLES20; //导入方法依赖的package包/类
@Override
public void onDrawFrame(int textureId) {
    onPreDrawElements();
    int iResolutionLocation = GLES20.glGetUniformLocation(glSimpleProgram.getProgramId(), "iResolution");
    GLES20.glUniform3fv(iResolutionLocation, 1,
            FloatBuffer.wrap(new float[]{(float) surfaceWidth, (float) surfaceHeight, 1.0f}));

    float currentTime = ((float) (System.currentTimeMillis() - START_TIME)) / 1000.0f;
    setUniform1f(glSimpleProgram.getProgramId(), "iGlobalTime",currentTime);

    TextureUtils.bindTexture2D(textureId, GLES20.GL_TEXTURE0,glSimpleProgram.getTextureSamplerHandle(),0);
    GLES20.glViewport(0,0,surfaceWidth,surfaceHeight);
    plane.draw();
}
 
开发者ID:zhangyaqiang,项目名称:Fatigue-Detection,代码行数:15,代码来源:ShaderToyAbsFilter.java

示例2: setupShaderInputs

import android.opengl.GLES20; //导入方法依赖的package包/类
void setupShaderInputs(int program, FloatBuffer vertex, FloatBuffer textureCoord, int[] iResolution, int[] iChannels, int[][] iChannelResolutions) {
    GLES20.glUseProgram(program);

    int iResolutionLocation = GLES20.glGetUniformLocation(program, "iResolution");
    GLES20.glUniform3fv(iResolutionLocation, 1,
            FloatBuffer.wrap(new float[]{(float) iResolution[0], (float) iResolution[1], 1.0f}));

    float time = ((float) (System.currentTimeMillis() - START_TIME)) / 1000.0f;
    int iGlobalTimeLocation = GLES20.glGetUniformLocation(program, "iGlobalTime");
    GLES20.glUniform1f(iGlobalTimeLocation, time);

    int iFrameLocation = GLES20.glGetUniformLocation(program, "iFrame");
    GLES20.glUniform1i(iFrameLocation, iFrame);

    int vPositionLocation = GLES20.glGetAttribLocation(program, "vPosition");
    GLES20.glEnableVertexAttribArray(vPositionLocation);
    GLES20.glVertexAttribPointer(vPositionLocation, 2, GLES20.GL_FLOAT, false, 4 * 2, vertex);

    int vTexCoordLocation = GLES20.glGetAttribLocation(program, "vTexCoord");
    GLES20.glEnableVertexAttribArray(vTexCoordLocation);
    GLES20.glVertexAttribPointer(vTexCoordLocation, 2, GLES20.GL_FLOAT, false, 4 * 2, textureCoord);

    for (int i = 0; i < iChannels.length; i++) {
        int sTextureLocation = GLES20.glGetUniformLocation(program, "iChannel" + i);
        GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + i);
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, iChannels[i]);
        GLES20.glUniform1i(sTextureLocation, i);
    }

    float _iChannelResolutions[] = new float[iChannelResolutions.length * 3];
    for (int i = 0; i < iChannelResolutions.length; i++) {
        _iChannelResolutions[i * 3] = iChannelResolutions[i][0];
        _iChannelResolutions[i * 3 + 1] = iChannelResolutions[i][1];
        _iChannelResolutions[i * 3 + 2] = 1.0f;
    }

    int iChannelResolutionLocation = GLES20.glGetUniformLocation(program, "iChannelResolution");
    GLES20.glUniform3fv(iChannelResolutionLocation,
            _iChannelResolutions.length, FloatBuffer.wrap(_iChannelResolutions));

    // For beauty
    int singleStepOffsetLocation = GLES20.glGetUniformLocation(program, "singleStepOffset");
     GLES20.glUniform2fv(singleStepOffsetLocation, 1, FloatBuffer.wrap(new float[] { 2.0f / 320.0f, 2.0f / 480.0f}));
}
 
开发者ID:SimonCherryGZ,项目名称:face-landmark-android,代码行数:45,代码来源:CameraFilter.java


注:本文中的android.opengl.GLES20.glUniform3fv方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。