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


Java GLES20.glUniform1f方法代码示例

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


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

示例1: prepareTexture

import android.opengl.GLES20; //导入方法依赖的package包/类
private void prepareTexture(BasicTexture texture, int program, ShaderParameter[] params) {
    deleteRecycledResources();
    GLES20.glUseProgram(program);
    checkError();
    GLES20.glDisable(GLES20.GL_BLEND);
    checkError();
    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    checkError();
    texture.onBind(this);
    GLES20.glBindTexture(GL_TARGET, texture.getId());
    checkError();
    GLES20.glUniform1i(params[INDEX_TEXTURE_SAMPLER].handle, 0);
    checkError();
    GLES20.glUniform1f(params[INDEX_ALPHA].handle, 1);
    checkError();
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:17,代码来源:GLES20Canvas.java

示例2: updateFloatValue

import android.opengl.GLES20; //导入方法依赖的package包/类
private void updateFloatValue(float... value) {
    switch (value.length) {
        case 1:
            GLES20.glUniform1f(handle(), value[0]);
            break;
        case 2:
            GLES20.glUniform2f(handle(), value[0], value[1]);
            break;
        case 3:
            GLES20.glUniform3f(handle(), value[0], value[1], value[2]);
            break;
        case 4:
            GLES20.glUniform4f(handle(), value[0], value[1], value[2], value[3]);
            break;
        case 16:
            GLES20.glUniformMatrix4fv(handle(), 1, false, value, 0);
        default:
            break;
    }
}
 
开发者ID:gplibs,项目名称:android-magic-surface-view,代码行数:21,代码来源:GLUniformParameter.java

示例3: drawSharpenPass

import android.opengl.GLES20; //导入方法依赖的package包/类
private void drawSharpenPass() {
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, renderFrameBuffer[0]);
    GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, renderTexture[0], 0);
    GLES20.glClear(0);

    GLES20.glUseProgram(sharpenShaderProgram);
    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, renderTexture[1]);
    GLES20.glUniform1i(sharpenSourceImageHandle, 0);
    if (showOriginal) {
        GLES20.glUniform1f(sharpenHandle, 0);
    } else {
        GLES20.glUniform1f(sharpenHandle, getSharpenValue());
    }
    GLES20.glUniform1f(sharpenWidthHandle, renderBufferWidth);
    GLES20.glUniform1f(sharpenHeightHandle, renderBufferHeight);
    GLES20.glEnableVertexAttribArray(sharpenInputTexCoordHandle);
    GLES20.glVertexAttribPointer(sharpenInputTexCoordHandle, 2, GLES20.GL_FLOAT, false, 8, textureBuffer);
    GLES20.glEnableVertexAttribArray(sharpenPositionHandle);
    GLES20.glVertexAttribPointer(sharpenPositionHandle, 2, GLES20.GL_FLOAT, false, 8, vertexInvertBuffer);
    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:23,代码来源:PhotoFilterView.java

示例4: draw

import android.opengl.GLES20; //导入方法依赖的package包/类
public void draw() {
    GLES20.glEnable(GLES20.GL_BLEND);
    GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
    GLES20.glUseProgram(mProgram);

    int mPositionHandle = GLES20.glGetAttribLocation(mProgram, "aPosition");
    GLES20.glEnableVertexAttribArray(mPositionHandle);
    int vertexStride = COORDS_PER_VERTEX * 4;
    GLES20.glVertexAttribPointer(mPositionHandle, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false, vertexStride, mVertexBuffer);

    GLES20.glUniform4fv(GLES20.glGetUniformLocation(mProgram, "aColor"), 1, mColor, 0);
    GLES20.glUniform2f(GLES20.glGetUniformLocation(mProgram, "aCirclePosition"), mCenterX, mCenterY);
    GLES20.glUniform1f(GLES20.glGetUniformLocation(mProgram, "aRadius"), mRadius);
    GLES20.glDrawElements(GLES20.GL_TRIANGLES, mDrawOrder.length, GLES20.GL_UNSIGNED_SHORT, mDrawListBuffer);
    GLES20.glDisableVertexAttribArray(mPositionHandle);
}
 
开发者ID:beetsolutions,项目名称:opengl_circle,代码行数:17,代码来源:GLCircleSprite.java

示例5: setMaterial

import android.opengl.GLES20; //导入方法依赖的package包/类
private void setMaterial(float r,float g,float b,float a) {
    //マテリアルの環境光色の指定
    GLES20.glUniform4f(GLES.materialAmbientHandle,r,g,b,a);

    //マテリアルの拡散光色の指定
    GLES20.glUniform4f(GLES.materialDiffuseHandle,r,g,b,a);

    //マテリアルの鏡面光色と鏡面指数の指定
    GLES20.glUniform4f(GLES.materialSpecularHandle,r,g,b,a);
    GLES20.glUniform1f(GLES.materialShininessHandle,0.6f);
}
 
