某些图片通过cc.loader.load无法正常加载

  • Creator 版本:2.1

  • 目标平台: iOS 和android 都存在

  • 详细报错信息,包含调用堆栈:
    [ERROR] (/Users/mac/workspace/git/datePlay/DatePlay/CCGameProject/cocos/scripting/js-bindings/manual/jsb_opengl_manual.cpp, 2278): glTexSubImage2D((GLenum)target , (GLint)level , (GLint)xoffset , (GLint)yoffset , (GLsizei)width , (GLsizei)height , (GLenum)format , (GLenum)type , (GLvoid*)pixels); GL error 0x502: GL_INVALID_OPERATION
    [ERROR] Failed to invoke JSB_glTexSubImage2D, location: /Users/mac/workspace/git/datePlay/DatePlay/CCGameProject/cocos/scripting/js-bindings/manual/jsb_opengl_manual.cpp:2282
    [ERROR] (/Users/mac/workspace/git/datePlay/DatePlay/CCGameProject/cocos/scripting/js-bindings/manual/jsb_opengl_manual.cpp, 2278): glTexSubImage2D((GLenum)target , (GLint)level , (GLint)xoffset , (GLint)yoffset , (GLsizei)width , (GLsizei)height , (GLenum)format , (GLenum)type , (GLvoid*)pixels); GL error 0x502: GL_INVALID_OPERATION
    [ERROR] Failed to invoke JSB_glTexSubImage2D, location: /Users/mac/workspace/git/datePlay/DatePlay/CCGameProject/cocos/scripting/js-bindings/manual/jsb_opengl_manual.cpp:2282
    [ERROR] (/Users/mac/workspace/git/datePlay/DatePlay/CCGameProject/cocos/scripting/js-bindings/manual/jsb_opengl_manual.cpp, 2278): glTexSubImage2D((GLenum)target , (GLint)level , (GLint)xoffset , (GLint)yoffset , (GLsizei)width , (GLsizei)height , (GLenum)format , (GLenum)type , (GLvoid*)pixels); GL error 0x502: GL_INVALID_OPERATION
    [ERROR] Failed to invoke JSB_glTexSubImage2D, location: /Users/mac/workspace/git/datePlay/DatePlay/CCGameProject/cocos/scripting/js-bindings/manual/jsb_opengl_manual.cpp:2282
    [ERROR] (/Users/mac/workspace/git/datePlay/DatePlay/CCGameProject/cocos/scripting/js-bindings/manual/jsb_opengl_manual.cpp, 2278): glTexSubImage2D((GLenum)target , (GLint)level , (GLint)xoffset , (GLint)yoffset , (GLsizei)width , (GLsizei)height , (GLenum)format , (GLenum)type , (GLvoid*)pixels); GL error 0x502: GL_INVALID_OPERATION
    [ERROR] Failed to invoke JSB_glTexSubImage2D, location: /Users/mac/workspace/git/datePlay/DatePlay/CCGameProject/cocos/scripting/js-bindings/manual/jsb_opengl_manual.cpp:2282

[ERROR] (/Users/mac/workspace/git/datePlay/DatePlay/CCGameProject/cocos/scripting/js-bindings/manual/jsb_opengl_manual.cpp, 2278): glTexSubImage2D((GLenum)target , (GLint)level , (GLint)xoffset , (GLint)yoffset , (GLsizei)width , (GLsizei)height , (GLenum)format , (GLenum)type , (GLvoid*)pixels); GL error 0x502: GL_INVALID_OPERATION
[ERROR] Failed to invoke JSB_glTexSubImage2D, location: /Users/mac/workspace/git/datePlay/DatePlay/CCGameProject/cocos/scripting/js-bindings/manual/jsb_opengl_manual.cpp:2282

  • 重现方式:
    比如这张图片:http://devpic.aimymusic.com/386185dcdc116631787768ce3a4a7961.jpg?imageView2/0/w/200
    复现方式: 由于我们设计了图片缓存,所以并不是 直接调用cc.loader.load 方法加载这个URL,还是先把这个图片下载下来保存到本地,然后再 通过 cc.loader.load 加载的本地图片。 加载这张图片时,cc.loader.load 方法正常回调,没有错误,但是设置spriteFrame的时候会报错,也就无法显示出这张图。

  • 之前哪个版本是正常的 :

  • 手机型号 :

  • 手机浏览器 :

  • 编辑器操作系统 :

  • 编辑器之前是否有其它报错 :

  • 出现概率:

  • 额外线索:

自己排查下,可能是纹理分辨率不支持或者文件格式本身有问题,顺便提供下无法加载的图片,我们也看看。

http://devpic.aimymusic.com/386185dcdc116631787768ce3a4a7961.jpg?imageView2/0/w/200
这张图片

补充一下,经测试 在网页上是可以 正常显示出来的,但是在 iOS 和安卓上 就会报错,并且 直接在场景编辑器里面设置此图片作为spriteFrame 时,编辑器里可以正常显示 ,同样在原生 App里运行时就会报错。 CCC 2.1版本。

“http://devpic.aimymusic.com/386185dcdc116631787768ce3a4a7961.jpg?imageView2/0/w/200”

“http://pic.aimymusic.com/8702bc6e67fbbc27ed4c9b89f4152a40.jpg?imageView2/0/w/200” 这张图也不行,你看下。

是BUG,这个jpeg是灰度图编码,引擎现在对灰度图的渲染存在加载问题,转成普通RPG格式的Jpeg图片应该就没有问题, 已经反馈修复。

奇怪了,这个是通过七牛的图片处理过的,但是原图加载又没有问题。这个是原图,大佬看下呢“http://pic.aimymusic.com/8702bc6e67fbbc27ed4c9b89f4152a40.jpg”

处理过的图片与原图的数据编码方式不一样了,这个需要查看jpeg的头信息才能发现。

这个问题解决了吗。或者有解决的方法了吗

这个问题解决了吗,楼主

@kenshin

哪个大神能知道这个问题怎么解决啊。或者你们用的什么方式转码

顶上去,求大神帮忙说一下啊

顶起…

请问,引擎研发团队最新发布的2.0.9版本修复了吗?

经验证2.0.9版本已经修复,多谢官方团队。

同问 解决了么

我用的2.0.9还是不行啊

@kenshin 这个问题解决了嘛