Project

General

Profile

« Previous | Next » 

Revision 604b2899

Added by Leszek Koltunski about 7 years ago

Dynamic display of bounding rectangles (with coords computed by Vertex Shader and gotten with Transform Feedback) works now.

Major problem: the glMapBufferRange() slows doewn rendering in a major way. Multiblur's FPS:

Nexus5X : 35.4 before -> 12.6 after
Nexus4 26.5 before -> ~12 after

View differences:

src/main/res/raw/main_vertex_shader.glsl
24 24
in vec3 a_Normal;                    // Per-vertex normal vector.
25 25
in vec2 a_TexCoordinate;             // Per-vertex texture coordinate.
26 26
out vec3 v_Position;                 //
27
out vec2 v_ndcPosition;              // for Transform Feedback only
27 28
out vec3 v_Normal;                   //
28 29
out vec2 v_TexCoordinate;            //
29 30
#else
......
31 32
attribute vec3 a_Normal;             // Per-vertex normal vector.
32 33
attribute vec2 a_TexCoordinate;      // Per-vertex texture coordinate.
33 34
varying vec3 v_Position;             //
35
varying vec2 v_ndcPosition;          // for Transform Feedback only
34 36
varying vec3 v_Normal;               //
35 37
varying vec2 v_TexCoordinate;        //
36 38
#endif
......
525 527
  {
526 528
  vec3 v = 2.0*u_objD*a_Position;
527 529
  vec3 n = a_Normal;
530
  vec4 mvpPos;
528 531

  
529 532
#if NUM_VERTEX>0
530 533
  int j=0;
......
558 561
  v_Position      = v;
559 562
  v_TexCoordinate = a_TexCoordinate;
560 563
  v_Normal        = normalize(vec3(u_MVMatrix*vec4(n,0.0)));
561
  gl_Position     = u_MVPMatrix*vec4(v,1.0);
564
  mvpPos          = u_MVPMatrix*vec4(v,1.0);
565
  v_ndcPosition   = vec2(mvpPos.x/mvpPos.w,mvpPos.y/mvpPos.w);
566
  gl_Position     = mvpPos;
562 567
  }                               

Also available in: Unified diff