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


Java GLES20.glUniform4fv方法代码示例

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


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

示例1: onSetExpandData

import android.opengl.GLES20; //导入方法依赖的package包/类
@Override
protected void onSetExpandData() {
    //todo 根据时间修改

    if(isAdd){
        mStep+=0.08f;
    }else{
        mStep-=0.08f;
    }

    if(mStep>=1.0f){
        isAdd=false;
        mStep=1.0f;
    }else if(mStep<=0.0f){
        isAdd=true;
        mStep=0.0f;
    }

    super.onSetExpandData();
    GLES20.glUniform4fv(mGLBorderColor,1,mBorderColor,0);
    GLES20.glUniform1f(mGLStep,mStep);
}
 
开发者ID:aiyaapp,项目名称:AAVT,代码行数:23,代码来源:FluorescenceFilter.java

示例2: draw

import android.opengl.GLES20; //导入方法依赖的package包/类
/**
 * Draw a snapshot of a live graph.
 * @param mvpMatrix
 * @param snapshot
 */
public void draw(float[] mvpMatrix, TimeSeriesSnapshot<Double> snapshot) {
  // Add program to OpenGL ES environment
  GLES20.glUseProgram(programHandle);

  // Configure the MVP matrix parameter.
  int mMVPMatrixHandle = GLES20.glGetUniformLocation(programHandle, "uMVPMatrix");
  GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mvpMatrix, 0);

  // Set position information
  int mPositionHandle = GLES20.glGetAttribLocation(programHandle, "vPosition");
  GLES20.glEnableVertexAttribArray(mPositionHandle);
  GLES20.glVertexAttribPointer(
      mPositionHandle, 3 /* coords per vertex */,
      GLES20.GL_FLOAT, false,
      VERTEX_STRIDE, snapshotToBuffer(snapshot));

  // Set color information
  int mColorHandle = GLES20.glGetUniformLocation(programHandle, "vColor");
  GLES20.glUniform4fv(mColorHandle, 1, color, 0);

  // And finally, draw it as a line strip.
  GLES20.glDrawArrays(GLES20.GL_LINE_STRIP, 0, snapshot.length);
  GLES20.glDisableVertexAttribArray(mPositionHandle);
}
 
开发者ID:padster,项目名称:Muse-EEG-Toolkit,代码行数:30,代码来源:GraphGLLine.java

示例3: draw

import android.opengl.GLES20; //导入方法依赖的package包/类
/**
 * Draw bubble.
 */
public void draw() {
  GLES20.glUseProgram(getProgram());
  int positionHandle = GLES20.glGetAttribLocation(getProgram(), VERTEX_POSITION);
  GLES20.glEnableVertexAttribArray(positionHandle);
  GLES20.glVertexAttribPointer(positionHandle, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false,
      COORDS_PER_VERTEX * SIZE_OF_FLOAT, vertexBuffer);
  int colorHandle = GLES20.glGetUniformLocation(getProgram(), VERTEX_COLOR);
  GLES20.glEnable(GLES20.GL_BLEND);
  GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
  GLES20.glUniform4fv(colorHandle, 1, getColor(), 0);
  GLES20.glDrawElements(GLES20.GL_TRIANGLE_FAN, shortBuffer.capacity(), GLES20.GL_UNSIGNED_SHORT,
      shortBuffer);
  GLES20.glDisableVertexAttribArray(positionHandle);
  GLES20.glDisable(GLES20.GL_BLEND);
}
 
开发者ID:Arjun-sna,项目名称:Android-AudioRecorder-App,代码行数:19,代码来源:GLBubble.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: draw

import android.opengl.GLES20; //导入方法依赖的package包/类
/**
 * Issues the draw call.  Does the full setup on every call.
 *
 * @param mvpMatrix The 4x4 projection matrix.
 * @param color A 4-element color vector.
 * @param vertexBuffer Buffer with vertex 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 data for each vertex (often vertexCount *
 *        sizeof(float)).
 */
