GithubHelp home page GithubHelp logo

unitycamerademo-android's Introduction

Unity Android Camera Demo

This demo use Camera1 api.

Build Android Plugin

cd to AndroidPlugin folder and run:

./gradlew buildAARForUnity

unitycamerademo-android's People

Contributors

skyhacker2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

unitycamerademo-android's Issues

glVertexAttribPointer: glError 1282

运行这个项目demo时,我也同样遇到了这个问题。我在draw()里对GL语句都做了checkerror(),LogCat提示:glVertexAttribPointer: glError 1282。博主能指导下嘛?

glDisableVertexAttribArray 与 Unity 场景冲突

使用 极米 Z6X,生成 release 版本游戏,打开大厅(启动摄像头服务),摄像头开始预览后,打开调试界面,会导致 程序崩溃,错误日志如下:

#00  pc 00018e44  /system/lib/libc.so (memcpy+100)
#01  pc 002828d8  /vendor/lib/egl/libGLES_mali.so
#02  pc cfc7e21c  <unknown/absolute>

如果从大厅中打开一个空面板,或者进入 Loading 界面,会导致面板显示花屏。其他情况(例如 debug 包,先进入游戏再打开调试界面,使用别的投影设备)下不会出现异常。

错误定位:

Java 端 帧缓冲 中获取图像,使用了 fragment_ext.glsl 的 shader 文件。执行 Texture2DExtdraw() 函数, glEnableVertexAttribArray (顶点属性)使用后没有关闭,打开界面 / 切换场景时会写入新的数据会导致错误。

思考方案:

使用 PBO 的 glReadPixel 获取颜色数据后,直接使用 Unity 的 LoadRawTextureData 读取,绕过 Texture2DExt 部分。

已做尝试:

直接关闭 Texture2DExt 部分后,glReadPixel 获取颜色数据为空。推测 FBO 应该是需要渲染纹理的。

直接使用 glDisableVertexAttribArray,开发板上显示正常,但 极米 Z6X 显示黑屏。
在文章中,找到了类似的情况:

这里遇到一个坑就是,如果在glDrawElements或glDrawArrays后调用以下的方法:

GLES20.glDisableVertexAttribArray(positionHandle);
GLES20.glDisableVertexAttribArray(maTextureHandle);

那么就会出现 validate_vertex_attrib_state: no vertex attrib is enabled in a draw call 错误!!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.