glsurfaceview

How to make Circular Mask and Clip GLSurfaceView?

倖福魔咒の 提交于 2020-01-14 09:01:10
问题 I work with an SDK that provides a rectangular GLSurfaceView through a callback. I want to be able to render this view in a circular layout. (i.e.) I would like to display the view on a circular view It's showing Circle shape when I overlay GLSurfaceView over ImageView GLSurfaceView over ImageView It's showing Square shape when I overlay GLSurfaceView over VideoView . GLSurfaceView over VideoView I have tried below code for making circle GLSurfaceView public class SampleGLView extends

Android OpenGL 开发详解 (渲染Camera数据到GLSurfaceView)

只愿长相守 提交于 2020-01-13 04:03:24
OpenGL 作为跨平台的开放式图形库,在我们android平台自然也是有很大用处的。 这篇文章是我自己学习OpenGL的一个记录总结,同时写下我的理解,希望可以对你有帮助。 我们就使用OpenGL+GLSurfaceView+Camera 来实现使用Camera采集数据,通过OpenGL渲染到GLSurfaceView显示。 首先我们先在xml中写一个GLSurfaceView控件,获取到它的实例。那为什么我们要使用GLSurfaceView而不是用SurfaceView,因为我们渲染的过程需要和OpenGL建立联系才可以进行绘制的,而GLSurfaceView本身提供给我们使用就已经通过特殊的EGL环境与OpenGL建立了联系,而SurfaceView的话我们如果要使用需要自己配置EGL环境。 对GLSurfaceView进行一些配置: GLSurfaceView glSurfaceview = findViewById(R.id.glsurfaceview); glSurfaceview.setEGLContextClientVersion(2); //设置所使用的EGLContext版本号。 glSurfaceview.setRenderer(new GLSurfaceView.Renderer() { //设置渲染器 @Override public void

Android OpenGL+Camera2渲染(1) —— OpenGL简单介绍

强颜欢笑 提交于 2020-01-12 02:44:30
Android OpenGL+Camera2渲染(1) —— OpenGL简单介绍 Android OpenGL+Camera2渲染(2) —— OpenGL实现Camera2图像预览 Android OpenGL+Camera2渲染(3) —— 大眼,贴纸功能实现 Android OpenGL+Camera2渲染(4) —— 美颜功能实现 Android OpenGL+Camera2渲染(5) —— 录制视频,实现快录慢录 什么是OpenGL? Open Graphics Library 图形领域的工业标准,是一套跨编程语言、跨平台的、专业的图形编程(软件)接口。它用于二维、三维图像,是一个功能强大,调用方便的底层图形库。 与硬件无关。可以在不同的平台如Windows、Linux、Mac、Android、IOS之间进行移植。因此,支持OpenGL的软件具有很好的移植性,可以获得非常广泛的应用。 版本介绍 : OpenGL ES 1.0 和 1.1 :Android 1.0和更高的版本支持这个API规范。 OpenGL ES 2.0 :Android 2.2(API 8)和更高的版本支持这个API规范。(2.0 广泛使用) OpenGL ES 3.0 :Android 4.3(API 18)和更高的版本支持这个API规范。 OpenGL ES 3.1 : Android 5.0

在GLSurfaceView上添加Layout控件(android)

心已入冬 提交于 2020-01-11 10:22:23
查找了很久,才找出在GLSurfaceView上添加控件的方法。废话不说,本例实现了一个Native opengl es 程序,绘制了一个旋转三角形;当然主题是在GLSurfaceView上添加Layout控件。主要添加了SlidingDrawer和ImageButton。 源码: http://files.cnblogs.com/maadiah/GLSurfaceView_Overlay.zip 你可以自己修改、把玩。 底部四个是ImageButton,右边是弹出的SlidingDrawer(很不好意思,手头没有像样的图片编辑器,简单点,用内置的icon.png)。 主要注意这几点: 1.GLSurfaceView要开启xml导入插件功能,所以用GLSurfaceView(Context context, AttributeSet attrs)构造函数。(本例是自己实现的 GLSurfaceView )   我是这样获得 AttributeSet参数的: 1 Resources res = this.getResources();2 XmlPullParser parser = res.getXml(R.layout.glsurface_overlay);3 AttributeSet attributes = Xml.asAttributeSet(parser); 2

How to resize viewable area to show all objects/coordinates?

旧街凉风 提交于 2020-01-06 14:19:58
问题 I'm draving some objects on GLSurfaceArea (similar to this: http://www.droidnova.com/android-3d-game-tutorial-part-ii,328.html). It all works fine, but there are shown only points which coordinates are on -1.0 - +1.0 interval. Is there a way to resize viewable area to show coordinates that are not in this area (for example (-2.0, 2.0, 0.0))? 回答1: You want to change the view frustum. This is how I've done it in my android Renderer class: int viewportWidth = -1; int viewportHeight = -1; int

Capturing Specific Areas of GLSurfaceView

一笑奈何 提交于 2020-01-06 08:14:36
问题 I want to take a screenshot of the area 50 to 50 miles away from the touch on the GLSurfaceView drawn in real time. To be precise, If the coordinates of the touched area are X = 50, Y = 50, I want to capture the area inside the rectangle whose size is (X-50, Y-50), (X + 50, Y + 50). @Override public void onDrawFrame(GL10 unused) { render(); if (!mInitialized) { // Only need to do this once mEffectContext = EffectContext.createWithCurrentGlContext(); mInitialized = true; } if (saveFrame) {

Change GlSurfaceView renderer

假如想象 提交于 2020-01-05 17:41:42
问题 I looked all over the net in order to find out if its possible to change the renderer of a GLSurfaceView on the flight. The reason is that I want to change the OpenGl program, and initiate all the attributes and unified params from its vertex and fragment shader and I don't want the any change would require to create a brand new GLSurfaceView with a brand new Renderer. It seems like reasonable operation that should be doable. 回答1: Note: I haven't implemented the following. GLSurfaceView

Modify camera preview with effects using GLsurfaceview

断了今生、忘了曾经 提交于 2020-01-03 02:51:09
问题 I have creating a custom camera app, I am using GLsurfaceview , GLSurfaceview.Renderer for creating camera preview. I have successfully completed it, now am trying to apply filters (sepia mode, blank n white etc) on camera preview. How can I apply effects on camera preview. normal view filter applied And this is my GLSurfaceView.Renderer public class MainRenderer implements GLSurfaceView.Renderer,SurfaceTexture.OnFrameAvailableListener{ private final String vss = "attribute vec2 vPosition;\n"

How to pass data between activities using static variables on a public class?

久未见 提交于 2020-01-02 07:18:49
问题 I'm trying to use static variables on a public class for passing them between activities. I'm having a rare problem doing that. I'm giving values to the static variables on a activity. This activity calls a GLSurfaceView and listen for screen orientation changes. If i give values to the static variables on the GLSurfaceView, then, all works fine, the values are stored and i can retrieve them when the onCreate method is called again after a screen orientation change. The problem is when i

View losing ability to accept key events

风格不统一 提交于 2019-12-25 02:37:30
问题 I'm a little confused over how key events (back key, volume keys) relate to Views in android. Take for example the problem I currently have: Working OK Create Layout (for example, Relative layout) Add View to Layout (A GL SurfaceView) Run app and wait for everything to load (and for GLSurfaceView to be created) Press home key Re-launch app Press back to exit Not Working OK Create Layout (for example, Relative layout) Add View to Layout Run app and press home key before GLSurfaceView is fully