tests.exe: 0xC0000005: Access violation reading location 0x00000000.

Hi,
When I went to 2nd menuitem - Transitions Test, and clicked the right arrow, I got this Access violation.

The debugger stopped at glGenFramebuffers(1, &m_uFBO); in bool CCRenderTexture::initWithWidthAndHeight(int w, int h, CCTexture2DPixelFormat eFormat) in CCRenderTexture.cpp. m_uFBO = 0.

I #define CC_TEXTURE_ATLAS_USE_VAO 0. I tried cocos2d-2.0-rc0a-x-2.0 and cocos2d-2.0-rc2-x-2.0.1.
Could anyone please help?

below is the call stack:

libcocos2d.dll!cocos2d::CCRenderTexture::initWithWidthAndHeight(int w=480, int h=320, cocos2d::CCTexture2DPixelFormat eFormat=kCCTexture2DPixelFormat_RGBA8888) Line 134 + 0x17 bytes C*+
libcocos2d.dll!cocos2d::CCRenderTexture::renderTextureWithWidthAndHeight Line 88* 0x18 bytes C*+
libcocos2d.dll!cocos2d::CCTransitionProgress::onEnter Line 65* 0x17 bytes C*+
libcocos2d.dll!cocos2d::CCDirector::setNextScene Line 636* 0x1a bytes C*+
libcocos2d.dll!cocos2d::CCDirector::drawScene Line 219 C*+
libcocos2d.dll!cocos2d::CCDisplayLinkDirector::mainLoop() Line 924 C*+
libcocos2d.dll!cocos2d::CCApplication::run Line 66* 0x20 bytes C*+
tests.exe!wWinMain Line 23* 0x19 bytes C*+
tests.exe!__tmainCRTStartup Line 574* 0x35 bytes C
tests.exe!wWinMainCRTStartup() Line 399 C
kernel32.dll!7c817077()
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
msvcrt.dll!77c2c2e3()
tests.exe!EffectAdvanceTextLayer::onEnter() Line 326 + 0x58 bytes C++
3783e800()

below is the debug output:
Ready for GLSL

Ready for OpenGL 2.0

cocos2d: cocos2d-2.0-rc0a-x-2.0
cocos2d: padding: 0,0,0,0
cocos2d: GL_VENDOR: Intel
cocos2d: GL_RENDERER: Intel 965/963 Graphics Media Accelerator
cocos2d: GL_VERSION: 2.0.0 - Build 7.15.10.5016
cocos2d: GL_MAX_TEXTURE_SIZE: 2048
cocos2d: GL_MAX_TEXTURE_UNITS: 16
cocos2d: GL supports PVRTC: NO
cocos2d: GL supports BGRA8888 textures: NO
cocos2d: GL supports NPOT textures: YES
cocos2d: GL supports discard_framebuffer: NO
cocos2d: compiled with Profiling Support: NO
color type 6
color type 6
……………
cocos2d : getActionByTag: Target not found
cocos2d: CCTextureCache: texture: d:2d-x\cocos2d-cocos2d-x-8689e61\tests\Resources\fps_images.png
cocos2d: CCTextureCache: texture: d:2d-x\cocos2d-cocos2d-x-8689e61\tests\Resources\Images/close.png
color type 3
color type 6
color type 6
color type 6
color type 6
color type 6
color type 6
Scene 1 onEnter
Scene 1: onEnterTransitionDidFinish
color type 3
Scene 2 onEnter
First-chance exception at 0x00000000 in tests.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x00000000 in tests.exe: 0xC0000005: Access violation reading location 0x00000000.
The program ‘[1328] tests.exe: Native’ has exited with code 0 (0x0).

did you find a solution to this, I also get the same issue ?

Edit : just to add that this is version cocos2d-2.0-rc2-x-2.0.1, win32 (windows 7)

Not yet.

Hey, all,
I tested this issue, but no crashes appear. Whether it will also crash when setting CC_TEXTURE_ATLAS_USE_VAO to 1 ?

TextureMipMap in tests crash on texture0->generateMipmap(); in method OnEnter. Did somebody know the reason?

James - [Yes it also crashes when setting CC_TEXTURE_ATLAS_USE_VAO to 1.]

I’m pretty stumped. On the web there are discussions that you may need to load glGenFramebuffers using the function address, as some people have reported that gl extensions are not being loaded correctly on thier systems, maybe something with the video driver too. although I have checked that glGenFramebuffers is supported on my system.

I have setted CC_TEXTURE_ATLAS_USE_VAO to 0,

TextureMipMap crash too.

I am also having issue with access violation on computer running OpenGL 2.1.0.

Narrowed it down to glGenFramebuffers and several other functions being NULL, but glGenFramebuffersEXT exists.

Please find attached a patch for CCEGLView.cpp fixing this.

Anyway, I think several things should be addressed in cocos:

  1. OpenGL version detection using glGetString(GL_VERSION). If it is below supported version then display message “You are using OpenGL x.x, but version y.y is required to run. Please upgrade video card drivers.”.

  2. If some OpenGL functions used don’t exist, display similar message box, don’t create GPF.

  3. Include option to disable hardware acceleration for OpenGL:
    http://www.wischik.com/lu/programmer/wingl.html#accelerated

Thanks for your patch, but could you send us a PR from github? https://github.com/cocos2d/cocos2d-x

John Angel wrote:

I am also having issue with access violation on computer running OpenGL 2.1.0.
>

Narrowed it down to glGenFramebuffers and several other functions being NULL, but glGenFramebuffersEXT exists.
>
Please find attached a patch for CCEGLView.cpp fixing this.
>
Anyway, I think several things should be addressed in cocos:
>

  1. OpenGL version detection using glGetString(GL_VERSION). If it is below supported version then display message “You are using OpenGL x.x, but version y.y is required to run. Please upgrade video card drivers.”.
    >
  2. If some OpenGL functions used don’t exist, display similar message box, don’t create GPF.
    >
  3. Include option to disable hardware acceleration for OpenGL:
    http://www.wischik.com/lu/programmer/wingl.html#accelerated

I did the pull request, hope it is correctly done.