OpenGL ES 2.0升级到3.0配置win32环境以及编译所遇bug
2017-08-10 13:22
2146 查看
安装win32平台的OpenGL ES 3.0模拟器
一,安装3.0模拟器,一般用32位的(https://developer.arm.com/products/software-development-tools/graphics-development-tools/opengl-es-emulator)
二,测试模拟器
在安装目录点击mali-cube.exe,如果出现立方体转动说明模拟器安装成功。三,配置环境
将安装目录中的libEGL.dll libGLESv2.dll文件和openglessl文件夹拷贝到C:\Windows\System32以及\Visual Studio\VC\bin 里面,libEGL.lib和libGLESv2.lib文件拷到\Visual Studio\VC\lib中,如果项目中需要也得拷贝一份。编译所遇bug
一,Compilation error in shader: Error: 0:4: L0003: Keyword ‘attribute’ is reserved, Keyword ‘varying’ is reserved
OpenGL ES 3.0中将2.0的attribute改成了in,顶点着色器的varying改成out,片段着色器的varying改成了in,也就是说顶点着色器的输出就是片段着色器的输入,另外uniform跟2.0用法一样二,0:11: S0001: Type mismatch in arithmetic operation between ‘int’ and ‘float’
float和int不能做操作,必须转成相同类型,也就是说算术操作中不能同时有1和1.0相加这种情况。三,设备不支持下述扩展
Compilation error in shader: 0:2: P0003: Warning: Extension 'GL_OES_EGL_image_external' not supported 0:3: P0003: Warning: Extension 'GL_OES_EGL_image_external_essl3' not supported
查看设备所支持的扩展:
String str= GLES20.glGetString(GLES20.GL_EXTENSIONS);
注意:这句代码必须在OpenGL ES环境配置好才能调用,如可以在onSurfaceChanged中调用
四,Expected token ‘{‘, found ‘identifier’
这种错误一般是语法错误,比如使用samplerExternalOES,但是没加#extension GL_OES_EGL_image_external : require五,1,0:1: Warning: GL_OES_EGL_image_external is deprecated in ESSL 3 and later versions
这个警告可以忽视,因为不加#extension GL_OES_EGL_image_external : require,当使用samplerExternalOES时就会报这个错误,ERROR: 0:6: ‘samplerExternalOES’ : requires extension GL_OES_EGL_image_external_essl3 to be enabled六,D/MALI: gles_state_set_error_internal:70: [MALI] GLES error info:currently bound framebuffer is not valid for this operation
当前操作不需要帧缓冲区,取消掉即可七,GLES error info: , and are not a valid combination
当使用glTexImage3D(GLES30.GL_TEXTURE_3D, 0, GLES30.GL_RGB, size, size, size, 0, GLES30.GL_RGB, GLES30.GL_FLOAT, buffer);时,buffer的类型使用ByteBuffer代替FloatBuffer,GLES30.GL_FLOAT类型也要改变成GL_UNSIGNED_BYTE,这里buffer的大小必须是size * size * size * 3八,No matching function for call to ‘texture2D’,No matching function for call to ‘texture3D’
OpenGL ES 3.0的shader中没有texture2D和texture3D等了,全部使用texture替换九,0:14: L0002: Undeclared variable ‘gl_FragColor’
OpenGL ES 2.0的gl_FragColor和gl_FragData在3.0中取消掉了,需要自己定义out变量作为片段着色器的输出颜色,如 out vec4 fragColor;gl_Position还存在
十,0:13: S0047: Output variable declared inside a function
in或者out变量等不能在函数内(如main函数内)声明十一,MALI: gles_state_set_error_internal:70: [MALI] GLES error info: is not an accepted value
应该这样使用glActiveTexture(GL_TEXTURE0 + n); //n为0,1,2……不要因为使用GL_TEXTURE_3D或GLES11Ext.GL_TEXTURE_EXTERNAL_OES等纹理类型,而使用glActiveTexture(GL_TEXTURE_EXTERNAL_OES);或glActiveTexture(GL_TEXTURE_3D );,这样是错误的。
十二,#version must be the first directive/statement in a program
Compilation error in shader: Error: 0:2: P0005: #version must be on the first line in a program and only whitespace are allowed in the declaration“#version 300 es”此类语句放在第一行,并且shader中不能有Tab键,只能用空格替换
十三,glCompileShader -> No shader compiler found.
将3.0模拟器中的openglessl放在C:\Windows\System32或C:\Windows\SysWOW64中十四,win32运行有下述错误
error LNK2001: unresolved external symbol __imp__glTexImage3D@40
找不到glTexImage3D函数,libEGL.lib和libGLESv2.lib库版本不对,换成3.0的即可
十五,Compilation error in shader: Error: 0:4: L0001: Storage qualifier not allowed
这是因为使用3.0的语法,却没有加上#version 300 es作者:lb377463323
出处:http://blog.csdn.net/lb377463323
原文链接:http://blog.csdn.net/lb377463323/article/details/77047221
转载请注明出处!
相关文章推荐
- Windows 上Mali仿真实践编译OpenGL ES 3.0 Programming Guide 例程环境配置
- sublime text 3 快捷键大全以及配置编译环境
- 图解WSUS3.0部署、配置以及与WSUS2.0的区别
- sublime text 3 快捷键大全以及配置编译环境
- Cocos2d-js-v3.2 在 mac 上配置环境以及编译到 Andorid 的注意事项
- Linux环境下node.js环境的搭建以及配置,使用node.js编写工具与简化less编译
- cocos2dx3.0 mac 安卓编译环境配置
- 如何更换jdk版本,以及在eclipse上配置jdk编译环境
- vs2005 .net 2.0 csc.exe的编译环境变量设置(配置)
- 【Win32汇编】编译环境配置
- NDK环境变量的配置以及编译方法(linux环境下)
- 【转】ubuntu下安装eclipse以及配置python编译环境
- sublime text 3 快捷键大全以及配置编译环境
- sublime text 3 快捷键大全以及配置编译环境
- java基础—配置java环境以及编译简单的java程序
- cocos2d-x 笔记(一) win32环境配置以及eclipse+ndk+sdk+cygwin的android移植
- windows下xapian的编译以及编程环境的配置
- openwrt编译openswan——以及交叉编译环境配置
- sublime text 3 快捷键大全以及配置编译环境