I'm trying to draw simple things with OpenGL ES on a Raspberry Pi.
I created a context through the X system and the glx_create_context_es2_profile extension. This resulted in what I hope is an OpenGL ES 2.0 context (the testing functions gave weird values), but it seems to work for some things (e.g., it gave salient feedback on a shader, which it successfully compiled).
The code is:
GLint loc_vert = program->get_location_attribute("vertex");
printf("Loc vert=%d, vertex size=%d\n",loc_vert,sizeof(Vertex));
glEnableVertexAttribArray(loc_vert); glVertexAttribPointer(loc_vert, 4,GL_FLOAT, GL_FALSE, sizeof(Vertex),vertices);
printf("Begin glDrawArrays=%p with %d,%d,%d\n",glDrawArrays, mode,0,num_vertices);
glDrawArrays(mode, 0,num_vertices);
printf("End glDrawArrays=%p\n",glDrawArrays);
glDisableVertexAttribArray(loc_vert);
The "vertices" array is a static array of four verticesThe output is:
I checked against the documentation and my previous code, and this should be valid (it also runs fine on two other systems).Loc vert=0, vertex size=68
Begin glDrawArrays=<some ptr> with 1,0,2
segfault
I took the liberty of disassembling glDrawArrays:
It segfaults on "0xb6e63510 <+16>", which is a jump.Dump of assembler code for function glDrawArrays:
0xb6e63500 <+0>: ldr r3, [pc, #42985368] ; 0xb6e63528 <glDrawArrays+40>
0xb6e63504 <+4>: push {r4, lr}
0xb6e63508 <+8>: mov r4, r0
0xb6e6350c <+12>: ldr r3, [pc, r3]
0xb6e63510 <+16>: bl 0xb6e6f110
0xb6e63514 <+20>: ldr r3, [r0, r3]
0xb6e63518 <+24>: mov r0, r4
0xb6e6351c <+28>: ldr r3, [r3, #3122144] ; 0x4d8
0xb6e63520 <+32>: blx r3
0xb6e63524 <+36>: pop {r4, pc}
0xb6e63528 <+40>: andeq r8, r1, r12, asr sp
End of assembler dump.
Ideas?
-G