Thread: Deep Exploration, OpenGL, and 3d models

  1. #1
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,743

    Question Deep Exploration, OpenGL, and 3d models

    well I have just aquired an application that was suggested to me by a friend who is in the computer gaming industry called Deep Exploration.

    This application converts a 3d model of various formats to any one of other various formats.

    I have been wondering about the usage of 3d models in OpenGL code lately, and so I aquired this program in order to help convert files to a proper format so that I might be able to use them.

    All of my 3d models were originally in .3ds format (3DS Max mesh), but I did not know how to use a 3ds mesh in OpenGL, so I decided to convert it to OpenGL code using Deep Exploration.

    Take into account the model I am converting contains about 9500 vertices and 18000 triangles.

    The resultant cpp file was 15000 lines of code in length, made up of almost purely data for those vertices and faces.

    (Obviously it put them in display lists).

    What do you think of this method? Do you think it would be more efficient to just find out a method of loading the .3ds mesh into my program instead of converting it into a OpenGL cpp code file?

    Or do you think it would take the same amount of data and processing power either way I go?

    I'm not sure whether I really want to try implementing this model as a cpp file when the file is over 15000 lines long of data....but then again....if I learned the .3ds format and created my own loading procedures to lead the .3ds mesh, wouldnt it take just the same amount of data, or what?

    How much do you think it would affect my fps rate? (my current rate is about 60 fps with my 3d terrain generator I have created so far).
    My Website

    "Circular logic is good because it is."

  2. #2
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    I am not even really sure what in the hell you are talking about. It sounds like you are just writing a program that makes it so you can hard code the vertices into a source file. If that's what you are doing, that is, imho, dumb. I dont' know what it would do speed wise, seeing as how you are doing the project, why don't you use the timeGetTime or GetTickCount functions to determine which is faster...instead of leaving us who haven't done it to speculate. That would never be used in a 'real' game considering the modding community.

    EDIT: now that I think of it I cannot think of a single good thing to come out of your little project thingamabob. Speed isn't really an issue once the model itself is in memory (assuming a reasonable amount of vertices being rendering). I mean, you either store the model in the binary which has to ultimately be loaded into memory, or you have to store the model in a .3ds file which also has to ultimately be loaded in the memory. And as I said before, the actual drawing process shouldn't be changed too much, things should be fast enough loading from a file.
    Last edited by Silvercord; 04-01-2003 at 07:42 PM.

  3. #3
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    the main difference here is that you are hard coding the model into the program (big ass .exe) rather than reading it from a file. (big ass .3ds), i dont see any obvious advantages here.

  4. #4
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    >
    What do you think of this method? Do you think it would be more efficient to just find out a method of loading the .3ds mesh into my program instead of converting it into a OpenGL cpp code file?
    Or do you think it would take the same amount of data and processing power either way I go?
    <

    It will peobably be the same, only speed change might come about from exe size bloating? How many display-lists does it use for the model? And how does it store the data?

    A downside is the loss of being able to modify the model without a recompile.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  5. #5
    'AlHamdulillah
    Join Date
    Feb 2003
    Posts
    790
    A downside is the loss of being able to modify the model without a recompile.
    I would say that is a pretty big loss,I mean, can you imagine having to reinput the entire code each time you make a change to your model?

  6. #6
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    can you imagine having to compile 20,000 lines of code (assuming 5,000+ for the code) if you want to change one vertex? Even if you lack the time/patience/motivation/knowledge/skill to program a 3DS loader yourself, there are a ton of them out there that will load your model into the OpenGL stucts for you. You won't learn jack doing it like that, but it's still better than hard coding the model.
    Away.

  7. #7
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    If you place that data directly in the program, won't it be placed on the stack rather than the heap. I'm no expert on this, but isn't the stack more limited than the heap?
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  8. #8
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Originally posted by Magos
    If you place that data directly in the program, won't it be placed on the stack rather than the heap. I'm no expert on this, but isn't the stack more limited than the heap?
    the stack certainly is different from the heap, but not neccesarily more limited
    in general , the stack starts at one end of memory, and the heap at the other, they grow 'towards' each other and thus have the same amount of available space. here is a simple way of looking at memory..

    Code:
    ----------------------------------
              Kernel space
    
    ----------------------------------
        stack starts here  
        and grows down  
    
    
    
    
    
    
    
    heap starts here and  
    grows up                     
    ----------------------------------

  9. #9
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,743
    Even if you lack the time/patience/motivation/knowledge/skill to program a 3DS loader yourself, there are a ton of them out there that will load your model into the OpenGL stucts for you
    heh heh...thats what you think....

    now that you have said that, go out and find one. trust me it isnt easy. and its even harder to find a tutorial on how to use one that you may happen to find, or how to make one yourself, etc.

    I have found a total of two things:

    Nehe's Model Loading tutorial - however this loads Milkshape 3d models...I dont have Milkshape 3d and none of my models are in that format. They are all in .3ds format. And Deep Exploration does not have the capability to convert from .3ds to any Milkshape 3d format.

    lib3ds - this is a 3ds model loader....supposedly one of the only ones out there...and definitely the only one I have found. However it is incredibly poorly documented, so I am prowling around in the dark hoping that I might be able to get it to work with my program.

    You know of any others? You know of any ones that are documented well? You know of any tutorials that are good? Please...do tell....
    My Website

    "Circular logic is good because it is."

  10. #10
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916

    STFW

    Scroll down a bit on this one, it's there
    http://www.home.no/apron/english/apron.htm?tut_gl

    There is one here as well
    http://ironduke.cs.gsu.edu/gso_class..._resources.htm

    Yup, it's near the bottom
    http://webster.fhs-hagenberg.ac.at/s...asp5_20012002/

    Not sure if this one is OpenGL, but I believe it is
    http://www.flipcode.com/cotd/COTD-3DSLoad.shtml

    Scroll down a bit
    http://www.gametutorials.com/Tutoria...OpenGL_Pg4.htm

    At the bottom
    http://www.sulaco.co.za/nitrogen/projects.htm

    Loading 3DS in general, really simple
    http://www.levp.de/3d/index.html

    I think that's enough, something there should be useful...my source...Google and about 5 minutes total.
    Away.

  11. #11
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Originally posted by Perspective
    the stack certainly is different from the heap, but not neccesarily more limited
    in general , the stack starts at one end of memory, and the heap at the other, they grow 'towards' each other and thus have the same amount of available space. here is a simple way of looking at memory..
    So every program have their own stack and heap? I thought that the heap had access to all available RAM, not just a limited space in your program. Or is the heap simply a list of adresses to some other location in memory?
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  12. #12
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    I believe that it works as thus, but I am not positive...

    Every program has access to the stack.

    Every program is allocated a chunk of the heap...I think it might be allocated in chunks of 1 mb or something like that, so you probably end up with some extra unless your program is exactly on the barrier. Anyway, if you make a fat, bloated program that contains all of its data in the .exe, then you'll be given a huge chunk in the heap, instead of a small one...so, if the heap as a whole takes up more room, I guess there would be less room for the stack. That's my understanding, at least.
    Away.

  13. #13
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Originally posted by Magos
    So every program have their own stack and heap? I thought that the heap had access to all available RAM, not just a limited space in your program. Or is the heap simply a list of adresses to some other location in memory?
    each program will have a certain amount of the heap allocated for its use, not all of it. when your programs heap gets full, it can request more heap space from the OS. it depends on the memory manager.

    much of the RAM is off limits for apps, particularly kernel space and registers stored in memory (yes, some registers are stored in memory instead of actual registers). this does not necessarily mean your app cannot access these places, but overwriting system memory to store your own data is usually a bad idea

  14. #14
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    I thought the heap was just all extra RAM that isn't being used by anything, its just leftover fat. Once a variable has had space allocated for it, it technically isn't on the heap because it is now on the stack. I also thought that when the stack grows, the heap shrinks, and vice versa. I can't double check my books cuz im not at home, but im pretty sure that's what they said. Perspective your diagram doesn't make sense, because it seems there would be 'holes' in the memory layout between the stack and heap space.

  15. #15
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,743
    I thought the heap was just all extra RAM that isn't being used by anything, its just leftover fat.
    that is also what I recall being taught by my Comp Sci teachers.

    What I have been taught is that the stack is a set amount of memory allocated to each program....a relatively small portion of the memory at that...I have also been taught that if you want to exceed the memory given to you in the stack, you allocate memory in the heap using pointers, and that the heap is memory not being used by any program at the current time. Thats what they teach you in AP Comp Sci....correct me if I am wrong....
    My Website

    "Circular logic is good because it is."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL - 2d text in 3d game
    By mikeb1986 in forum C++ Programming
    Replies: 1
    Last Post: 03-22-2006, 01:24 PM
  2. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  3. importing 3D models into openGL
    By juniorCoder in forum Game Programming
    Replies: 1
    Last Post: 05-10-2004, 09:14 AM
  4. 2-D background bitmap behind a 3D wold using OpenGL
    By Laeeqhamid in forum Game Programming
    Replies: 6
    Last Post: 12-28-2002, 04:42 AM
  5. 3D Objects In OpenGL
    By kas2002 in forum Game Programming
    Replies: 5
    Last Post: 08-06-2002, 12:15 PM