Lock texture in orthogonal projection fail

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
3dsolar
Posts: 15
Joined: Wed Feb 06, 2008 9:36 am
Contact:

Lock texture in orthogonal projection fail

Post by 3dsolar »

Hi
Do you know why lock() works ok if I'm in perspective projection but fail in orthogonal projection ?

Thanks
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Please show us the full (relevant) code, and describe what "fail" means.
3dsolar
Posts: 15
Joined: Wed Feb 06, 2008 9:36 am
Contact:

Post by 3dsolar »

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
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

try tex->regenerateMipMapLevels()
Also, which driver do you use?
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
3dsolar
Posts: 15
Joined: Wed Feb 06, 2008 9:36 am
Contact:

Post by 3dsolar »

we use DirectX so far
Post Reply