Mail Archives: djgpp/2000/03/03/12:43:17
Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> kirjoitti
viestissä:38BF7F73 DOT CAEBED9A AT is DOT elta DOT co DOT il...
> Toni Riikonen wrote:
> >
> > BUT, when i'm trying to, for example, print something out of these
> > structures, my computer crashes, or boots up!
> >
> > This is what i'm trying to do..
> >
> > ----------------------------------------------
> > int main()
> > {
> > int a;
> > object_type object;
> > InitObject(&object, 50);
> > for(a = 0;a < object.faces; a++) {
> > gotoxy(1,1+a);
> > printf("%1.1f\n",object.face[a].vertex[0].rx);
> > }
> > free(object.face);
> > return 0;
> > }
> > --------------------------------------------------
>
> There's no declaration or initialization of the vertex[] array in the
above
> code. Is this the real program you compiled and tried to run?
Yeah, but face-structure has vertex_types in it.., so...
And Yes, this is the program that i compiled and run, but of course i have
the typedef-things in the start (new_def.h), and the init-code:
void InitObject(object_type *obj, int faces)
{
obj->face = (face_type *)malloc( sizeof(face_type) * faces);
if(obj->face == NULL) exit(1);
object.faces = faces;
}
It's so weird, this program WORKS, if it is just like that!!
I have these matrix-structures in my object and when i'm trying to use the
matrixes with those vertex-coordinates my compiler-(debug, breakpoint) says
that something like "Floating point exeption", or something similar..
my object -structure:
typedef float matrix_type[3][3];
typedef struct object_type {
signed int x,y,z;
float rx,ry,rz;
float ax,ay,az;
face_type *face;
unsigned int faces;
matrix_type object_matrix, world_matrix;
} object_type;
So, when i'm trying to use for example object.world_matrix, rhides debug
cancel program on call to printf("%1.1f",object.object_matrix[0][0]); And
claims there is a floating point exeption??
I'm have no idea what this means!
What is going on??
- Raw text -