Author Topic: MD2 library for OpenGL applications  (Read 13868 times)

0 Members and 1 Guest are viewing this topic.

Offline Petr Schreiber

  • Full Member
  • ***
  • Posts: 183
  • User-Rate: +14/-4
MD2 library for OpenGL applications
« on: January 01, 2009, 09:16:46 AM »
Hi,

I had some free time during Xmas, so I decided to create library which could be of some use for other programmers too.

As José does incredible job on translating headers, I decided to base the solution on them, as little refund for all his work he invests in his job here.

So what that mysterious tool is? Simple library to load and animate 3D models in Id Software MD2 file format.

I attach for you documentation, DLL+samples and also the source code, written in PBWIN9. I hope you will find it useful, or that it will at least entertain you for a while.


Petr

Updated the download with fixed typo in documentation
« Last Edit: January 10, 2013, 08:30:07 AM by Petr Schreiber »
AMD Sempron 3400+ | 1GB RAM @ 533MHz | GeForce 6200 / GeForce 9500GT | 32bit Windows XP SP3

psch.thinbasic.com

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2483
  • User-Rate: +204/-0
Re: MD2 library for OpenGL applications
« Reply #1 on: January 01, 2009, 10:42:31 AM »
 
Many thanks for your wonderful Christmas gift!

Offline Patrice Terrier

  • ROMs
  • Hero Member
  • *****
  • Posts: 936
  • User-Rate: +62/-1
    • www.zapsolution.com
Re: MD2 library for OpenGL applications
« Reply #2 on: January 01, 2009, 01:22:14 PM »
Petr,

I also would like to say thank you for this new contribution that helps to make this forum one of the finest and most valuable place to learn about low level OpenGL SDK programming for PB.

...

« Last Edit: January 01, 2009, 05:26:36 PM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Patrice Terrier

  • ROMs
  • Hero Member
  • *****
  • Posts: 936
  • User-Rate: +62/-1
    • www.zapsolution.com
Re: MD2 library for OpenGL applications
« Reply #3 on: January 01, 2009, 05:49:50 PM »
Petr,

Currently the demo(s) are very CPU intensive and not cooperative with other applications because of the way the animation is being processed in the main loop.

Changing from GLFW to the BassBox OpenGL model would drecrease the CPU usage drasticaly and produce an application that is more responsive to other Windows message (for example the animation will still run while moving the window to another location) and the programmer could have full control on what is going on, inside of the message cracker.

The benefit would be also to use md2 into BassBox OpenGL plugins ;)
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Patrice Terrier

  • ROMs
  • Hero Member
  • *****
  • Posts: 936
  • User-Rate: +62/-1
    • www.zapsolution.com
Re: MD2 library for OpenGL applications
« Reply #4 on: January 01, 2009, 06:47:43 PM »
Petr,

The provided PDF documentation improperly refers to TBGL_ instead of MD2_  ;)
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Petr Schreiber

  • Full Member
  • ***
  • Posts: 183
  • User-Rate: +14/-4
Re: MD2 library for OpenGL applications
« Reply #5 on: January 01, 2009, 08:05:23 PM »
Hi José, Patrice,

thanks :)

I am sorry about those typos, I just uploaded version which should be correct.

Regarding CPU usage of the demos - sure :) Running in tight loop invlolves such a problems, but I decided for GLFW because the code of examples gets very very short, so people can focus more on the principle.

BassBoxing the code is good idea, I also wanted to use GDIPlus to upload textures, but there was problem (my GDI+ ignorance) with not square dimensioned ones.
I will have a look into BassBox code again, I think the key feature to keep CPU usage low is using timers?
AMD Sempron 3400+ | 1GB RAM @ 533MHz | GeForce 6200 / GeForce 9500GT | 32bit Windows XP SP3

psch.thinbasic.com

Offline Patrice Terrier

  • ROMs
  • Hero Member
  • *****
  • Posts: 936
  • User-Rate: +62/-1
    • www.zapsolution.com
Re: MD2 library for OpenGL applications
« Reply #6 on: January 01, 2009, 08:38:07 PM »
Quote
BassBoxing the code is good idea, I also wanted to use GDIPlus to upload textures, but there was problem (my GDI+ ignorance) with not square dimensioned ones.
I will have a look into BassBox code again, I think the key feature to keep CPU usage low is using timers?

Petr,

Everything is in BassBox.bas and BBplugin.inc (including the code to create the textures).
And yes, using the TIMER will reduce the CPU footprint and also will keep the animation running while moving the window container arround.

Then we could make Sydney BassBoxing on audio ...  ;)
(see the attached Sydney in red suit)
« Last Edit: January 01, 2009, 08:43:06 PM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Petr Schreiber

  • Full Member
  • ***
  • Posts: 183
  • User-Rate: +14/-4
Re: MD2 library for OpenGL applications
« Reply #7 on: January 02, 2009, 10:23:06 AM »
;D

that would be interesting, speed of animation could be varied according to music :)

Do you know Black & White plugin for WinAMP?
The bear has multiple animations and switches between them according to type of music + adjusts speed.

Not so easy to do, but result could be great.
AMD Sempron 3400+ | 1GB RAM @ 533MHz | GeForce 6200 / GeForce 9500GT | 32bit Windows XP SP3

psch.thinbasic.com

Offline Patrice Terrier

  • ROMs
  • Hero Member
  • *****
  • Posts: 936
  • User-Rate: +62/-1
    • www.zapsolution.com
Re: MD2 library for OpenGL applications
« Reply #8 on: January 02, 2009, 02:28:40 PM »
Here is already a picture we could use for background ...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline David Boytor

  • Newbie
  • *
  • Posts: 12
  • User-Rate: +0/-0
Re: MD2 library for OpenGL applications
« Reply #9 on: January 10, 2013, 04:48:05 AM »
the zip file is corrupted

winzip and explorer shows an error

Offline Petr Schreiber

  • Full Member
  • ***
  • Posts: 183
  • User-Rate: +14/-4
Re: MD2 library for OpenGL applications
« Reply #10 on: January 10, 2013, 08:31:14 AM »
Hi David,

you are right, not sure how this happened.
I re-uploaded the file again to the first post, could you try again?


Petr
AMD Sempron 3400+ | 1GB RAM @ 533MHz | GeForce 6200 / GeForce 9500GT | 32bit Windows XP SP3

psch.thinbasic.com

Christopher Boss

  • Guest
Re: MD2 library for OpenGL applications
« Reply #11 on: January 10, 2013, 03:49:01 PM »
Nice library !

It works great even with EZGUI 5.0. I created a custom object in my 3D engine just so it could use a library like this.


Offline David Boytor

  • Newbie
  • *
  • Posts: 12
  • User-Rate: +0/-0
Re: MD2 library for OpenGL applications
« Reply #12 on: January 10, 2013, 10:49:51 PM »
File download works great, not corrupted any more, thanks for your help!!!

Cheers!!!