1 /*
2  *  Copyright 2015 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 package org.webrtc;
12 
13 /** Simplest possible GL shader that just draws frames as opaque quads. */
14 public class GlRectDrawer extends GlGenericDrawer {
15   private static final String FRAGMENT_SHADER = "void main() {\n"
16       + "  gl_FragColor = sample(tc);\n"
17       + "}\n";
18 
19   private static class ShaderCallbacks implements GlGenericDrawer.ShaderCallbacks {
20     @Override
onNewShader(GlShader shader)21     public void onNewShader(GlShader shader) {}
22 
23     @Override
onPrepareShader(GlShader shader, float[] texMatrix, int frameWidth, int frameHeight, int viewportWidth, int viewportHeight)24     public void onPrepareShader(GlShader shader, float[] texMatrix, int frameWidth, int frameHeight,
25         int viewportWidth, int viewportHeight) {}
26   }
27 
GlRectDrawer()28   public GlRectDrawer() {
29     super(FRAGMENT_SHADER, new ShaderCallbacks());
30   }
31 }
32