當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。