Jump to content
  • Advertisement
Sign in to follow this  
giugio

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement

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 )

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!