CCRenderTexture,GL11ExtensionPack,Libgdx如何 [英] CCRenderTexture,GL11ExtensionPack,Libgdx How TO
问题描述
我目前对工作的影响,如微小的翅膀的http://www.raywenderlich.com/3857/how-to-create-dynamic-textures-with-ccrendertexture ,并找到 CCRenderTexture 是解决方案。所以我想知道如何在Android这样的效果,最后我发现此链接
<一href=\"https://github.com/ZhouWeikuan/cocos2d/blob/master/cocos2d-android/src/org/cocos2d/opengl/CCRenderTexture.java\" rel=\"nofollow\">https://github.com/ZhouWeikuan/cocos2d/blob/master/cocos2d-android/src/org/cocos2d/opengl/CCRenderTexture.java
这表明,其 GL11ExtensionPack
I currently work on a effect such as "Tiny Wings" http://www.raywenderlich.com/3857/how-to-create-dynamic-textures-with-ccrendertexture ,and find CCRenderTexture is the solution. So I want to know how to make this effect on android , finally i found this link https://github.com/ZhouWeikuan/cocos2d/blob/master/cocos2d-android/src/org/cocos2d/opengl/CCRenderTexture.java It shows that its GL11ExtensionPack
GL11ExtensionPack egl = (GL11ExtensionPack)CCDirector.gl;
egl.glGetIntegerv(GL11ExtensionPack.GL_FRAMEBUFFER_BINDING_OES, oldFBO_, 0);
...
但在GLWrapperBase.java,它显示了
But in GLWrapperBase.java ,it shows
// Unsupported GL11ExtensionPack methods
public void glBindFramebufferOES (int target, int framebuffer) {
throw new UnsupportedOperationException();
}
似乎GDX have'nt实现这个功能。我想知道什么是libgdx相同功能或如何使用 GL11ExtensionPack 是在桌面〜
谢谢
Seems gdx have'nt implement this function . I want to know what's the same feature of libgdx or how to use GL11ExtensionPack at desktop ~ Thanks
推荐答案
在libGDX,要使用一个帧缓冲
对象做一个CCRenderTexture的等价物。帧缓冲基本上让您使用OpenGL命令绘制到屏幕外缓冲区,然后就可以显示该缓冲区的内容作为纹理后。请参见 HTTP://$c$c.google.com/p/libgdx/维基/ OpenGLFramebufferObject 。需要注意的是帧缓冲区对象仅当您的应用程序需要OpenGL ES 2.0。
In libGDX, you want to use a FrameBuffer
object to do the equivalent of a "CCRenderTexture". The FrameBuffer basically lets you use OpenGL commands to draw into an off-screen buffer, and then you can display that buffer's contents as a texture later. See http://code.google.com/p/libgdx/wiki/OpenGLFramebufferObject. Note that the FrameBuffer object is only available if your app requires OpenGL ES 2.0.
根据你想画什么,你也可以看一下 像素图
类libGDX。这支持一些简单的运行时间绘制操作(如线,rectangels,并且像素)。同样的想法是,你吸引到这个纹理,再后来呈现在屏幕上产生的质感。这是在OpenGL ES 1.0可用了。
Depending on what you want to draw, you might also look at the Pixmap
class in libGDX. This supports some simple run-time drawing operations (like lines, rectangels, and pixels). Again the idea is that you draw into this texture and then render the resulting texture on-screen later. This is available in OpenGL ES 1.0, too.
熟悉framebuffer和像素应该能正常运行在Android和桌面上的(我相信在GWT和iOS,太..)
Both FrameBuffer and Pixmap should work fine on Android and on the Desktop (and I believe on GWT and iOS, too..)
要认真了解在Android上会发生什么,当你的应用程序失去焦点暂时(OpenGL上下文缺失导致一些纹理内容消失)。
Be careful to understand what happens on Android when your app loses focus temporarily (OpenGL context loss causes some texture contents to disappear).
这篇关于CCRenderTexture,GL11ExtensionPack,Libgdx如何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!