Java Code Examples for android.opengl.GLSurfaceView#getHeight()
The following examples show how to use
android.opengl.GLSurfaceView#getHeight() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GLRenderWrapper.java From AndroidRipper with GNU Affero General Public License v3.0 | 6 votes |
/** * Constructs this object. * * @param view the current glSurfaceView * @param renderer the renderer to wrap * @param latch the count down latch */ public GLRenderWrapper(GLSurfaceView view, Renderer renderer, CountDownLatch latch) { this.view = view; this.renderer = renderer; this.latch = latch; this.width = view.getWidth(); this.height = view.getHeight(); Integer out = new Reflect(view).field("mEGLContextClientVersion") .out(Integer.class); if ( out != null ) { this.glVersion = out.intValue(); } else { this.glVersion = -1; this.takeScreenshot = false; } }
Example 2
Source File: PixelationEffect.java From GSYVideoPlayer with Apache License 2.0 | 6 votes |
@Override public String getShader(GLSurfaceView mGlSurfaceView) { String shader = "#extension GL_OES_EGL_image_external : require\n" + "precision mediump float;\n"+ "varying vec2 vTextureCoord;\n" + "float imageWidthFactor = "+ (1 / (float)mGlSurfaceView.getWidth()) +";\n" + "float imageHeightFactor = " + ( 1 /(float)mGlSurfaceView.getHeight()) + ";\n" + "uniform samplerExternalOES sTexture;\n" + "float pixel = " + pixel +";\n" + "void main()\n" + "{\n" + " vec2 uv = vTextureCoord.xy;\n" + " float dx = pixel * imageWidthFactor;\n" + " float dy = pixel * imageHeightFactor;\n" + " vec2 coord = vec2(dx * floor(uv.x / dx), dy * floor(uv.y / dy));\n" + " vec3 tc = texture2D(sTexture, coord).xyz;\n" + " gl_FragColor = vec4(tc, 1.0);\n" + "}"; return shader; }
Example 3
Source File: BitmapUtil.java From PhotoEditor with MIT License | 5 votes |
/** * Save filter bitmap from {@link ImageFilterView} * * @param glSurfaceView surface view on which is image is drawn * @param gl open gl source to read pixels from {@link GLSurfaceView} * @return save bitmap * @throws OutOfMemoryError error when system is out of memory to load and save bitmap */ static Bitmap createBitmapFromGLSurface(GLSurfaceView glSurfaceView, GL10 gl) throws OutOfMemoryError { int x = 0, y = 0; int w = glSurfaceView.getWidth(); int h = glSurfaceView.getHeight(); int bitmapBuffer[] = new int[w * h]; int bitmapSource[] = new int[w * h]; IntBuffer intBuffer = IntBuffer.wrap(bitmapBuffer); intBuffer.position(0); try { gl.glReadPixels(x, y, w, h, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, intBuffer); int offset1, offset2; for (int i = 0; i < h; i++) { offset1 = i * w; offset2 = (h - i - 1) * w; for (int j = 0; j < w; j++) { int texturePixel = bitmapBuffer[offset1 + j]; int blue = (texturePixel >> 16) & 0xff; int red = (texturePixel << 16) & 0x00ff0000; int pixel = (texturePixel & 0xff00ff00) | red | blue; bitmapSource[offset2 + j] = pixel; } } } catch (GLException e) { return null; } return Bitmap.createBitmap(bitmapSource, w, h, Bitmap.Config.ARGB_8888); }
Example 4
Source File: DocumentaryEffect.java From GSYVideoPlayer with Apache License 2.0 | 4 votes |
/** * Init all values that will be used by this shader. * * @param mGlSurfaceView which is responsible for displaying your video */ private void initValues(GLSurfaceView mGlSurfaceView) { mWidth = mGlSurfaceView.getWidth(); mHeight = mGlSurfaceView.getHeight(); mRandom = new Random(new Date().getTime()); }
Example 5
Source File: GrainEffect.java From GSYVideoPlayer with Apache License 2.0 | 4 votes |
/** * Init all values that will be used by this shader. * * @param mGlSurfaceView which is responsible for displaying your video */ private void initValues(GLSurfaceView mGlSurfaceView) { mWidth = mGlSurfaceView.getWidth(); mHeight = mGlSurfaceView.getHeight(); mRandom = new Random(new Date().getTime()); }
Example 6
Source File: LamoishEffect.java From GSYVideoPlayer with Apache License 2.0 | 4 votes |
/** * Init all values that will be used by this shader. * * @param mGlSurfaceView which is responsible for displaying your video */ private void initValues(GLSurfaceView mGlSurfaceView) { mWidth = mGlSurfaceView.getWidth(); mHeight = mGlSurfaceView.getHeight(); mRandom = new Random(new Date().getTime()); }
Example 7
Source File: DocumentaryEffect.java From VidEffects with Apache License 2.0 | 4 votes |
/** * Init all values that will be used by this shader. * * @param mGlSurfaceView which is responsible for displaying your video */ private void initValues(GLSurfaceView mGlSurfaceView) { mWidth = mGlSurfaceView.getWidth(); mHeight = mGlSurfaceView.getHeight(); mRandom = new Random(new Date().getTime()); }
Example 8
Source File: GrainEffect.java From VidEffects with Apache License 2.0 | 4 votes |
/** * Init all values that will be used by this shader. * * @param mGlSurfaceView which is responsible for displaying your video */ private void initValues(GLSurfaceView mGlSurfaceView) { mWidth = mGlSurfaceView.getWidth(); mHeight = mGlSurfaceView.getHeight(); mRandom = new Random(new Date().getTime()); }
Example 9
Source File: LamoishEffect.java From VidEffects with Apache License 2.0 | 4 votes |
/** * Init all values that will be used by this shader. * * @param mGlSurfaceView which is responsible for displaying your video */ private void initValues(GLSurfaceView mGlSurfaceView) { mWidth = mGlSurfaceView.getWidth(); mHeight = mGlSurfaceView.getHeight(); mRandom = new Random(new Date().getTime()); }
Example 10
Source File: SharpnessEffect.java From GSYVideoPlayer with Apache License 2.0 | 2 votes |
/** * Init all values that will be used by this shader. * * @param mGlSurfaceView which is responsible for displaying your video */ private void initValues(GLSurfaceView mGlSurfaceView) { mWidth = mGlSurfaceView.getWidth(); mHeight = mGlSurfaceView.getHeight(); }
Example 11
Source File: VignetteEffect.java From GSYVideoPlayer with Apache License 2.0 | 2 votes |
/** * Init all values that will be used by this shader. * * @param mGlSurfaceView which is responsible for displaying your video */ private void initValues(GLSurfaceView mGlSurfaceView) { mWidth = mGlSurfaceView.getWidth(); mHeight = mGlSurfaceView.getHeight(); }
Example 12
Source File: SharpnessEffect.java From VidEffects with Apache License 2.0 | 2 votes |
/** * Init all values that will be used by this shader. * * @param mGlSurfaceView which is responsible for displaying your video */ private void initValues(GLSurfaceView mGlSurfaceView) { mWidth = mGlSurfaceView.getWidth(); mHeight = mGlSurfaceView.getHeight(); }
Example 13
Source File: VignetteEffect.java From VidEffects with Apache License 2.0 | 2 votes |
/** * Init all values that will be used by this shader. * * @param mGlSurfaceView which is responsible for displaying your video */ private void initValues(GLSurfaceView mGlSurfaceView) { mWidth = mGlSurfaceView.getWidth(); mHeight = mGlSurfaceView.getHeight(); }