public void draw(float[] mvpMatrix, float[] color, FloatBuffer vertexBuffer,
        int firstVertex, int vertexCount, int coordsPerVertex, int vertexStride) {
    GlUtil.checkGlError("draw start");

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

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

    // Copy the color vector in.
    GLES20.glUniform4fv(muColorLoc, 1, color, 0);
    GlUtil.checkGlError("glUniform4fv ");

    // 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");

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

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

示例6: draw

import android.opengl.GLES20; //导入方法依赖的package包/类
/**
 * Encapsulates the OpenGL ES instructions for drawing this shape.
 *
 * @param mvpMatrix - The Model View Project matrix in which to draw
 * this shape.
 */
public void draw(float[] mvpMatrix) {
    // Add program to OpenGL environment
    GLES20.glUseProgram(mProgram);

    // get handle to vertex shader's vPosition member
    mPositionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition");

    // Enable a handle to the triangle vertices
    GLES20.glEnableVertexAttribArray(mPositionHandle);

    // Prepare the triangle coordinate data
    GLES20.glVertexAttribPointer(
            mPositionHandle, COORDS_PER_VERTEX,
            GLES20.GL_FLOAT, false,
            vertexStride, vertexBuffer);

    // get handle to fragment shader's vColor member
    mColorHandle = GLES20.glGetUniformLocation(mProgram, "vColor");

    // Set color for drawing the triangle
    GLES20.glUniform4fv(mColorHandle, 1, color, 0);

    // get handle to shape's transformation matrix
    mMVPMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uMVPMatrix");
    TextureRender.checkGlError("glGetUniformLocation");

    // Apply the projection and view transformation
    GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mvpMatrix, 0);
    TextureRender.checkGlError("glUniformMatrix4fv");

    // Draw the triangle
    GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, vertexCount);

    // Disable vertex array
    GLES20.glDisableVertexAttribArray(mPositionHandle);
}
 
开发者ID:livio,项目名称:sdl_video_streaming_android_sample,代码行数:43,代码来源:Triangle.java

示例7: drawScene

import android.opengl.GLES20; //导入方法依赖的package包/类
private void drawScene() {
    GLES20.glUniform4fv(mColorFilterHandle, 1, mColorFilter, 0);
    if (CHECK_GL_ERRORS) OpenGLUtils.checkGlError("glUniform4fv");

    GLES20.glUniformMatrix4fv(mMVPTransformHandle, 1, false, mMVP, 0);
    if (CHECK_GL_ERRORS) OpenGLUtils.checkGlError("glUniformMatrix4fv");
            
    GLES20.glEnableVertexAttribArray(mTexCoordHandle);
    if (CHECK_GL_ERRORS) OpenGLUtils.checkGlError("glEnableVertexAttribArray");
    
    GLES20.glEnableVertexAttribArray(mTriangleVerticesHandle);
    if (CHECK_GL_ERRORS) OpenGLUtils.checkGlError("glEnableVertexAttribArray");
    
    GLES20.glVertexAttribPointer(mTriangleVerticesHandle, 3, GLES20.GL_FLOAT,
            false, 0, mVertices);
    if (CHECK_GL_ERRORS) OpenGLUtils.checkGlError("glVertexAttribPointer");

    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 2 * (VERTICAL_GRANULARITY) * (HORIZONTAL_GRANULARITY + 1));
    if (CHECK_GL_ERRORS) OpenGLUtils.checkGlError("glDrawArrays");

    GLES20.glDisableVertexAttribArray(mTexCoordHandle);
    if (CHECK_GL_ERRORS) OpenGLUtils.checkGlError("glDisableVertexAttribArray");

    GLES20.glDisableVertexAttribArray(mTriangleVerticesHandle);
    if (CHECK_GL_ERRORS) OpenGLUtils.checkGlError("glDisableVertexAttribArray");

}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:28,代码来源:StereoDiveEffect.java

示例8: draw

import android.opengl.GLES20; //导入方法依赖的package包/类
/**
 * Encapsulates the OpenGL ES instructions for drawing this shape.
 *
 * @param mvpMatrix - The Model View Project matrix in which to draw
 * this shape.
 */
public void draw(float[] mvpMatrix) {
    // Add program to OpenGL environment
    GLES20.glUseProgram(mProgram);

    // get handle to vertex shader's vPosition member
    mPositionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition");

    // Enable a handle to the triangle vertices
    GLES20.glEnableVertexAttribArray(mPositionHandle);

    // Prepare the triangle coordinate data
    GLES20.glVertexAttribPointer(
            mPositionHandle, COORDS_PER_VERTEX,
            GLES20.GL_FLOAT, false,
            vertexStride, vertexBuffer);

    // get handle to fragment shader's vColor member
    mColorHandle = GLES20.glGetUniformLocation(mProgram, "vColor");

    // Set color for drawing the triangle
    GLES20.glUniform4fv(mColorHandle, 1, color, 0);

    // get handle to shape's transformation matrix
    mMVPMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uMVPMatrix");
    MyGLRenderer.checkGlError("glGetUniformLocation");

    // Apply the projection and view transformation
    GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mvpMatrix, 0);
    MyGLRenderer.checkGlError("glUniformMatrix4fv");

    // Draw the square
    GLES20.glDrawElements(
            GLES20.GL_TRIANGLES, drawOrder.length,
            GLES20.GL_UNSIGNED_SHORT, drawListBuffer);

    // Disable vertex array
    GLES20.glDisableVertexAttribArray(mPositionHandle);
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:45,代码来源:Square.java

