android - Loading raw VBO data via MappedByteBuffer into OpenGL (not working) -
android - Loading raw VBO data via MappedByteBuffer into OpenGL (not working) -
i've attempted load raw, uncompressed vbo info via method presented in talk google did @ gdc 2011. method uses mappedbytebuffer load info in subsequent phone call glbufferdata. unfortunately, me, it's not working. able find hacky work around (its commented out in code below), working without hack. here sample of code:
fileinputstream fis = new fileinputstream(new file(location)); filechannel fc = fis.getchannel(); mappedbytebuffer mbb = fc.map(mapmode.read_only, 0, fc.size()); // hackery because passing mbb glbufferdata isn't working. //floatbuffer fb = mbb.asfloatbuffer(); //float triangles[] = new float[fb.capacity()]; //for(int = 0; < triangles.length; i++) { // triangles[i] = fb.get(i); //} //fb = floatbuffer.wrap(triangles); bufferinfo = new int[3]; bufferinfo[0] = newbufferid(); int size = (int)fc.size(); gles20.glbindbuffer(gles20.gl_array_buffer, bufferinfo[0]); gles20.glbufferdata(gles20.gl_array_buffer, size, mbb, gles20.gl_static_draw);
two years passed since post, entry on stack overflow regarding mappedbytebuffer , loading info vbo , think found solution.
in sentiment problem not code, info you're trying load. in case helped when i've changed endianness of stored vertex info little endian.
this google in provided example: point generated using sphere.c, if run programme values in little endian , that's why demo works. when tried store values java using dataoutputstream got big endian order.
android opengl-es vbo bytebuffer filechannel
Comments
Post a Comment