I had a vbo related question related to the mac. In my program, I replaced my display lists with vbos.
In conjunction with the vbo, I am considering reading in a file of binary data – verts, uv, normals and tbn data. Then give the vbo an offset into chunk of memory I read in from the file. Thus, no parsing of text etc. It would be very fast.
The problem is there is a little and big endian issue because of ppc/x86 macs. Is there a way to tell opengl the data in the vbo is big or little endian? Is there an Apple extension?
I could save two copies of the data in the file. Detect the endianess and choose the appropriate offset. But the file would be twice as big. I’d like to avoid that.
At the moment, I’m reading in obj files. After some thinking, I leaning towards getting rid of these troublesome file formats. I’d like to push file formats into another problem space outside my program. Maybe make a converter program in cocoa etc…
There is no way to tell OpenGL the endianes of the data you pass it. It always assumes the systems endianes. Instead of storing the data twice you would need to convert to the right endianes at load time.
When dealing with anything hard-disk related, “fast” is a very relative term. So the occasional endian conversion shouldn’t be too big a deal.
You can reasonably assume that a given system won’t change its endianness often (or at all). So, probably the fastest thing to do is include in the file a bit which indicates the endianness of the data contained in it.
Then, when reading the file, check the bit against the system endianness. If it’s the same, read as normal; if it’s different, then convert the data, re-output it as the system endianness, and then continue.
Hopefully this will make the conversion something which doesn’t need to happen on the vast majority of loads.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.