generate 3dsMax object - opengl

Im coding Computer Graphich project which draws a glass in OpenGL, so I did make a glass model in 3dsMax but dont know how to generate it to file which contains co-ordinate of points of glass to use for OpenGL code. Anyone know?

You need to write 3ds max exporter plugin using 3ds max sdk and export the model. For a beginner this is going to be extremely difficult.
Alternatively, you could export from 3dsmax into some kind of format that is easy to parse and write importer for that format in your program.
Or you could try searching for the library that can parse one of the formats 3dsmax can export.

The following link is to a partially implemented .3ds loader written by: Matthew Fairfax
http://www.garagegames.com/community/resources/view/506
This was what I used while I was at university to read in objects. This loader only really includes the mesh data and possibly the material data. But if you look at the 3ds file format it should be fairly easy to get the rest of the parts reading in as well.
using google for about 20s I also found the following link which looks fairly detailed for the file format and has code at the bottom that should help you work out the loading.
http://www.martinreddy.net/gfx/3d/3DS.spec

Related

I want to use openStreetMap data to render roads in openGL, where should I start?

What I have in mind is that user will select the part of world he/she wants to generate roads and retrieve openStreetMap data and use it to render roads in openGL.
On searching the web and experimenting, I thought of this approach:
get xml file of selected map
parse the xml and generate roads by openGL.
But I think this is very naive approach.
Also to experiment a bit I used OSM2WorldViewer to convert the xml file to obj file and imported that as a model in openGL, but this method is cumbersome and takes time
and I am unfamiliar with OpenStreetMap api and how it can be used in such a project.
Any suggestions, or helpful links how to start this project ?
EDIT: How it ended: Link to the project wiki
Why do you think your approach is naive? Either you have the user to provide a self-downloaded XML file or you have to use an API to retrieve one yourself. The latter approach allows you to implement an automatic update mechanism whenever the user pans the map.
Instead of the main API you can use the Overpass API for downloading data. It's faster and more flexible to use, allowing to specify which element types to download (e.g. only roads and buildings) and much more.
You already mentioned OSM2World, take a look at its freely available code to see an example implementation of a 3D OpenGL renderer. Or take a look at one of the other 3D renderers for OSM.

Recommended file formats and graphics libraries for importing 3D model into OpenGL/C++ project?

