Project

General

Profile

« Previous | Next » 

Revision 57578636

Added by Leszek Koltunski over 7 years ago

Improvements for DFramebuffer.

View differences:

src/main/java/org/distorted/library/Distorted.java
85 85
  private static final String TAG = Distorted.class.getSimpleName();
86 86
  private static boolean mInitialized = false;
87 87
  
88
  static int mPositionH;        // pass in model position information
89
  static int mTextureUniformH;  // pass in the texture.
90
  static int mNormalH;          // pass in model normal information.
91
  static int mTextureCoordH;    // pass in model texture coordinate information.
92
  static int mProgramH;         // This is a handle to our shading program.
88
  private static int mProgramH;         // handle to our shading program.
89
  private static int mTextureUniformH;  // the texture.
90

  
91
  static int mPositionH;                // model position information
92
  static int mNormalH;                  // model normal information.
93
  static int mTextureCoordH;            // model texture coordinate information.
93 94

  
94 95
  static DistortedFramebuffer mFramebuffer = new DistortedFramebuffer(0); // output to the screen
95 96

  
......
325 326
    final int fragmentShaderHandle = compileShader(GLES20.GL_FRAGMENT_SHADER, fragmentShader);     
326 327
      
327 328
    mProgramH = createAndLinkProgram(vertexShaderHandle, fragmentShaderHandle, new String[] {"a_Position",  "a_Color", "a_Normal", "a_TexCoordinate"});                                                            
328
      
329

  
330
    mFramebuffer.setProjection(60.0f,0.0f,0.0f);
331

  
329 332
    GLES20.glUseProgram(mProgramH);
333

  
334
    mTextureUniformH = GLES20.glGetUniformLocation(mProgramH, "u_Texture");
335
    mPositionH       = GLES20.glGetAttribLocation( mProgramH, "a_Position");
336
    mNormalH         = GLES20.glGetAttribLocation( mProgramH, "a_Normal");
337
    mTextureCoordH   = GLES20.glGetAttribLocation( mProgramH, "a_TexCoordinate");
338

  
330 339
    GLES20.glEnable (GLES20.GL_DEPTH_TEST);
331 340
    GLES20.glDepthFunc(GLES20.GL_LEQUAL);
332 341
    GLES20.glEnable(GLES20.GL_BLEND);
......
334 343
    GLES20.glEnable(GLES20.GL_CULL_FACE);
335 344
    GLES20.glCullFace(GLES20.GL_BACK);
336 345
    GLES20.glFrontFace(GLES20.GL_CW);
346
    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
347
    GLES20.glUniform1i(mTextureUniformH, 0);
337 348

  
338
    mTextureUniformH = GLES20.glGetUniformLocation(mProgramH, "u_Texture");
339
    
340
    mPositionH       = GLES20.glGetAttribLocation( mProgramH, "a_Position");
341
    mNormalH         = GLES20.glGetAttribLocation( mProgramH, "a_Normal");
342
    mTextureCoordH   = GLES20.glGetAttribLocation( mProgramH, "a_TexCoordinate");
343
    
344 349
    EffectQueueFragment.getUniforms(mProgramH);
345 350
    EffectQueueVertex.getUniforms(mProgramH);
346 351
    EffectQueueMatrix.getUniforms(mProgramH);

Also available in: Unified diff