Hi
Do you know why lock() works ok if I'm in perspective projection but fail in orthogonal projection ?
Thanks
Lock texture in orthogonal projection fail
core:: matrix4 cam_mat;
cam_mat.buildProjectionMatrixOrthoLH (4000,3000,0,300000);
ICameraSceneNode* camera = _irSmgr-> addCameraSceneNode ();
camera-> setProjectionMatrix (cam_mat);
I display on screen (320x240) little plane and try apply texture
1. if texture load like this:
ITexture* tex = _irDriver-> GetTexture ("name.jpg");
display ok.
2. if texture create and then filled:
ITexture* tex = _irDriver-> addTexture (dimension2d <s32> (512, 512), "T2", ECF_A8R8G8B;
u8 *pdest = (u8 *) tex-> lock ();
for (u32 y=0; y <512; y ++)
{
for (u32 x=0; x <512; x ++)
{
u32 i = 4 * (y*512+x);
pdest [i + 0] = rand () ;
pdest [i + 1] = rand () ;
pdest [i + 2] = rand () ;
pdest [i + 3] = rand () ;
}
}
tex-> unlock ();
display fail (plane without texture)
I try simply to increase the scale of the plane to a specific level then texture began to show.
Then I try at initial plane scale to only reduce the resolution of the texture then the texture start to show again.
I dont understand, any idea ?
Thanks
cam_mat.buildProjectionMatrixOrthoLH (4000,3000,0,300000);
ICameraSceneNode* camera = _irSmgr-> addCameraSceneNode ();
camera-> setProjectionMatrix (cam_mat);
I display on screen (320x240) little plane and try apply texture
1. if texture load like this:
ITexture* tex = _irDriver-> GetTexture ("name.jpg");
display ok.
2. if texture create and then filled:
ITexture* tex = _irDriver-> addTexture (dimension2d <s32> (512, 512), "T2", ECF_A8R8G8B;
u8 *pdest = (u8 *) tex-> lock ();
for (u32 y=0; y <512; y ++)
{
for (u32 x=0; x <512; x ++)
{
u32 i = 4 * (y*512+x);
pdest [i + 0] = rand () ;
pdest [i + 1] = rand () ;
pdest [i + 2] = rand () ;
pdest [i + 3] = rand () ;
}
}
tex-> unlock ();
display fail (plane without texture)
I try simply to increase the scale of the plane to a specific level then texture began to show.
Then I try at initial plane scale to only reduce the resolution of the texture then the texture start to show again.
I dont understand, any idea ?
Thanks