开发者ID:jphacks,项目名称:TK_1701,代码行数:12,代码来源:RaderObject_UI.java

示例6: bindGLSLValues

import android.opengl.GLES20; //导入方法依赖的package包/类
@Override
protected void bindGLSLValues(float[] mvpMatrix, FloatBuffer vertexBuffer, int coordsPerVertex,
                              int vertexStride, float[] texMatrix, FloatBuffer texBuffer, int texStride) {
    super.bindGLSLValues(mvpMatrix, vertexBuffer, coordsPerVertex, vertexStride, texMatrix,
            texBuffer, texStride);

    if (mWidthOrHeight) {
        GLES20.glUniform1f(muTexelWidthOffset,
                mIncomingWidth == 0 ? 0f : mBlurRatio / mIncomingWidth);
    } else {
        GLES20.glUniform1f(muTexelHeightOffset,
                mIncomingHeight == 0 ? 0f : mBlurRatio / mIncomingHeight);
    }
}
 
开发者ID:hoanganhtuan95ptit,项目名称:EditPhoto,代码行数:15,代码来源:CameraFilterGaussianSingleBlur.java

示例7: draw

import android.opengl.GLES20; //导入方法依赖的package包/类
/**
 * Renders the point cloud.
 *
 * @param pose              the current point cloud pose, from {@link Frame#getPointCloudPose()}.
 * @param cameraView        the camera view matrix for this frame, typically from
 *                          {@link Frame#getViewMatrix(float[], int)}.
 * @param cameraPerspective the camera projection matrix for this frame, typically from
 *                          {@link Session#getProjectionMatrix(float[], int, float, float)}.
 */
public void draw(Pose pose, float[] cameraView, float[] cameraPerspective) {
    float[] modelMatrix = new float[16];
    pose.toMatrix(modelMatrix, 0);

    float[] modelView = new float[16];
    float[] modelViewProjection = new float[16];
    Matrix.multiplyMM(modelView, 0, cameraView, 0, modelMatrix, 0);
    Matrix.multiplyMM(modelViewProjection, 0, cameraPerspective, 0, modelView, 0);

    ShaderUtil.checkGLError(TAG, "Before draw");

    GLES20.glUseProgram(mProgramName);
    GLES20.glEnableVertexAttribArray(mPositionAttribute);
    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mVbo);
    GLES20.glVertexAttribPointer(
            mPositionAttribute, 4, GLES20.GL_FLOAT, false, BYTES_PER_POINT, 0);
    GLES20.glUniform4f(mColorUniform, 31.0f / 255.0f, 188.0f / 255.0f, 210.0f / 255.0f, 1.0f);
    GLES20.glUniformMatrix4fv(mModelViewProjectionUniform, 1, false, modelViewProjection, 0);
    GLES20.glUniform1f(mPointSizeUniform, 5.0f);

    GLES20.glDrawArrays(GLES20.GL_POINTS, 0, mNumPoints);
    GLES20.glDisableVertexAttribArray(mPositionAttribute);
    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);

    ShaderUtil.checkGLError(TAG, "Draw");
}
 
开发者ID:nimbl3,项目名称:nimbl3-arcore,代码行数:36,代码来源:PointCloudRenderer.java

示例8: glUniform1f

import android.opengl.GLES20; //导入方法依赖的package包/类
public static void glUniform1f(final int aUniformHandle, final float aValue)
{
    //.if DESKTOP
    //|gl.glUniform1f(aUniformHandle, aValue);
    //.elseif ANDROID
    GLES20.glUniform1f(aUniformHandle, aValue);
    //.endif
    
}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:10,代码来源:GL.java

示例9: draw

