View Full Version : Stupid Question
I know this is a stupid question, and its probably been asked and answered before, but I'm too lazy to hunt it down.
How do I use a mesh in pure C++?
I don't really want to use DirectX, maybe OpenGL?
I guess I shouldn't say 'use', but more like display. Also, how do I navigate the 'workspace' with my 'camera'?
Reedbeta
04-19-2008, 01:24 PM
You make an array of all the vertices, use glVertexPointer, glNormalPointer, glTexCoordPointer etc. (or glInterleavedArrays) to tell OpenGL where the different components of the vertex are, and then you call a function like glDrawArrays to draw them.
First step is to stop being lazy ;)
Thank you SO much, Reedbeta. You're ALWAYS helpful.
How do I access the vertices, though? And how do I position the mesh in my 'world'?
Reedbeta
04-19-2008, 06:59 PM
What do you mean by "access the vertices"? If you're talking about loading a mesh from a file, it depends on the format, and there are free libraries out there for most popular mesh file formats.
To position the mesh you can apply a rotation and/or translation to it, which could mean rotating/translating each vertex individually or (more likely) using OpenGL's built in transformation matrix (the "modelview matrix") to do it.
Could you show me to a good *.an8 library? I'm HORRIBLE at Google searches, for some reason.
Kenneth Gorking
04-20-2008, 06:23 AM
There is one on the front page ;)
Yeah, I spotted that after I made this thread.
mmakrzem
04-24-2008, 02:23 PM
Loading a mesh into memory can be complicated depending on what format your 3D model is saved in. You can find source code on the internet that shows you how to load common formats like 3ds, obj, mdl etc.
I've created some video tutorials showing how to load cob/scn files and display them in OpenGL.
Another option is to use autodesk's fbx sdk. They provide to you the code to load fbx files but you still need to know how to use the sdk to be able to render the data on the screen.
http://usa.autodesk.com/adsk/servlet/mform?siteID=123112&id=10775847
anubis
04-24-2008, 04:06 PM
I've created some video tutorials showing how to load cob/scn files and display them in OpenGL.
I am curious... Why video tutorials ?
mmakrzem
04-24-2008, 04:50 PM
I create video tutorials rather than written tutorials because I have found I learn better by watching someone, rather than reading text.
vBulletin, Copyright ©2000-2010, Jelsoft Enterprises Ltd.