我有一個Renderer的樹結構。如果我把它們加載之前呈現一切工作正常,但如果我加載它們而渲染我得到一個內存轉儲。當渲染代碼加載時,OpenGL ES崩潰
02-07 17:50:00.721: INFO/DEBUG(2355): signal 11 (SIGSEGV), fault addr 00000000
02-07 17:50:00.721: INFO/DEBUG(2355): r0 00000000 r1 4bf22eb0 r2 00000010 r3 00000004
02-07 17:50:00.721: INFO/DEBUG(2355): r4 0023d2e8 r5 0023e154 r6 00000000 r7 00000004
02-07 17:50:00.721: INFO/DEBUG(2355): r8 00000010 r9 00000010 10 00000000 fp 00000001
02-07 17:50:00.721: INFO/DEBUG(2355): ip 00000001 sp 4b7bdaa8 lr 81b06b70 pc 81b30dc0 cpsr 80000010
02-07 17:50:00.721: INFO/DEBUG(2355): d0 6472656767756265 d1 0000000000000000
02-07 17:50:00.721: INFO/DEBUG(2355): d2 000000640024c100 d3 0000000044936800
02-07 17:50:00.721: INFO/DEBUG(2355): d4 0000000000000000 d5 0000000000000000
02-07 17:50:00.721: INFO/DEBUG(2355): d6 000000000012eca8 d7 0000000000000000
02-07 17:50:00.721: INFO/DEBUG(2355): d8 0000000000000000 d9 0000000000000000
02-07 17:50:00.721: INFO/DEBUG(2355): d10 0000000000000000 d11 0000000000000000
02-07 17:50:00.721: INFO/DEBUG(2355): d12 0000000000000000 d13 0000000000000000
02-07 17:50:00.721: INFO/DEBUG(2355): d14 0000000000000000 d15 0000000000000000
02-07 17:50:00.721: INFO/DEBUG(2355): d16 c1d0a059b6bb9581 d17 3f50624dd2f1a9fc
02-07 17:50:00.721: INFO/DEBUG(2355): d18 41c9bc2c66800000 d19 3fe000000025a36b
02-07 17:50:00.721: INFO/DEBUG(2355): d20 4008000000000000 d21 3fd99a27ad32ddf5
02-07 17:50:00.721: INFO/DEBUG(2355): d22 3fd24998d6307188 d23 3fcc7288e957b53b
02-07 17:50:00.721: INFO/DEBUG(2355): d24 3fc74721cad6b0ed d25 3fc39a09d078c69f
02-07 17:50:00.721: INFO/DEBUG(2355): d26 0000000000000000 d27 0000000000000000
02-07 17:50:00.721: INFO/DEBUG(2355): d28 0000000000000000 d29 0000000000000000
02-07 17:50:00.721: INFO/DEBUG(2355): d30 0000000000000000 d31 0000000000000000
02-07 17:50:00.721: INFO/DEBUG(2355): scr 20000012
02-07 17:50:00.815: INFO/DEBUG(2355): #00 pc 00030dc0 /system/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
02-07 17:50:00.823: INFO/DEBUG(2355): #01 lr 81b06b70 /system/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
02-07 17:50:00.823: INFO/DEBUG(2355): code around pc:
02-07 17:50:00.823: INFO/DEBUG(2355): 81b30da0 e781410c e28cc001 e15c0003 3afffffa
02-07 17:50:00.823: INFO/DEBUG(2355): 81b30db0 e8bd8010 e92d4010 e3a0c000 ea000004
02-07 17:50:00.823: INFO/DEBUG(2355): 81b30dc0 e5904000 e5014008 e5904004 e0800002
02-07 17:50:00.827: INFO/DEBUG(2355): 81b30dd0 e5014004 e15c0003 e2811008 e28cc001
02-07 17:50:00.831: INFO/DEBUG(2355): 81b30de0 3afffff6 e8bd8010 e92d4010 e3a0c000
02-07 17:50:00.831: INFO/DEBUG(2355): code around lr:
02-07 17:50:00.835: INFO/DEBUG(2355): 81b06b50 e3530000 1a000005 e59c0028 e1a03007
02-07 17:50:00.835: INFO/DEBUG(2355): 81b06b60 e59c102c e59c2024 e1a0e00f e59cf034
02-07 17:50:00.838: INFO/DEBUG(2355): 81b06b70 e2866001 e2855004 e5942ec0 e3a03001
02-07 17:50:00.838: INFO/DEBUG(2355): 81b06b80 e1560002 3affffeb e088800a e2840d77
02-07 17:50:00.838: INFO/DEBUG(2355): 81b06b90 e2888003 e280000c e1a02003 e0278799
02-07 17:50:00.838: INFO/DEBUG(2355): stack:
02-07 17:50:00.838: INFO/DEBUG(2355): 4b7bda68 00000004
02-07 17:50:00.842: INFO/DEBUG(2355): 4b7bda6c afd0bfc9 /system/lib/libc.so
02-07 17:50:00.842: INFO/DEBUG(2355): 4b7bda70 00000000
02-07 17:50:00.846: INFO/DEBUG(2355): 4b7bda74 00000001
02-07 17:50:00.846: INFO/DEBUG(2355): 4b7bda78 00000003
02-07 17:50:00.846: INFO/DEBUG(2355): 4b7bda7c 00000001
02-07 17:50:00.850: INFO/DEBUG(2355): 4b7bda80 00000000
02-07 17:50:00.854: INFO/DEBUG(2355): 4b7bda84 00000000
02-07 17:50:00.854: INFO/DEBUG(2355): 4b7bda88 000e44f0 [heap]
02-07 17:50:00.858: INFO/DEBUG(2355): 4b7bda8c 0023d2e8 [heap]
02-07 17:50:00.858: INFO/DEBUG(2355): 4b7bda90 0023e154 [heap]
02-07 17:50:00.858: INFO/DEBUG(2355): 4b7bda94 00000000
02-07 17:50:00.862: INFO/DEBUG(2355): 4b7bda98 00000004
02-07 17:50:00.862: INFO/DEBUG(2355): 4b7bda9c 00000010
02-07 17:50:00.862: INFO/DEBUG(2355): 4b7bdaa0 df002777
02-07 17:50:00.866: INFO/DEBUG(2355): 4b7bdaa4 e3a070ad
02-07 17:50:00.866: INFO/DEBUG(2355): #00 4b7bdaa8 0023d2e8 [heap]
02-07 17:50:00.866: INFO/DEBUG(2355): 4b7bdaac 81b06b70 /system/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
02-07 17:50:00.866: INFO/DEBUG(2355): 4b7bdab0 0023d2e8 [heap]
02-07 17:50:00.866: INFO/DEBUG(2355): 4b7bdab4 00000004
02-07 17:50:00.870: INFO/DEBUG(2355): 4b7bdab8 00000004
02-07 17:50:00.870: INFO/DEBUG(2355): 4b7bdabc 00000000
02-07 17:50:00.874: INFO/DEBUG(2355): 4b7bdac0 00000005
02-07 17:50:00.874: INFO/DEBUG(2355): 4b7bdac4 00000001
02-07 17:50:00.874: INFO/DEBUG(2355): 4b7bdac8 00000004
02-07 17:50:00.874: INFO/DEBUG(2355): 4b7bdacc 81b08510 /system/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
02-07 17:50:00.874: INFO/DEBUG(2355): 4b7bdad0 0023d2e8 [heap]
02-07 17:50:00.874: INFO/DEBUG(2355): 4b7bdad4 81b6a5fc /system/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
02-07 17:50:00.878: INFO/DEBUG(2355): 4b7bdad8 00000004
02-07 17:50:00.878: INFO/DEBUG(2355): 4b7bdadc 00000000
02-07 17:50:00.878: INFO/DEBUG(2355): 4b7bdae0 00000005
02-07 17:50:00.878: INFO/DEBUG(2355): 4b7bdae4 81b09954 /system/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
02-07 17:50:00.878: INFO/DEBUG(2355): 4b7bdae8 00000004
02-07 17:50:00.881: INFO/DEBUG(2355): 4b7bdaec 00000000
所有的渲染器是:
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glBindBuffer(GL_ARRAY_BUFFER, mArraybuffer);
glVertexPointer(2, GL_FLOAT, sizeof(TextureMap), NULL);
glTexCoordPointer(2, GL_FLOAT, sizeof(TextureMap), (void *)offsetof(TextureMap, coord));
glBindBuffer(GL_ARRAY_BUFFER, 0);
glDrawArrays(GL_TRIANGLE_STRIP, 0, mSize);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
,我知道它崩潰的glEnableClientState(GL_VERTEX_ARRAY)
。我想知道的是爲什麼它會崩潰,或者至少是我爲什麼不應該做我在做什麼的原因?
編輯:我已經設計了它,當屏幕被點擊時用上面的代碼加載渲染器。它會生成一個數組緩衝區並相應地分配數組。然後我將渲染器添加到渲染器樹中,但是當它首次渲染時會崩潰並獲取上述內存轉儲。
GLuint arraybuffer;
glGenBuffers(1, &arraybuffer);
TextureMap data[] = {
{{-69.573, 39.74}, {325.0/512.0, 279.75/512.0}},
{{-69.573, 83.24}, {325.0/512.0, 323.25/512.0}},
{{71.571, 39.74}, {466.45/512.0, 279.75/512.0}},
{{71.571, 83.24}, {466.45/512.0, 323.25/512.0}},
};
glBindBuffer(GL_ARRAY_BUFFER, arraybuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(TextureMap) * 4, data, GL_STATIC_DRAW);
TextureMapBufferRenderer *renderer = new TextureMapBufferRenderer(arraybuffer); //generates a renderer for array buffer
renderer->load();
glBindBuffer(GL_ARRAY_BUFFER, 0);
mManager->renderer()->addChildRenderer(renderer);
上面的代碼是當它在水龍頭上執行時。如果我在開始時使用相同的代碼,它將起作用。
這很難說沒有看到周圍的代碼。你可以多發一些關於這是如何被調用的? – Thomas 2011-02-07 19:01:23