c++ - QByteArray from QFile -
i want read byte array 3d texture.
qfile file(filename); if(!file.open(qiodevice::readonly)) { return false; } qbytearray* data = new qbytearray(file.readall(), m_imagewidth*m_imageheight*m_imagecount ); glgentextures(1, m_textures); glactivetexture(gl_texture0); glbindtexture(gl_texture_3d, m_textures[0]); glteximage3d(gl_texture_3d, 0, gl_luminance, m_imagewidth, m_imageheight, m_imagecount, 0, gl_luminance, gl_unsigned_byte, data);
can this? access violations in project , want check if come here.
it write violation @ glteximage3d()
your data
variable holds pointer place in memory qbytearray object stored, actual data encapsulates stored somewhere else. when glteximage3d
tries read big block of memory starting @ data
pointer, runs unmapped memory.
to pointer acutal data, use data->constdata() instead. qbytearray::constdata
Comments
Post a Comment