• Create Account

# Permanent Object Transformation . . . . ..

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

7 replies to this topic

### #1casanovaC4  Members   -  Reputation: 120

Like
0Likes
Like

Posted 19 September 2009 - 12:26 PM

Hy, is there any way to translate or rotate a 3D object permanently without loading identity matrices again and again. Like, i have a cube and i want to rotate the cube itself but not the modelview matrix. The solution i think is that i have to create a matrix for each vertex of the cube and then load that vertex matrix and then use rotation or translation method, this way cube will rotate but not the modelview matrix, but i maybe wrong. Will be greatly thankful if someone can help out. Regards.

### #2idinev  Members   -  Reputation: 236

Like
0Likes
Like

Posted 19 September 2009 - 02:46 PM

Make a 4x4 or 4x3 matrix, multiply with your vec3, replace vertex with that vec3.

### #3casanovaC4  Members   -  Reputation: 120

Like
0Likes
Like

Posted 19 September 2009 - 03:07 PM

That means i have to convert every point into a matrix?
Wont that be difficult and time consuming?
Does OpenGL provide any function which takes in x, y, z and returns matrix or something?

### #4ibebrett  Members   -  Reputation: 205

Like
0Likes
Like

Posted 19 September 2009 - 03:09 PM

no, multiply each point by the transformation matrix you wish, then store the results.

### #5casanovaC4  Members   -  Reputation: 120

Like
0Likes
Like

Posted 19 September 2009 - 11:15 PM

I know what your saying but tell me how to multiply a point with a rotation or translation matrix?
Is there any OpenGL function which does that for you or what?

### #6Codeka  Members   -  Reputation: 1239

Like
0Likes
Like

Posted 19 September 2009 - 11:21 PM

OpenGL doesn't have anything built in that can do it, but there are third-party libraries which you can use.

### #7Fiddler  Members   -  Reputation: 860

Like
0Likes
Like

Posted 20 September 2009 - 04:33 AM

Just note that the GPU will transform all vertices anyway, even if you don't specify a modelview/projection matrix! This is what the GPU is designed to do - by duplicating all this work on the CPU you essentially lose the benefits of hardware acceleration and make your code several orders of magnitude slower.

The only reason you should ever touch the vertices of an object, is to deform it in a permanent way.

[OpenTK: C# OpenGL 4.4, OpenGL ES 3.0 and OpenAL 1.1. Now with Linux/KMS support!]

### #8haegarr  Crossbones+   -  Reputation: 7160

Like
0Likes
Like

Posted 20 September 2009 - 05:04 AM

Quote:
 Original post by FiddlerThe only reason you should ever touch the vertices of an object, is to deform it in a permanent way.

I think the most often reason is importing a model from a modeling package that doesn't fit the game's world convention (okay, can be understood as "permanent deformation" ;)).

@OP: However, I agree that besides some special purposes one should keep the hands off it. Avoiding "loading identity matrices again and again" isn't such a purpose, IMHO, especially because one cannot avoid it anyway.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS