magjed | 59a677a | 2015-06-24 03:59:37 -0700 | [diff] [blame] | 1 | /* |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
magjed | 59a677a | 2015-06-24 03:59:37 -0700 | [diff] [blame] | 3 | * |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 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. |
magjed | 59a677a | 2015-06-24 03:59:37 -0700 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | package org.webrtc; |
| 12 | |
Magnus Jedvert | 65c61dc | 2018-06-15 09:33:20 +0200 | [diff] [blame] | 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" |
magjed | 59a677a | 2015-06-24 03:59:37 -0700 | [diff] [blame] | 17 | + "}\n"; |
| 18 | |
Magnus Jedvert | 65c61dc | 2018-06-15 09:33:20 +0200 | [diff] [blame] | 19 | private static class ShaderCallbacks implements GlGenericDrawer.ShaderCallbacks { |
| 20 | @Override |
| 21 | public void onNewShader(GlShader shader) {} |
magjed | 59a677a | 2015-06-24 03:59:37 -0700 | [diff] [blame] | 22 | |
Magnus Jedvert | 65c61dc | 2018-06-15 09:33:20 +0200 | [diff] [blame] | 23 | @Override |
| 24 | public void onPrepareShader(GlShader shader, float[] texMatrix, int frameWidth, int frameHeight, |
| 25 | int viewportWidth, int viewportHeight) {} |
Magnus Jedvert | 7afc12f | 2015-09-03 12:40:38 +0200 | [diff] [blame] | 26 | } |
magjed | 59a677a | 2015-06-24 03:59:37 -0700 | [diff] [blame] | 27 | |
Magnus Jedvert | 65c61dc | 2018-06-15 09:33:20 +0200 | [diff] [blame] | 28 | public GlRectDrawer() { |
| 29 | super(FRAGMENT_SHADER, new ShaderCallbacks()); |
magjed | 59a677a | 2015-06-24 03:59:37 -0700 | [diff] [blame] | 30 | } |
| 31 | } |