问题标签 [glsurfaceview]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
2365 浏览

android - Issues with GLSurface in onPause()/ onResume()

I'm having issues with my GLSurfaceView.

My main activity has a TabLayout. I put a GLSurfaceView inside a tab like this:

According to the Android developer guide, I have to call the onPause() and onResume() methods:

A GLSurfaceView must be notified when the activity is paused and resumed. GLSurfaceView clients are required to call onPause() when the activity pauses and onResume() when the activity resumes. These calls allow GLSurfaceView to pause and resume the rendering thread, and also allow GLSurfaceView to release and recreate the OpenGL display.

Android Dev Guide

So I insertet the onResume()/onPause() calls in my main activity onResume()/onPause():

and

Now, when I call another activity - for example over the menu - and come back (onResume), the activity is freezing for a couple of seconds and finally returns to my main activity.

To make sure that the issue occurs only with GLSurfaceView I removed the code concerning the GLSurfaceView. It worked as it should.

So I assume that something is wrong with my cube3d.onPause() / .onResume().

Does anyone know how to fix this?

Thanks in advance!

Adrian

0 投票
1 回答
234 浏览

android - cocos2d-android: releasing EGL surface because paused

I am new to cocos2d-android. When I pause my game it works but then when I try to resume it does not work. LogCat shows: releasing EGL surface because paused tid=9. How to fix it? Please any reply.

0 投票
1 回答
1363 浏览

android - 无法通过我的 GLSurfaceView 获取 AdView

我对 Android 布局没有太多经验。我究竟做错了什么?

和我的开始:

0 投票
1 回答
255 浏览

android - 不同 Android 设备上的有效 PixelFormat 是什么?

在 Android GLSurfaceView 上设置 PixelFormat 时,如:

对特定设备的特定 PixelFormat 是否有任何限制,或者是否所有 PixelFormat 都应该在所有设备上工作?

如果有限制,那么我如何找出当前设备支持哪些 PixelFormats?

0 投票
1 回答
1275 浏览

android - 在 Android 中动态调整 GLSurfaceView 的大小

我正在使用扩展 GLSurfaceView 的视频视图,我希望在屏幕方向发生变化时调整它的大小。通常,当屏幕方向为横向时,将视图设置为全屏模式。我无法调整这个组件的大小,setLayoutParams 没有成功,我也尝试了 GLSurfaceView 的 surfaceChanged 方法,但没有成功。我可能错过了一些东西。

提前感谢您的回复。

0 投票
0 回答
443 浏览

android - 涉及 GLSurfaceView 的 Android 3D Flipview

我正在基于以下想法实现 3d 翻转视图:

http://techdroid.kbeanie.com/2011/07/flip-animation-in-android.html

我有两个视图,其中一个是从 GLSurfaceView 扩展的,并在其上设置了自定义渲染器。如果其中一个视图基于 GLSurfaceView,则翻转工作正常,否则,当基于 GLSurfaceView 的视图可见时,翻转进行到一半时,动画不起作用并立即显示视图而不是平滑过渡到它。任何想法是什么原因造成的?

它就像发生了半翻转,然后在没有动画的情况下渲染了半视图。

0 投票
0 回答
314 浏览

android - GLSurfaceView.Renderer 不起作用

我正在开发一个 openGL 游戏,其中有一个 glSurfaceView。在其中,我创建了一个渲染器并使用 setRenderer(r); 对其进行设置。

问题是它不起作用。他的方法没有被调用:onSurfaceCreated、onSurfaceChanged、onDrawFrame……任何方法都有效。

会是什么呢?在我的 GLSurfaceView 中,调用了方法 surfaceCreated。但是渲染器不是...

谢谢

0 投票
1 回答
448 浏览

android - 从 Android 中的服务绘图

我正在尝试从服务中绘制(IE GLSurfaceView),以便它在后台运行。

我知道这是可能的,因为透明屏幕应用程序就是一个很好的例子。

但是,我不知道如何做到这一点。

到目前为止,我创建了一个活动和一个服务以及一些 Opengl 绘图方法。我还使 GlSurfaceview 和活动透明,但当然触摸不会重定向到(子)下的图层。

0 投票
3 回答
5707 浏览

android - 如何使用公共类上的静态变量在活动之间传递数据?

我正在尝试在公共类上使用静态变量在活动之间传递它们。

我在这样做时遇到了一个罕见的问题。我正在为活动中的静态变量赋值。此活动调用 GLSurfaceView 并监听屏幕方向的变化。

如果我给 GLSurfaceView 上的静态变量赋值,那么,一切正常,值被存储,当屏幕方向改变后再次调用 onCreate 方法时,我可以检索它们。

问题是当我在 GLSurfaceView 类之外的静态变量上存储值时,在活动的 onTouchListener 方法内。这些值没有正确存储在静态变量上,因为当我尝试在 GLSurfaceView 上访问它们时,这些值不是它们应该是的。

这是我的静态变量类:

在这里,我将值存储在我的活动类中(我进行了调试,显然它们被正确存储):

在这里,我试图在 GLSurfaceView 类上检索这些值,但这些值不正确,它正在检索原始初始值 1,而不是之前存储的值。

我做错了什么?

0 投票
0 回答
1132 浏览

android - 在 cameraPreview 上显示 3D 旋转对象?

我创建了 3D 对象,并且还显示了相机预览。CameraPreview 是

显示在 XML 文件中定义的 SurfaceView 上,并且 3D 对象显示在

在 XML 文件中定义的框架布局。我想在

CameraPreview,但是当我运行应用程序时,CameraPreview 只显示了几个

几秒钟后,活动显示独立于

cameraPreview,我的意思是,Camerapreview 上不显示旋转的 3D 对象

表面。有没有办法解决这个错误?

非常感谢您的帮助。

代码

xml 文件