示例9: draw

import android.opengl.GLES20; //导入方法依赖的package包/类
/**
 * Encapsulates the OpenGL ES instructions for drawing this shape.
 *
 * @param mvpMatrix - The Model View Project matrix in which to draw
 * this shape.
 */
public void draw(float[] mvpMatrix) {
    // Add program to OpenGL environment
    GLES20.glUseProgram(mProgram);

    // get handle to vertex shader's vPosition member
    mPositionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition");

    // Enable a handle to the triangle vertices
    GLES20.glEnableVertexAttribArray(mPositionHandle);

    // Prepare the triangle coordinate data
    GLES20.glVertexAttribPointer(
            mPositionHandle, COORDS_PER_VERTEX,
            GLES20.GL_FLOAT, false,
            vertexStride, vertexBuffer);

    // get handle to fragment shader's vColor member
    mColorHandle = GLES20.glGetUniformLocation(mProgram, "vColor");

    // Set color for drawing the triangle
    GLES20.glUniform4fv(mColorHandle, 1, color, 0);

    // get handle to shape's transformation matrix
    mMVPMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uMVPMatrix");
    MyGLRenderer.checkGlError("glGetUniformLocation");

    // Apply the projection and view transformation
    GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mvpMatrix, 0);
    MyGLRenderer.checkGlError("glUniformMatrix4fv");

    // Draw the triangle
    GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, vertexCount);

    // Disable vertex array
    GLES20.glDisableVertexAttribArray(mPositionHandle);
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:43,代码来源:Triangle.java

示例10: draw

import android.opengl.GLES20; //导入方法依赖的package包/类
/**
 * Draw wave.
 */
public void draw() {
  GLES20.glUseProgram(getProgram());
  int positionHandle = GLES20.glGetAttribLocation(getProgram(), VERTEX_POSITION);
  GLES20.glEnableVertexAttribArray(positionHandle);
  GLES20.glVertexAttribPointer(positionHandle, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false,
      COORDS_PER_VERTEX * SIZE_OF_FLOAT, vertexBuffer);
  int colorHandle = GLES20.glGetUniformLocation(getProgram(), VERTEX_COLOR);
  GLES20.glUniform4fv(colorHandle, 1, getColor(), 0);
  GLES20.glDrawElements(GLES20.GL_TRIANGLE_FAN, shortBuffer.capacity(), GLES20.GL_UNSIGNED_SHORT,
      shortBuffer);
  GLES20.glDisableVertexAttribArray(positionHandle);
}
 
开发者ID:Arjun-sna,项目名称:Android-AudioRecorder-App,代码行数:16,代码来源:GLWave.java

示例11: draw

import android.opengl.GLES20; //导入方法依赖的package包/类
/**
 * Draw rectangle.
 */
public void draw() {
  GLES20.glUseProgram(getProgram());
  int positionHandle = GLES20.glGetAttribLocation(getProgram(), VERTEX_POSITION);
  GLES20.glEnableVertexAttribArray(positionHandle);
  GLES20.glVertexAttribPointer(positionHandle, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false,
      COORDS_PER_VERTEX * SIZE_OF_FLOAT, vertexBuffer);
  int colorHandle = GLES20.glGetUniformLocation(getProgram(), VERTEX_COLOR);
  GLES20.glUniform4fv(colorHandle, 1, getColor(), 0);
  GLES20.glDrawElements(GLES20.GL_TRIANGLE_FAN, shortBuffer.capacity(), GLES20.GL_UNSIGNED_SHORT,
      shortBuffer);
  GLES20.glDisableVertexAttribArray(positionHandle);
}
 
开发者ID:Arjun-sna,项目名称:Android-AudioRecorder-App,代码行数:16,代码来源:GLRectangle.java

示例12: draw

import android.opengl.GLES20; //导入方法依赖的package包/类
/**
     * Encapsulates the OpenGL ES instructions for drawing this shape.
     *
     * @param mvpMatrix - The Model View Project matrix in which to draw
     *                  this shape.
     */
    public void draw(float[] mvpMatrix) {
        // Add program to OpenGL environment
        GLES20.glUseProgram(mProgram);

        // get handle to vertex shader's vPosition member
        mPositionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition");

        // Enable a handle to the triangle vertices
        GLES20.glEnableVertexAttribArray(mPositionHandle);

        // Prepare the triangle coordinate data
        GLES20.glVertexAttribPointer(
                mPositionHandle, COORDS_PER_VERTEX,
                GLES20.GL_FLOAT, false,
                vertexStride, vertexBuffer);

        // get handle to fragment shader's vColor member
        mColorHandle = GLES20.glGetUniformLocation(mProgram, "vColor");
        // Set color for drawing the triangle
        GLES20.glUniform4fv(mColorHandle, 1, color, 0);

        // get handle to shape's transformation matrix
        mMVPMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uMVPMatrix");
//        MyGLRenderer.checkGlError("glGetUniformLocation");

        // Apply the projection and view transformation
        GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mvpMatrix, 0);
