PDA

View Full Version : glMultMatrixf(GLfloat *m ) is back.



FoxDie
03-08-2001, 06:52 AM
Hello ,

I have a little problem.
When I try to multiply modelview matrix it
rotate an object.But it also exit program.
The source of funcion is here:
void MakeR()
{

float matrix[4][4]=
{
{0.6928f,0.0f,-0.766f,0.0f},
{0.0f,1.0f,0.0f,0.0f},
{0.766f,0.0f,0.6928f,0.0f},
{0.0f,0.0f,0.0f,1.0f}
};


glMultMatrixf(&matrix[0][0]);


};

HenryR
03-08-2001, 08:34 AM
I believe (although don't assume I'm right) that having a matrix type as float[4][4] does not guarantee that the memory is contiguous. Essentially your matrix may be an array of four float pointers, pointing to different parts of memory. Much better to have

typedef matrix_t float[16], and use some other method for easily indexing the array members.

HTH,

Henry

Bob
03-08-2001, 09:01 AM
The C-specifications says that an array of an arrays must be of contignuous memory. Have not read the specs myself, but have seen quite a few people say this.

03-08-2001, 10:29 AM
you should declare float [16] because c is aligned differently than opengl

opengl

1 5 9 13
2 6 10 14
3 7 11 15
4 8 12 16


c is

1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16

Elixer
03-08-2001, 11:19 AM
In any case, doing a glmultmatrixf(), will not exit the program, even if the data is wrong. You must have something else going wrong.

You can use matrix[4][4] or matrix[16]. I prefer matrix[16] for several reasons.

FoxDie
03-11-2001, 02:23 AM
Sorry, the problem was in Window function.
The case of message not return value.