Project

General

Profile

« Previous | Next » 

Revision c90b9e01

Added by Leszek Koltunski over 7 years ago

Progress with getting Mesh'es bounding rectangle. Still doesn't quite work yet (visible : 'Cubes' app with a 0111 Mesh)

View differences:

src/main/java/org/distorted/library/EffectQueuePostprocess.java
19 19

  
20 20
package org.distorted.library;
21 21

  
22
import android.content.res.Resources;
22 23
import android.opengl.GLES20;
23 24

  
24 25
import org.distorted.library.message.EffectMessage;
25 26
import org.distorted.library.program.DistortedProgram;
27
import org.distorted.library.program.FragmentCompilationException;
28
import org.distorted.library.program.FragmentUniformsException;
29
import org.distorted.library.program.LinkingException;
30
import org.distorted.library.program.VertexCompilationException;
31
import org.distorted.library.program.VertexUniformsException;
26 32
import org.distorted.library.type.Data1D;
27 33
import org.distorted.library.type.Data2D;
28 34
import org.distorted.library.type.Dynamic1D;
......
30 36
import org.distorted.library.type.Static1D;
31 37
import org.distorted.library.type.Static2D;
32 38

  
39
import java.io.InputStream;
33 40
import java.nio.ByteBuffer;
34 41
import java.nio.ByteOrder;
35 42
import java.nio.FloatBuffer;
......
75 82
    super(id,NUM_UNIFORMS,NUM_CACHE,INDEX );
76 83
    }
77 84

  
85
///////////////////////////////////////////////////////////////////////////////////////////////////
86

  
87
  static void createProgram(Resources resources)
88
  throws FragmentCompilationException,VertexCompilationException,VertexUniformsException,FragmentUniformsException,LinkingException
89
    {
90
    final InputStream postVertexStream   = resources.openRawResource(R.raw.post_vertex_shader);
91
    final InputStream postFragmentStream = resources.openRawResource(R.raw.post_fragment_shader);
92

  
93
    String postFragmentHeader= ("#version 100\n#define NUM_POSTPROCESS "  + DistortedEffects.getMaxPostprocess()+"\n");
94

  
95
    for(EffectNames name: EffectNames.values() )
96
      {
97
      if( name.getType()== EffectTypes.POSTPROCESS)
98
        postFragmentHeader += ("#define "+name.name()+" "+name.ordinal()+"\n");
99
      }
100

  
101
    mProgram = new DistortedProgram(postVertexStream,postFragmentStream, "", postFragmentHeader);
102

  
103
    int postProgramH = mProgram.getProgramHandle();
104
    getUniforms(postProgramH);
105
    }
106

  
78 107
///////////////////////////////////////////////////////////////////////////////////////////////////
79 108

  
80 109
  static void getUniforms(int mProgramH)
......
86 115
    mMVPMatrixH = GLES20.glGetUniformLocation(mProgramH, "u_MVPMatrix");
87 116
    }
88 117

  
89
///////////////////////////////////////////////////////////////////////////////////////////////////
90

  
91
  static void setProgram(DistortedProgram p)
92
    {
93
    mProgram = p;
94
    }
95

  
96 118
///////////////////////////////////////////////////////////////////////////////////////////////////
97 119
  
98 120
  synchronized void compute(long currTime) 

Also available in: Unified diff