PDA

View Full Version : Stupid Question


Zuka
04-19-2008, 12:34 PM
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?

Zuka
04-19-2008, 12:36 PM
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.

z80
04-19-2008, 02:08 PM
First step is to stop being lazy ;)

Zuka
04-19-2008, 03:40 PM
Thank you SO much, Reedbeta. You're ALWAYS helpful.

Zuka
04-19-2008, 03:41 PM
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.

Zuka
04-19-2008, 08:09 PM
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 ;)

Zuka
04-20-2008, 12:50 PM
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.