# webgl matrix

This topic is 2515 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

hello.
I would understand how i can assign a value to an index in a webgl matrix.
I tryed with
var mx = mat4.create();
mx[0][0] = 0.31312312 or
mx[1][0] = 0.2222222

but don't work.
the matrices in webgl are row major or column major?
I think that i must do with only one index from 0 to 15 , but how i can calculate the indexes?

thanks

##### Share on other sites

the matrices in webgl are row major or column major?
I think that i must do with only one index from 0 to 15 , but how i can calculate the indexes?

OpenGL matrices are column major, so given matrix M with R rows and C columns, for element Mi,j the index is calculated as follows:

 index = j*R + i 

with i = [ 0 .. R ), j = [ 0 .. C )

1. 1
Rutin
19
2. 2
3. 3
4. 4
5. 5
frob
12

• 15
• 13
• 9
• 12
• 10
• ### Forum Statistics

• Total Topics
631442
• Total Posts
3000102
×