import android.opengl.GLES20; //导入方法依赖的package包/类
public void draw() {

        if (mTexture == 0) {
            mTexture = OpenGLUtils.loadTexture(mResource);
        }

        if (mProgram == null) {
            mProgram = new ImageProgram();
        }

        setCube();

        float translateX = (mPosition.x + mTranslationX) * 2.0f / mViewportSize.x;
        float translateY = (-mPosition.y - mTranslationY) * 2.0f / mViewportSize.y;
        float[] mvp = new float[16];
        Matrix.setIdentityM(mvp, 0);
        Matrix.translateM(mMVPMatrix, 0, mvp, 0, translateX, translateY, 0);
        mMVPBuffer.position(0);
        mMVPBuffer.put(mMVPMatrix).position(0);

        GLES20.glUseProgram(mProgram.mProgram);

        mCubeBuffer.position(0);
        GLES20.glVertexAttribPointer(mProgram.mAPositionHandle, 2, GLES20.GL_FLOAT, false, 0, mCubeBuffer);
        GLES20.glEnableVertexAttribArray(mProgram.mAPositionHandle);

        mTextureBuffer.position(0);
        GLES20.glVertexAttribPointer(mProgram.mATextureCoordinateHandle, 2, GLES20.GL_FLOAT, false, 0, mTextureBuffer);
        GLES20.glEnableVertexAttribArray(mProgram.mATextureCoordinateHandle);

        GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
        GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, mTexture);
        GLES20.glUniform1i(mProgram.mUTextureHandle, 0);

        mMVPBuffer.position(0);
        GLES20.glUniformMatrix4fv(mProgram.mUMVPMatrixHandle, 1, false, mMVPBuffer);

        GLES20.glUniform1f(mProgram.mUOpacityHandle, mOpacity);

        GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);

        GLES20.glDisableVertexAttribArray(mProgram.mAPositionHandle);
        GLES20.glDisableVertexAttribArray(mProgram.mATextureCoordinateHandle);
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
    }
 
开发者ID:vipycm,项目名称:mao-android,代码行数:46,代码来源:GLOESImageView.java

示例10: onSetExpandData

import android.opengl.GLES20; //导入方法依赖的package包/类
@Override
protected void onSetExpandData() {
    super.onSetExpandData();
    GLES20.glUniform1f(mGLWidth,this.mWidth);
    GLES20.glUniform1f(mGLHeight,this.mHeight);
}
 
开发者ID:aiyaapp,项目名称:AAVT,代码行数:7,代码来源:YuvOutputFilter.java

示例11: onSetExpandData

import android.opengl.GLES20; //导入方法依赖的package包/类
@Override
protected void onSetExpandData() {
    super.onSetExpandData();
    GLES20.glUniform1f(mGLWidth,mWidth);
    GLES20.glUniform1f(mGLHeight,mHeight);
}
 
开发者ID:aiyaapp,项目名称:AAVT,代码行数:7,代码来源:WaterColorFilter.java

示例12: value1f

import android.opengl.GLES20; //导入方法依赖的package包/类
public void value1f(float value) {
	GLES20.glUniform1f(location, value);
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:4,代码来源:Uniform.java

示例13: bindShaderValues

import android.opengl.GLES20; //导入方法依赖的package包/类
@Override
protected void bindShaderValues() {
    super.bindShaderValues();
    GLES20.glUniform1f(mMixHandle, mMix);
}
 
开发者ID:uestccokey,项目名称:EZFilter,代码行数:6,代码来源:BWRender.java

示例14: render

import android.opengl.GLES20; //导入方法依赖的package包/类
/**
     * draws Quad shape object.
     * @param aMVPMatrix
     * @param texture
     */
    public void render(float[] aMVPMatrix, final int texture) {
//        // Use culling to remove back faces.
        GLES20.glDisable(GLES20.GL_CULL_FACE);

        // Set our per-vertex lighting program.
        GLES20.glUseProgram(aQuadProgramHandle);

        // Set program handles for cube drawing.
        aMVPMatrixHandle = GLES20.glGetUniformLocation(aQuadProgramHandle, "u_MVPMatrix");
        aPositionHandle = GLES20.glGetAttribLocation(aQuadProgramHandle, "a_Position");
        aColorHandle = GLES20.glGetAttribLocation(aQuadProgramHandle, "a_Color");
        aTextureCoordinateHandle = GLES20.glGetAttribLocation(aQuadProgramHandle, "a_TexCoordinate");
        aTextureUniformHandle = GLES20.glGetUniformLocation(aQuadProgramHandle, "u_Texture");

        // Pass in the combined matrix.
        GLES20.glUniformMatrix4fv(aMVPMatrixHandle, 1, false, aMVPMatrix, 0);

        if (qvbo[0] > 0 && qibo[0] > 0) {
            GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, qvbo[0]);

            // Bind Attributes
            GLES20.glVertexAttribPointer(aPositionHandle, POSITION_DATA_SIZE, GLES20.GL_FLOAT, false,
                    STRIDE, 0);
            GLES20.glEnableVertexAttribArray(aPositionHandle);

            GLES20.glVertexAttribPointer(aColorHandle, COLOR_DATA_SIZE, GLES20.GL_FLOAT, false,
                    STRIDE, (POSITION_DATA_SIZE) * BYTES_PER_FLOAT);
            GLES20.glEnableVertexAttribArray(aColorHandle);

            GLES20.glVertexAttribPointer(aTextureCoordinateHandle, UV_DATA_SIZE, GLES20.GL_FLOAT, false,
                    STRIDE, (POSITION_DATA_SIZE + COLOR_DATA_SIZE) * BYTES_PER_FLOAT);
            GLES20.glEnableVertexAttribArray(aTextureCoordinateHandle);

            GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
            GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture);
            GLES20.glUniform1f(aTextureUniformHandle, 0);

            // Draw
            GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, qibo[0]);
            GLES20.glDrawElements(GLES20.GL_TRIANGLE_STRIP, indexCount, GLES20.GL_UNSIGNED_SHORT, 0);

            GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
            GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, 0);
        }

