hey, for the opengl driver the texture coordinates on the Render to texture target are upside down.
Now, I know i can edit the texture coordinates through the lock and unlock methods, but i only see operations for working on pixel data-
does that mean to flip these textures im going to have to change the texture matrix manually pixel by pixel?
I read all of these posts on the texture operations:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=18017
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=21668
http://irrlicht.sourceforge.net/phpBB2/ ... ht=#114676
http://irrlicht.sourceforge.net/phpBB2/ ... +text+axis
http://irrlicht.sourceforge.net/phpBB2/ ... tate++text
(and many others involving RTT +the OGL/D3D texture issue).
Yet they all offer vague descriptions not really relating to my issue.
I also read the documentation on the RTT issue. AND I know I can get the texture matrix data through the material system, the problem is I don't know what to do with that information...
I guess what I'm looking for is what others have done to solve this issue-
I understand I need to flip the texture coordinates, but I don't understand the operation involved to flip them. What would the algo to flip these textures look like? Would it be a simple matter of redefining matrix values or do I have to apply the changes pixel by pixel in my code (seems inefficient to do manually)?
Or perhaps a simple buildTextureTransform()?
Thanks in advance for any advice. I know I'm asking for alot of retarded explanation, and I apologize for that, but I've been stuck here mentally and I don't know how to progress.
texture coordinate flipping operation
-
- Posts: 28
- Joined: Sun Sep 17, 2006 3:59 pm
- Location: iraq
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Try to use the following matrix as texture matrix:
'This should invert the V part of the texture coords.
Code: Select all
1 0 0 0
0 -1 0 0
0 0 1 0
0 0 0 1
Last edited by hybrid on Thu Jul 12, 2007 1:42 pm, edited 1 time in total.
-
- Posts: 28
- Joined: Sun Sep 17, 2006 3:59 pm
- Location: iraq
so, hybrid, what you're saying is that I would multiply that matrix that you gave me by the texture matrix that i obtain from SMaterial?
so the solution would be something like
4x4matrix texmat = rendertarget->getTextureMatrix();
newTexMat = textmat * yourVtransformMat;
rendetarget->setTextureMatrix(1 or 0 or 2 or 3,newTexMat);
Is that the right idea? Or am I way off?
Am i performing the correct matrix operation, or are you saying that I merely need to set the matrix you gave me (yourVtransformMat) to the rendertarget right away:
renderTarget->setTextureMatrix(0,yourVtransformMat);
thanks for the help.
so the solution would be something like
4x4matrix texmat = rendertarget->getTextureMatrix();
newTexMat = textmat * yourVtransformMat;
rendetarget->setTextureMatrix(1 or 0 or 2 or 3,newTexMat);
Is that the right idea? Or am I way off?
Am i performing the correct matrix operation, or are you saying that I merely need to set the matrix you gave me (yourVtransformMat) to the rendertarget right away:
renderTarget->setTextureMatrix(0,yourVtransformMat);
thanks for the help.
-
- Posts: 28
- Joined: Sun Sep 17, 2006 3:59 pm
- Location: iraq