Jump to content


Stupid Question


12 replies to this topic

#1 Zuka

    Member

  • Members
  • PipPip
  • 47 posts

Posted 19 April 2008 - 07: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?

#2 Zuka

    Member

  • Members
  • PipPip
  • 47 posts

Posted 19 April 2008 - 07:36 PM

I guess I shouldn't say 'use', but more like display. Also, how do I navigate the 'workspace' with my 'camera'?

#3 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 19 April 2008 - 08: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.
reedbeta.com - developer blog, OpenGL demos, and other projects

#4 z80

    Valued Member

  • Members
  • PipPipPip
  • 104 posts

Posted 19 April 2008 - 09:08 PM

First step is to stop being lazy ;)

#5 Zuka

    Member

  • Members
  • PipPip
  • 47 posts

Posted 19 April 2008 - 10:40 PM

Thank you SO much, Reedbeta. You're ALWAYS helpful.

#6 Zuka

    Member

  • Members
  • PipPip
  • 47 posts

Posted 19 April 2008 - 10:41 PM

How do I access the vertices, though? And how do I position the mesh in my 'world'?

#7 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 20 April 2008 - 01:59 AM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

#8 Zuka

    Member

  • Members
  • PipPip
  • 47 posts

Posted 20 April 2008 - 03:09 AM

Could you show me to a good *.an8 library? I'm HORRIBLE at Google searches, for some reason.

#9 Kenneth Gorking

    Senior Member

  • Members
  • PipPipPipPip
  • 911 posts

Posted 20 April 2008 - 01:23 PM

There is one on the front page ;)
"Stupid bug! You go squish now!!" - Homer Simpson

#10 Zuka

    Member

  • Members
  • PipPip
  • 47 posts

Posted 20 April 2008 - 07:50 PM

Yeah, I spotted that after I made this thread.

#11 marek-knows.com

    Valued Member

  • Members
  • PipPipPip
  • 189 posts
  • LocationOntario, Canada

Posted 24 April 2008 - 09: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....112&id=10775847
3D OpenGL, C++ Game Development Video Tutorials @
www.marek-knows.com

#12 anubis

    Senior Member

  • Members
  • PipPipPipPip
  • 2225 posts

Posted 24 April 2008 - 11:06 PM

Quote

I've created some video tutorials showing how to load cob/scn files and display them in OpenGL.

I am curious... Why video tutorials ?
If Prolog is the answer, what is the question ?

#13 marek-knows.com

    Valued Member

  • Members
  • PipPipPip
  • 189 posts
  • LocationOntario, Canada

Posted 24 April 2008 - 11:50 PM

I create video tutorials rather than written tutorials because I have found I learn better by watching someone, rather than reading text.
3D OpenGL, C++ Game Development Video Tutorials @
www.marek-knows.com





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users