Results 1 to 5 of 5

Thread: m15 question

  1. #1
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    68
    Posts
    3,865
    Rep Power
    405

    m15 question

    Mike, I hope you can answer this as Petr is away this week as you know. I was wondering, if I tried to write a m15 importer, how would I use the vertex data to make it into a model? Do you know which type of equate Petr uses to build the polygons with tbgl_BeginPoly?
    Which should I use? :
    %GL_TRIANGLES
    %GL_TRIANGLE_STRIP
    %GL_QUADS
    %GL_QUAD_STRIP
    %GL_POLYGON

    My Guess is polygon, but just wanted to make sure. I would be importing the model in opengl using either Delphi or c++, if that helps. THanks.
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  2. #2
    thinBasic MVPs Michael Hartlef's Avatar
    Join Date
    Sep 2006
    Location
    Germany
    Age
    58
    Posts
    3,299
    Rep Power
    348

    Re: m15 question

    The question between triangle/quad/polygon is ruled by the polygon stop flag in the M15 file format. Of course, you could dived it into triangles all the time, if you know the right algo.
    In which format are you storing the datas for a model inside your delphi app? That should give you the answer anyway. If you plan on importing over file formats, then you might need several ways to store them or generally store them as triangles.
    The strip versions are mostly used for speed reasons. But I don't have enough knowledge about this to tell you when to use strips and when not.
    If you use polygons, then you are save, as they can easily have 3, 4, 5 sides.
    My guess for TBGL is that Petr uses Polygons as a M15 model can have triangles and quads.

  3. #3
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    68
    Posts
    3,865
    Rep Power
    405

    Re: m15 question

    THanks Mike, just trying to understand these file formats better and thought if I could write an import of m15, it might be the easiest way to start to learn.
    Thanks for the information!
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  4. #4
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736

    Re: m15 question

    Hi kryton,

    till version 0.2.0 of TBGL, all models were interpeted using %GL_POLYGON. This is general, but not very optimized way.
    So ... TBGL now optimizes on run much better and chooses best %GL_* mode to render. I recommend to keep with 3 and 4 vertex polys, but you can still use polygons with no limit for vertices. But then we will fall in slower %GL_POLYGON.

    Why is %GL_POLYGON slower ? Because TBGL has to close each poly in glBegin / glEnd pair, while %GL_QUADS and %GL_TRIANGLES can go as mini series inside one big glBegin / glEnd as long as they use same texture.

    STRIP versions are really nice, but they are not usable in all cases ( mostly in very rare and specific cases ), so I don't use them ( except for TBGL primitives ) now.

    Hope this answers your question ,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  5. #5
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    68
    Posts
    3,865
    Rep Power
    405

    Re: m15 question

    Thanks Petr, yes that explains it really well.

    As I try to make the importer I am sure I will ask more questions.

    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

Similar Threads

  1. C to TB question
    By Michael Clease in forum Other languages
    Replies: 2
    Last Post: 03-06-2010, 12:11
  2. gdi question
    By Lionheart008 in forum UI (User Interface)
    Replies: 6
    Last Post: 07-12-2009, 19:31

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •