Solved

OpenGL filing cabinet, file drawers (draws) and reports

Posted on 2004-07-30
5
872 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Davebytes

A lucid explanation, again. Thank you.

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now