If you wanted to:
model an object in a 3D editor, e.g. Blender, Maya, etc
export the model into a data/file format
import the model into an project using OpenGL and C/C++
Then:
What file format would you recommend exporting to, i.e. in terms of simplicity, portability, and compatibility (i.e. common/popular)?
What graphics libraries would you recommend using to import the model into your OpenGL C/C++ project (i.e. preferably open source)?
Additionally, are there data/file formats that also capture animation, i.e. an "animated model" format, such that the animation could be modeled in the 3D editor and somehow invoked inside the code (e.g. accessibility to frames in the animation sequence or some other paradigm for saving/loading details related to changes over time)?
Generally speaking, I'm seeking simplicity as the priority, i.e. help to get started with combining my backgrounds in both art and computer science. I am a computer science major at UMass while at the same time, sort of a "pseudo" double-major in art by taking electives in graphic design at my university as well as classes at the Art Institute of Boston during summer/winter sessions So, in other words, I am not a complete newbie, but at the same time I don't really want options that are so overloaded with crazy advanced configurations making it too difficult to get started with a basic demonstration project; i.e. as a first step to understanding how to bridge the gap between these two worlds, e.g. creating a program featuring a 3D character that the user can interact with.
COLLADA (I'm saying it with a "ah" at the end), and Assimp (ple as that).
And so, why COLLADA? Simple:
COLLADA is an open standard made by Khronos (Sony specifically). The beauty of an open standard format is that it's, well, a standard! You can be assured that any output of a standard-conformant product would also read correctly by another standard-conformant product. Sad to say though, some 3d modelling products aren't that particular in their measures for standards conformance for COLLADA. But still be rest assured: Blender, Maya, 3ds Max and all the other big names in 3d modelling has good support for the format.
COLLADA uses XML. This makes it much more simpler for you if your planning to create your own reader or writer.
ADDITIONAL: COLLADA is, I think, the only format that is not tied to a specific company. This is a very good thing for us, you know.
ADDITIONAL 2: It is known that COLLADA is slow to be parsed. That's true. But think of it: all other non-binary formats (like fbx) have also the same issues. For your needs, COLLADA should suffice.
ADDITIONAL 3: COLLADA supports animations!
For the importer library, I highly recommend Assimp. Why?
Assimp has support for any popular format you can imagine. It has a unified interface for all formats so that switching to another format is less of a pain.
Assimp is extensible. You can thus import your proprietary format and still not modify your code.
ADDITIONAL 4: Assimp is open source! Let's support open source software!
First , here you can read about suggested model loading lbs.Lib Assimp is really good and supports many formats.For the preferred formats.Collada-I wouldn't recommend because that is XML (text) based formats which is slow to parse. Obj format is also widespread but suffers from the same problems as Collada.It is still good if you want to write your own parser as its structure is very simple.But Instead I would suggest 3Ds which is binary.It doesn't support animations though.The most popular format today which supports both static mesh and animation is FBX.You can download for free FBX SDK from Autodesk and connect it to your engine.The reason I would choose FBX is because both SDK and the format are really robust.For example ,in FBX you can embed not just geometry and animation but also scene objects as lights ,cameras etc.Autodesk docs are very nice too.
Hope it helps.
I would reccomend using your own custom format that basically just a binary dump of the vertex buffer and index buffers used in your program. (Using d3d terms there, I know opengl has the same concepts but can't remember if they have different names).
I would then write a separate program using assimp that takes pretty much any format and writes out the file in your custom format. Then you can use collada or whatver to store your actual models in, but not have the complixity and slowness of loading that format at run time.

Is there a GDAL driver for the OpenSceneGraph osg \ ive format(s)?

I'm trying to write an application that can take DEM data and spit out a format recognizable by OSG (OpenSceneGraph) in C++. I have been unable to find a driver that supports osg/ive format for GDAL, and I wouldn't know where to begin writing my own. If there's another way to do what I'm asking, I'm open to it, but I've had success loading DEM's in GDAL so it seems the path of least resistance for now.
I don't know of one - OSG's native format isn't really a standard, it's just a dump of the tree structure (it's not even particularly optimal for OSG!).
I would probably pick a 'standard' DEM format that OSG can output and GDAL can read. There are a lot of examples of output plugins with OSG and it's trivial to write a 'writer' yourself.
This would also mean you can obtain standard models in this format to test with.

how to export and import from blender to c++(.caf, .xrf , .cmf/xmf ....)?

i like game so much
at this time i realy try to built simple game , i start wiht build the object and the character (with animation ). but i have big problem to complete this project because i do not know how ti export and imprt this object to c++ , could anyone help me PLEASE??
You say you have a animated character in Blender format and wish to import it into your application written in C++, right?
To export data from Blender and use it in your application, consider using Open Asset Import Library. It reads a huge bunch of file formats. It even supports the native Blender file format, but currently with no animations. Note - I am biased here, since I'm one of the project's founders.
Unless it's for learning purposes, I'd strongly discourage you to write your own importers. It's painful and most likely to distract you from your original aim (write a game).
Finding proper exporters for Blender can be tricky, but I'd try Collada, X, MD5, 3DS, Obj, DXF .. usually, one of these formats works (keep in mind, however, that some support animations and more sophisticated materials while others don't).
C++ doesn't support natively 3D graphic rendering nor importing 3D models. My advice would be to first learn how to use Glut or SDL and OpenGL and try to import static models saved in a obj file format, which will be way simpler to load and display.

glut visual editor

I wanted to know if their is any Glut (opengl) visual editor some thing like autocad.
In general, what you'll want to do is use a modeling tool such as Blender or Maya to generate your models/textures/materials, write out the data in some file format, then write code or use existing libraries to read in your data and then display your data using OpenGL. One example of this would be to use the Collada format for exporting/reading.
I've seen some examples in the past of converters that actually generate code from data rather than just exporting data in a format that can be read in, but its pretty limiting to do it that way, and in the long run you might be happier you have something that works generically for any model you export.
I don't know of any tool that meets your exact requirements. In fact. I doubt that such a tool exists, because you can easily achieve what you want using existing tools and techniques. Most graphics engines have their own scene editor. So you can either roll your own or reuse the o/p of an existing scene editor - just parse the o/p file and create the scene in glut. Do use some kind of scene graph!!
I hope this helps!