Advertisement

Texture deformations

Started by June 13, 2000 07:18 AM
1 comment, last by NinjaCross 24 years, 5 months ago
Hey guys... I''ve got a little question that''s crashing my head from 2 weeks... Please, can you tell me how (if it''s possible) can i apply deformations on bitmaps/textures ? (as in Adope Photshop, Paint Shop Pro etc etc etc) Does exist some built-in functions in OGL that make it ? Thankyou in advance //------------- Making Funny Garbage Codes on http://members.xoom.it/NinjaCross
//-------------A straight line may be the shortest distance between two points, but it is by no means the most interesting.http://members.xoom.it/NinjaCross
Hi again NinjaCross,

Try looking for information on using the Texture matrix (hardly anybody does stuff with it, as far as I know).

I give an example of it''s uses (and there are many more...):

Say you have a textured quad, and you want to shrink the texture along the y-axis by a factor of 2 (make it half as tall as it currently is). This can be done with these lines of code...

    void Render(){    // all this other code    ...    ...    glMatrixMode(GL_TEXTURE);   // Set current matrix to Texture Matrix    glScalef(1.0, 0.5, 1.0);    // Scale by factor of 0.5 along Y-axis    glMatrixMode(GL_MODELVIEW); // Set matrix mode back to modelview    DrawTexturedQuad();    ...    ...}    


Basically, the texture matrix is like any other matrix, and can have the same functions used on it (Rotate to... well, rotate the texture; Translate to move the texture; Scale... etc). Its pretty cool, really

-------------
squirrels are a remarkable source of protein...
Advertisement
Thanyou so much BadMonkey, I gave me a big help !

//-------------
Making Funny Garbage Codes on
http://members.xoom.it/NinjaCross
//-------------A straight line may be the shortest distance between two points, but it is by no means the most interesting.http://members.xoom.it/NinjaCross

This topic is closed to new replies.

Advertisement