home · software · code · tutorials · site map

3667
Congressman warns of current GA- Russia conflict in 2002!!!
Ron Paul in an interview with Jim Lehrer says in 2002 interview that by the US adopting a preemptive first Strike Doctrine would eventually lead to Russia invading GA
3543
Girls Get the Anime Look with Extra-Wide Contact Lenses
Girls in Japanese comics, cartoon videos or anime share a common look - big eyes that, by making the rest of the face look small, add the cuteness and sex appeal prized by many Japanese men. Since no amount of cosmetic surgery will make actual human eyes larger, some girls are trying another way to up their cute quotient: extra-wide contact lenses!
1263
'Everyone Will Remember Me as Some Sort of Monster'
A troubled teenager. An assault rifle. Eight slain in a mall. It was national news for a few days. Then it was forgotten.
822
Repurpose Your Nintendo as a Lunchbox (PICS)
I had a broken NES, a rotary tool, two small hinges, some glue and Alpha Flight's Sasquatch. What I ended up with was a lunchbox that gets all kinds of funny looks.
3105
Once You Look, You Can't Look Away (Pic)



Feb
2

GM6 D3D from the Ground Up - Chapter 8

2007 @ 06:49 PM

Chapter 8 - Models

Unfortunately, when you start drawing a lot of things in D3D every frame, things can slow down quite a bit. That's where Game Maker comes in with a bandwith saving feature - models.

How To Create a Model

A model is basically a precompiled list of primitives to draw. Rather than executing every drawing command every step, it draws this saved information. Not only that, but you can save the model to a file and load it for future use!
To create a new model, call d3d_model_create(). This function will create a new model resource and return a unique identifying ID. You should use this in conjunction with an assignment expression: gun = d3d_model_create(); for example. When you are done with your model(at the end of the game or any other time), you should free the memory it used by calling d3d_model_destroy(gun);
You can also save and load your model resource. Use d3d_model_load(ID,filename) to load a model. The filename can be anything. It doesn't matter what extension the file uses. As long as it is a saved Game Maker model, it will work. The same applies for the d3d_model_save(ID,filename) function, which saves the model to the specified file.

Composing and Drawing a Model

Every single drawing function we've used up until now also has a version that is made for models. The new function names always follow this naming convention: d3d_model_... where ... is the rest of the function name. All of the vertex and built-in shapes follow this convention and can be used to construct models. They all have one extra argument, too. The first argument is now the index of the model. All of the old arguments follow this one as normal.
To draw the model, call d3d_model_draw(ID,x,y,z,texid). This will draw the model relative to (x,y,z). If you do not want to use a texture, pass -1 as the argument for texid. All transformations discussed earlier will affect the whole model as normal.

<< Previous Chapter      Next Chapter >>


 Del.icio.us  Digg  Furl  Google  Reddit  Slashdot


This article hasn't been commented yet.

CommentsWrite a comment

:

:

:

Blogtastic RSS FEED

Linktastic


TysonC's Profile Page