Public Group

# Opengl complexes transformations

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

## Recommended Posts

Hi, I have a question for you: If translate transformation is made with matrix 1 0 0 x 0 1 0 y 0 0 1 z 0 0 0 1 where x, y, z are arguments of glTranslatef(x,y,z); How can I use matrices like this 1 0 0 0 0 f(y) g(y) 0 0 h(y) k(y) 0 0 0 0 1 where y is the current y-coord, to have an effect like bending??? Briefly I'd like to use dynamic matrixes instead static matrices but in opengl I don't know how to do it... someone has any ideas?

##### Share on other sites
Is it glLoadMatrix*()/glMultMatrix*() that you're looking for?

##### Share on other sites
I think he means the elements of the matrices are depending on the coordinates of the vectors, he wants to transform.
But in what situation is it necessary?
I think you can do it if you use your own vertex manipulation code, and store the transformed vertixes in an other buffer, or use vertex shader.

Edit: by own code I mean: use the matrices as you want, iterate through all your vertexes and transform them.
You are not able to do it in openGL drawing, since transformation calls aren't allowed between glBegin()-glEnd(), and you have to apply individual matrices every vertex. (Although the elements are functions of the vectors' coordinates)

##### Share on other sites
yes, it's ok, but if I wont to deform a quadrilater using this 2d equations?

x1=x0
y1=sin(x0)+y0

Normally I use this code:

glVertix2f(5,5);
glVertix2f(10,5);
glVertix2f(10,10);
glVertix2f(5,10);
glEnd();

to draw a quadrilater and first glTraslatef(5,0,0) to make a traslation, but in my case? How I do it?

The problem is that I don't know how use current_x or current_y values in my transformation matrix... :(

any ideas?

##### Share on other sites
Matrices can only do linear transformations, but you want non-linear transformations. You have to, as szecs said, transform the vertices yourself either with your own code or using a shader.

##### Share on other sites
ok, thanks, I'll see GLSL for using shader... :)

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

• 14
• 30
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631780
• Total Posts
3002314
×