Updated to v0.2.0I decided that I was going to have a look into OpenGL and looked at the SFML example and tweaked it to get a feel of how it works.
Then, I realised that I would want to be loading those objects from a file rather than storing them in the source code and considered saving them out and reloading them.
I then realised that I could just attempt to import existing formats of 3D objects and found .OBJ to be the easiest to get documentation for, and is so widely used, so I got side-tracked and created a class to help.
This class loads .OBJ files and converts them into vertex array of GLfloats, ready to pass to OpenGL.It imports geometry vertices, texture vertices, and normal vertices but only geometry has been tested. This is because I am new to OpenGL and have yet to figure out lighting and texturing. Because of this, it creates a colour array of GLfloats (ready to pass to OpenGL) where each triangle is a random colour.
Feel free to use it in tests and things. As I mentioned earlier, I only really made it to make my 3D investigations a bit more interesting, and I didn't see the point in using an existing library for it when I could create it myself and learn in the process.
I would not consider it "complete" but it does the job of importing objects fine (for me). I was going to continue with importing textures etc. but I can't test if it's doing what it's supposed to be doing
I added the ability to manipulate the object too, so it now stores it twice - once in (sort of) .obj format, and once in GL format. You use the class to manipulate the obj version, then refresh the gl version from the obj version. This requires complete recreation of the GL version so it's quite slow for complicated objects.
Feel free to comment on my code. I'm no expert at C++ or SFML, nor especially OpenGL, so any tips would be appreciated. It's not designed to catch all errors in usage so it should be used properly. I will probably add more user-error security later.
Objex on GitHubHere's a video of a test using a
cow model from the internet: