`

android opengl 使用报错解决

 
阅读更多
问题:
1.
(SDK target 8) called a GL11 Pointer method with an indirect Buffer.

2.
 java.lang.IllegalArgumentException: Must use a native order direct Buffer


解决方法:
https://groups.google.com/group/android-developers/browse_thread/thread/bbc6797499f41541
http://topic.csdn.net/u/20120221/23/60e832ed-63a5-4693-98fd-a61206e63b36.html
引用
Hello there
Non-direct buffers exist within the java heap space, and thus may be
shuffled around by the garbage collector to reduce fragmentation.
OpenGL may try and use data from the buffers that you pass in at any
time - if the buffer has been moved since you passed its address to
OpenGL then you'll be reading data from an invalid location.
Direct buffers are allocated outside of the java heap, and thus do not
move around.
For opengl use, always allocate buffers like so
FloatBuffer fb =
ByteBuffer.allocateDirect( size ).order( ByteBuffer.nativeOrder() ).asFloatBuffer();
Also be aware of the performance issue in
http://code.google.com/p/android/issues/detail?id=11078


好像上面的写错了。。应该是:
ByteBuffer.allocateDirect( slicesBuffers.length ).order( ByteOrder.nativeOrder() ).asFloatBuffer();
分享到:
评论

相关推荐

    API17-CPU ABI设置(AVD在API 17下黑屏等问题的解决)

    通过命令行启动AVD可以使用`android avd`命令,这将帮助开发者识别并解决任何未在图形界面中显示的潜在问题。 总结来说,解决API 17下的AVD黑屏问题,关键在于正确配置CPU/ABI,修复OpenGL库加载错误,并确保所有...

    教程androidNative

    **避免 C++ 使用 Log 报错** 在 Android.mk 文件中加入以下内容,以避免在 C++ 代码中使用 Log 时出现编译错误: ```makefile LOCAL_LDLIBS += -llog ``` #### 三、NDK 开发语法 **1. JNI (Java Native ...

    安卓模拟器安装不了怎么解决?.docx

    解决方法:更新显卡驱动,确保.NET Framework 2.0 SP2已安装,检查Bluestacks的Android服务状态。 **问题六:游戏黑屏或闪退** 原因:游戏可能不支持模拟器,或者需要更新显卡驱动。在设置中将应用程序大小修改为...

    UMP Pro (Win, Mac, Linux, WebGL) v2.0.3

    - 为正确使用 UMP Pro(Android、iOS)资源包,首先要导入 UMP Pro(Android、iOS)资源包,然后再将 UMP Pro(Win、Mac、Linux)资源包导入至项目中; 主要功能: + 随附完整的 C# 源代码; + 完全兼容 UMP Pro...

    彩虹3引擎说明书 v2020-08-30_彩虹3_彩虹引擎_

    1. **图形渲染**:引擎采用了先进的图形渲染技术,支持DirectX 12和OpenGL,能够实现高质量的光照、阴影、粒子效果和复杂的物理模拟,为用户提供沉浸式的游戏体验。 2. **物理引擎**:内置的物理引擎提供了真实世界...

    OKA40i-C、OKT3-C产品用户资料发布更新记录-20220424.pdf

    - 修改文件系统打包方式,解决打包文件系统偶尔报错问题; - 删除out目录后,重新编译源码,不需要手动添加opengl库; - 添加rtc-pcf8563芯片的支持,更新后的软件兼容原来的RX8010芯片; - 修复没有phy芯片,...

Global site tag (gtag.js) - Google Analytics