PDA

View Full Version : 3D tutorial or sample



jdarling
11-06-2007, 04:06 PM
Ok, I've searched around the web a bit, and didn't find what I was looking for. I'd like to find a simple sample application that uses Jedi-SDL to load a given model format (I'm not picky) and displays it to the screen. It would be nice if it used the models animation stuff (bones, keyframes, whatever).

Finally it would be awesome if it had random land height generation incorporated into it.

Well documented or with tutorial is a must.

Anyone know of such an animal?

Sorry if I used wrong terminology, but I'm not a 3D guy at all :)

WILL
11-06-2007, 04:32 PM
Well from what I've been told and to my understanding, you'd have to use the OpenGL libraries bundled with SDL to do this. And OpenGL does not have any loaders or formats that it specifically uses. (Unlike Direct3D and it's X format.)

You'd have to write the loader yourself using whatever format you feel most comfortable with or find convenient. There are many around though, I'm sure that you'll find on of good use.

savage
11-06-2007, 05:29 PM
JEDI-SDL has a MD2 Model viewer , and also Cal3D ( not 100% working ) which uses skeletal animation. Both use OpenGL for rendering. Also there is a random land height generation demo as part of the 3D demos, IIRC. Grab the latest release from http://jedi-sdl.pascalgamedevelopment.com and look through the demos and Cal3D directories.

WILL
11-06-2007, 05:48 PM
Ok... what Dom said. ;)

jdarling
11-06-2007, 09:18 PM
Would that be the latest nightly build link at: http://www.pascalgamedevelopment.com/jedi-sdl/files/JEDI-SDLv1.0.zip

If so, can you please point out the MD2 loader example? I can't seem to find it at all. I found the NEHE folders, would it be in one of those?

technomage
11-06-2007, 09:37 PM
Well from what I've been told and to my understanding, you'd have to use the OpenGL libraries bundled with SDL to do this.

A slight side topic,believe it or not you can use DirectX 9 with SDL,My InfinitEngine does this. I use SDL to create the window and handle input and then I use DirectX 9 against that :)

I can't remember where I saw how to do this, but it is possible.:D

jdarling
11-06-2007, 09:41 PM
Actually, JumpStart can run in either OpenGL or DirectX modes using SDL. Optimizations are in place for both, but you still get better speed results with OpenGl for some reason.

jdarling
12-06-2007, 03:53 PM
Ok, after quite a bit of Google and Code Search I managed to find an old version of JEDISDL_MDLViewer. Some tweaks of the source and pointing it to the latest version of jedi-sdl (at least the latest according to the site, I think) and it compiles and runs. Problem is, the screen is blank. Nothing, nadda, zilch, zip...

Any ideas whats wrong, or where the current version of the demos are? I can't seem to get to the SVN and the download I talked about earlier doesn't have anything but NeHe and Cal3D stuff in it.

Download: http://www.eonclash.com/PGD/ModelViewer.zip

savage
12-06-2007, 05:45 PM
My mistake, appologies for wasting your time. I thought I had included the ModelViewer and the BSP Renderer in this release, but I remember now that I have not had the time to clean up the code for this release. Can you please download this version - http://jedi-sdl.pascalgamedevelopment.com/files/ModelViewer.zip
this includes an Win32 exe which, if you don't pass anything via the command line, should default by loading and playing the Blade animation. Please confirm that this works for you. Be aware that the code is still unclensed :), but hopefully it will get you started.

I did start writing a class wrapper a few years ago that would load a variety of 3D models using OpenGL, but again got distracted and never finished it. There is also an MD5 example that I can dig out if you want to see that one.


Problem is, the screen is blank. Nothing, nadda, zilch, zip...

Any ideas whats wrong, or where the current version of the demos are?

I have not looked at your code, but my guess is that you have not passed the correct path to the Model directory you want to load via the command line.

jdarling
12-06-2007, 06:36 PM
Good to know I'm not crazy :).

Yeah, that version worked just fine. Some more google code searches turned up an interesting result for an MD2 loader though that has animation interpopulation and proper cleanup built in.

In case anyone wants a sample, I've updated the MD2 loader to work with Jedi-SDL and updated the application to work with the new unit/class.

Download (same as before) at: http://www.eonclash.com/PGD/ModelLoader.zip

Hey Dom, it might be worth getting a hold of the deltasoft guys and seeing if you can incorporate some of their stuff directly into Jedi-SDL. As a lot of things they have could be useful and are already public domain.

pstudio
12-06-2007, 07:03 PM
I know what interpolation is, but what is interpopulation? :)

savage
12-06-2007, 09:03 PM
Jeremy, that link does not work for me. It just takes me to your site.

And can you provide a link to the Delta people. As I can't seem to find them on Google.

jdarling
13-06-2007, 01:45 PM
Hey Dom,
The site is: http://www.deltasoftgames.ch/

Sorry, I must have had the download link jacked up. The proper one is: http://www.eonclash.com/PGD/ModelViewer.zip.

I've cleaned up their version quite a bit. Removed all of the file stuff and replaced with TFileStreams. Modified the code to allow for any MD2 file to be loaded (they had old limits hard coded, now there are no limits). Changed out the image loading routines to use my own custom TGameImage that uses SDL to load the images from disk. Then checks the size and generates a valid power of 2 image for OpenGL. Finally it populates the image up into OpenGL so you can use it :).

Fixed the rendering code, a few things were missing that were causing problems when you were rendering interpolated frames.

You may have to re-set the compiler options for the project, as I copied the library files to the local project lib folder instead of my global lib folder.

All in all, I think this should be useable. Of course, about the only thing I kept was the structures they put together (and I even renamed those to standard naming conventions instead of their C/C++ names).

BTW: If you want PM your MSN IM and we can talk about XBox, this and other things. Sorry, can't discuss some things on a public forum :)

jdarling
13-06-2007, 01:46 PM
I know what interpolation is, but what is interpopulation? :)

Its me typing and not using spell check :)