Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


OpenGL filing cabinet, file drawers (draws) and reports

Posted on 2004-07-30
Medium Priority
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?


Question by:Mutley2003
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Expert Comment

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.
LVL 17

Expert Comment

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.)


Author Comment

ID: 11733322

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.
LVL 17

Accepted Solution

davebytes earned 2000 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'... ;)


Author Comment

ID: 11790532

A lucid explanation, again. Thank you.

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

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

636 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