Jump to content

  • Log In with Google      Sign In   
  • Create Account

Edin M.

Member Since 21 Apr 2006
Offline Last Active Aug 01 2016 05:50 AM

Posts I've Made

In Topic: Indexing multiple VBOs

07 January 2014 - 02:12 PM


In Topic: VBO .obj .3ds and some concept questions

16 May 2011 - 05:49 PM

I think I have found a solution. Basicly all I do is go for each faceitem I test if new vertices array contains vertex from old array that has index of i-th polyface. If it does I check uvmap arrays also, and if both match I can add that old index into indices array else I add new vertex/uv to their arrays. There's gonna be more problems I expect but I've tried few models and this method works.

In Topic: VBO .obj .3ds and some concept questions

16 May 2011 - 08:22 AM

Oh, yes I did. Got mixed up hehe. About fileformats I know structures of both and it's no problem writing importer/exporter. But generating data to be written is a little bit more difficult. Let's say writing a converter for .obj to .3ds. No problem reading .obj file; no problem writing .3ds file. But if I have cube that has 8 vertices in .obj file (triangulated), I don't know which 20 vertices to write to .3ds file.

Note that when I would be able to convert correctly I could override generating .3ds file and feed that data into opengl directly. I'm just using .3ds as a valid reference for data structure that can be passed to opengl directly without modification.

For cube if I have 8 vertices 20 uvs and 12 faces, I need to use those 12 faces that contain uv and vertices array indices to generate total of 20 vertices and new array of 12 triangles (face in .3ds and my vbo data is triangle). Now I'm in process of learning and would like to figure this thing out without using external libraries and it would be very unpractical if I would have to rely on external 3D apps for .obj23ds conversion only. I've seen assimp but not tried it. That and OSG are my final resort and will try not to use them (what would I learn if otherwise). Going through some books and forums I'm trying to save my self hours and days of reading codebase of those two and trying to understand how they dealt with this.

Back to cube example, here's how C++ arrays look after loading .3ds file:

Posted Image

And here's .obj:


I have no problem getting that .obj to C++ arrays (vectors, anything...). Now what I need is to convert that data to data/arrays in image above (which are from .3ds file of same cube). I have tried some of mine observations but they only worked (kind of) on cube example and none other. Maybe the whole idea I have is wrong. I just want to transfer data from 3D app to opengl using VBO and glDrawElements and I thought simplest way was .obj (I don't have .3ds exporter and cannot use some other 3d app)