//        MyGLRenderer.checkGlError("glUniformMatrix4fv");

        // Draw the square
        GLES20.glDrawElements(
                GLES20.GL_TRIANGLES, drawOrder.length,
                GLES20.GL_UNSIGNED_SHORT, drawListBuffer);

        // Disable vertex array
        GLES20.glDisableVertexAttribArray(mPositionHandle);
    }
 
开发者ID:biezhihua,项目名称:Android_OpenGL_Demo,代码行数:44,代码来源:Square.java

示例13: draw

import android.opengl.GLES20; //导入方法依赖的package包/类
public void draw(float[] mvpMatrix) {
    // Add program to OpenGL ES environment
    GLES20.glUseProgram(mProgram);

    // get handle to vertex shader's vPosition member
    mPositionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition");

    // Enable a handle to the triangle vertices
    GLES20.glEnableVertexAttribArray(mPositionHandle);

    // Prepare the triangle coordinate data
    GLES20.glVertexAttribPointer(mPositionHandle, COORDS_PER_VERTEX,
            GLES20.GL_FLOAT, false,
            vertexStride, vertexBuffer);

    // get handle to fragment shader's vColor member
    mColorHandle = GLES20.glGetUniformLocation(mProgram, "vColor");

    // Set color for drawing the triangle
    GLES20.glUniform4fv(mColorHandle, 1, color, 0);

    // get handle to shape's transformation matrix
    mMVPMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uMVPMatrix");

    // Pass the projection and view transformation to the shader
    GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mvpMatrix, 0);

    // Draw the triangle
    GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, vertexCount);

    // Disable vertex array
    GLES20.glDisableVertexAttribArray(mPositionHandle);
}
 
开发者ID:biezhihua,项目名称:Android_OpenGL_Demo,代码行数:34,代码来源:Triangle.java

示例14: draw

import android.opengl.GLES20; //导入方法依赖的package包/类
public void draw(float[] mvpMatrix, float r, float g, float b, float a) {
    // Add program to OpenGL environment
    GLES20.glUseProgram(mProgram);

    // get handle to vertex shader's vPosition member
    int mPositionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition");

    // Enable a handle to the triangle vertices
    GLES20.glEnableVertexAttribArray(mPositionHandle);

    // Prepare the triangle coordinate data
    int vertexStride = COORDS_PER_VERTEX * 4;
    GLES20.glVertexAttribPointer(mPositionHandle, COORDS_PER_VERTEX,
                                 GLES20.GL_FLOAT, false,
            vertexStride, vertexBuffer);

    // get handle to fragment shader's vColor member
    int mColorHandle = GLES20.glGetUniformLocation(mProgram, "vColor");

    // Set color for drawing the triangle
    float[] color = {r,g,b,a};

    GLES20.glUniform4fv(mColorHandle, 1, color, 0);

    // get handle to shape's transformation matrix
    int mMVPMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uMVPMatrix");
    GLRenderer.checkGlError("glGetUniformLocation");

    // Apply the projection and view transformation
    GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mvpMatrix, 0);
    GLRenderer.checkGlError("glUniformMatrix4fv");

    // Draw the square
    GLES20.glDrawElements(GLES20.GL_TRIANGLES, drawOrder.length,
                          GLES20.GL_UNSIGNED_SHORT, drawListBuffer);

    // Disable vertex array
    GLES20.glDisableVertexAttribArray(mPositionHandle);
}
 
开发者ID:efroemling,项目名称:bombsquad-remote-android,代码行数:40,代码来源:GLRenderer.java

示例15: draw

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

        GLES20.glUseProgram(program);

        positionHandle = GLES20.glGetAttribLocation(program, "vPosition");


        GLES20.glEnableVertexAttribArray(positionHandle);

        GLES20.glVertexAttribPointer(positionHandle, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false, vertexStride,
                vertexBuffer);

        colorHandle = GLES20.glGetUniformLocation(program, "vColor");

        GLES20.glUniform4fv(colorHandle, 1, color, 0);

        mVPHandle = GLES20.glGetUniformLocation(program, "uMVPMatrix");

        GLES20.glUniformMatrix4fv(mVPHandle, 1, false, mVPMatrix, 0);

        GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, vertexCount);

        GLES20.glDisableVertexAttribArray(positionHandle);


    }
 
开发者ID:FreeSunny,项目名称:Amazing,代码行数:27,代码来源:Triangle.java


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