Solved

OpenGL filing cabinet, file drawers (draws) and reports

Posted on 2004-07-30
5
877 Views
Last Modified: 2013-12-06
I am still grappling with some basic OpenGL concepts and building in interactivity.

Suppose I want a filing cabinet with 4 drawers. Clicking on a draw opens it and displays say 6 suspension files with labels (tabs). Clicking on a tab extracts a report..maybe open in another window.

Can someone give me an overview of the key tasks involved and how they might be implemented in OpenGL?

In particular, should I use a modelling program like Blender3D to build the filing cabinet? If so, what do I get out of that (?some polygons) and how do I incorporate that object into my openGL app.

Secondly, how do I simulate a drawer opening? And report extraction? These seem to me like animations of some sort .. where do I look for an approach to doing these?


Thanks


0
Comment
Question by:Mutley2003
  • 2
  • 2
5 Comments
 
LVL 2

Expert Comment

by:shirsoft
ID: 11683626
here's the way to go
1.  Build the 3d models in a 3d modeller like blender , anim8or. Save them in common format like 3ds, obj. For importing 3ds data into ur opengl  app u can use l3ds lib . obj is a very simple human readable format and an importer can be manually written.
Another option would be to go for milkshape3d(shareware). Its cpp exporters are readily available, moreover  they support export of animation, which *very few* cpp exporters support.

2. There is no way out for the animation stuff. u need to be creative for that ;)

3. For the interaction part there is something called the selection matrix in opengl.
a. Basically u first associate a id(generated by ogl) with a 'drawer' (or any set of polys).
b. Then render all the selectable items to the selection buffer.(same as render to modelview with a simple change of glMatrixMode(GL_SELECT) ).
c. Finally u read every frame what objects were selected and do the processing.
0
 
LVL 17

Expert Comment

by:davebytes
ID: 11726657
I can't tell if this is one example, or something bigger.  For just the example:

Build the model as a hierarchy of objects, connected together.  Each object should follow a naming convention, so that you can 'look them up' by name out of the hierarchy.  Blender or any other app will do fine -- you'll want something to do both modeling and animation.

Using a hierarchy means that pulling out the drawer automatically pulls out the folders ('children' of the drawer object).

Build up a set of well-named animations for each action, sub-action, manipulating the cabinet, and a table-based lookup of some sort for accessing which animation to play when.  It'll be state-based, as you'll manage where you are in interaction with the object.  Closed, drawer 1 open, drawer 2 open, drawer 3 open, drawer 4 open, 6 files open per drawer open state... etc.  Based on the state and the action, you know whether you play an opening animation or a closing animation based on the given subobject.  I would say if one drawer is open, and you click another drawer, play 'close' old drawer, then 'open' new drawer.

If you are having problems with basic openGL concepts, make sure you are grounded before you start working with 3rd-party modeling and animation formats!  nehe.gamedev.net is one of the better sets of tutorials out there, make sure you work through a chunk of them and get to a point where you feel comfortable.  There's specifically one dealing with 'Picking', clicking on objects in 3D and getting a result back (I think it's #32) -- the GLUT library has a set of functions specifically dealing with picking of objects/polygons.

Since the above system is state-based, you know at any given point in time what object you were opening.  When you get to opening a file, you could certainly launch anything you want using OS calls (word doc, web page, etc.)

-d
0
 

Author Comment

by:Mutley2003
ID: 11733322
davebytes

thanks for the feedback .. I follow most of what you are saying, however when you say

"Build the model as a hierarchy of objects, connected together"

I am a little confused. Is "a hierarchy of objects" an inbuilt OpenGL concept ? Just thinking about OpenGL calls, I don't seem to have come across a way in which "objects" are built, let alone connected. Just zillions of GlVertex calls "grouped" (I suppose you could say) by GlBegin and GlEnd.

So, suppose I have something like a simple hinge .. 2 rods joined together at a single point. (2D will do). How do I say - in OpenGL - that these two are "connected" (rather than just happening to occupy a certain overlapping area).

And I still don't "get" why I need modelling software at all .. as far as I can see, all I get out of this is the ability to move zillions of polygons around and do some more or less freehand drawing (at which I am no good).

Well, thanks for your patience.
0
 
LVL 17

Accepted Solution

by:
davebytes earned 500 total points
ID: 11744958
No.  OpenGL (and D3D) at their core are simply manipulating vertices and polygons/triangles.  You create software constructs that represent meshes -- collections of polygons that form a single object.

Go through tutorials at nehe.gamedev.net if you want a good walkthrough of different, progressive stages of extending from basic OpenGL into more complex work, including working with outside models.

Hierarchies and 'connected' are again concepts in YOUR software.  You need to manage the connections, traverse the hierarchies, and update positions/matrices.  (Well, in really advanced GL/D3D, on advanced boards, you can let hardware do some of that manipulation -- but you are still managing the hierarchy, the objects, the offsets between the objects, etc.).

You don't >need< modeling software, if you want to hand-create coordinates of vertices and triangles and meshes, you are more than welcome to -- and the majority of samples from gamedev.net certainly introduce concepts that way.  But at the end of the day, as you progress in 3D, unless you are working from procedural data sets of some sort, it is likely you will find yourself dealing with data from modeling software.  Maybe you have to write an importer, or you have to deal with a model format from someone else's importer.   The Granny SDK is a good example of a third party commercial system that deals with both exporting/formatting of data AND hierarchical modeling AND texturing AND most importantly the application of different animation sets on a given model.

Sorry if I've overwhelmed you with this, just trying to paint you a better picture of 'the big picture'... ;)

-d
0
 

Author Comment

by:Mutley2003
ID: 11790532
Davebytes

A lucid explanation, again. Thank you.

btw, the Granny SDK is about $10,000 ..
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question