//        // Use culling to remove back faces.
//        GLES20.glEnable(GLES20.GL_CULL_FACE);
    }
 
开发者ID:regar007,项目名称:ShapesInOpenGLES2.0,代码行数:54,代码来源:Quad.java

示例15: draw

import android.opengl.GLES20; //导入方法依赖的package包/类
/**
 * Issues the draw call.  Does the full setup on every call.
 *
 * @param mvpMatrix The 4x4 projection matrix.
 * @param vertexBuffer Buffer with vertex position data.
 * @param firstVertex Index of first vertex to use in vertexBuffer.
 * @param vertexCount Number of vertices in vertexBuffer.
 * @param coordsPerVertex The number of coordinates per vertex (e.g. x,y is 2).
 * @param vertexStride Width, in bytes, of the position data for each vertex (often
 *        vertexCount * sizeof(float)).
 * @param texMatrix A 4x4 transformation matrix for texture coords.  (Primarily intended
 *        for use with SurfaceTexture.)
 * @param texBuffer Buffer with vertex texture data.
 * @param texStride Width, in bytes, of the texture data for each vertex.
 */
public void draw(float[] mvpMatrix, FloatBuffer vertexBuffer, int firstVertex,
        int vertexCount, int coordsPerVertex, int vertexStride,
        float[] texMatrix, FloatBuffer texBuffer, int textureId, int texStride) {
    GlUtil.checkGlError("draw start");

    // Select the program.
    GLES20.glUseProgram(mProgramHandle);
    GlUtil.checkGlError("glUseProgram");

    // Set the texture.
    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(mTextureTarget, textureId);

    // Copy the model / view / projection matrix over.
    GLES20.glUniformMatrix4fv(muMVPMatrixLoc, 1, false, mvpMatrix, 0);
    GlUtil.checkGlError("glUniformMatrix4fv");

    // Copy the texture transformation matrix over.
    GLES20.glUniformMatrix4fv(muTexMatrixLoc, 1, false, texMatrix, 0);
    GlUtil.checkGlError("glUniformMatrix4fv");

    // Enable the "aPosition" vertex attribute.
    GLES20.glEnableVertexAttribArray(maPositionLoc);
    GlUtil.checkGlError("glEnableVertexAttribArray");

    // Connect vertexBuffer to "aPosition".
    GLES20.glVertexAttribPointer(maPositionLoc, coordsPerVertex,
        GLES20.GL_FLOAT, false, vertexStride, vertexBuffer);
    GlUtil.checkGlError("glVertexAttribPointer");

    // Enable the "aTextureCoord" vertex attribute.
    GLES20.glEnableVertexAttribArray(maTextureCoordLoc);
    GlUtil.checkGlError("glEnableVertexAttribArray");

    // Connect texBuffer to "aTextureCoord".
    GLES20.glVertexAttribPointer(maTextureCoordLoc, 2,
            GLES20.GL_FLOAT, false, texStride, texBuffer);
        GlUtil.checkGlError("glVertexAttribPointer");

    // Populate the convolution kernel, if present.
    if (muKernelLoc >= 0) {
        GLES20.glUniform1fv(muKernelLoc, KERNEL_SIZE, mKernel, 0);
        GLES20.glUniform2fv(muTexOffsetLoc, KERNEL_SIZE, mTexOffset, 0);
        GLES20.glUniform1f(muColorAdjustLoc, mColorAdjust);
    }

    // Draw the rect.
    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, firstVertex, vertexCount);
    GlUtil.checkGlError("glDrawArrays");

    // Done -- disable vertex array, texture, and program.
    GLES20.glDisableVertexAttribArray(maPositionLoc);
    GLES20.glDisableVertexAttribArray(maTextureCoordLoc);
    GLES20.glBindTexture(mTextureTarget, 0);
    GLES20.glUseProgram(0);
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:72,代码来源:Texture2dProgram.java


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