texture not completely updated in directx

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Gorgon Zola
Posts: 118
Joined: Thu Sep 18, 2003 10:05 pm
Location: switzerland

texture not completely updated in directx

Post by Gorgon Zola »

hi everybody

i'm working on a scenenode with procedural texture and noticed a strange behaviour in texturing.

i alter the texture in the 'SceneNode::PreRender' function as follows:

Code: Select all

short* img=texture->lock();
 //... do some pixel manipulation
 texture->unlock();
then using directX video driver this strange texture is drawn.

Image

the cloudy part is the texture I produced in my algorithm, the green, brown etc. part is the original texture i loaded at startup. when i move the camera the texture changes, at closer positions, to my generated pixels but when i move away every thing changes back to the texture that was originally loaded. :twisted:

I tried to verified that behaviour with the opengl driver, but opengl draws every thing like i expect it, without any trace of the originally loaded texture! but the program runs 10 times slower!!

Image

any ideas why this happens? or how i can make directx to do the same as opengl (i like the speed of directx though :) )

thanks

gorgon zola
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

Post by knightoflight »

please, what irr::video::E_MATERIAL_TYPE and what irr::video::E_MATERIAL_FLAG do you use ?
Gorgon Zola
Posts: 118
Joined: Thu Sep 18, 2003 10:05 pm
Location: switzerland

Post by Gorgon Zola »

Code: Select all

Material.Wireframe=false;
Material.Lighting = true;
Material.MaterialType=irr::video::EMT_SOLID;
I'm using S3DVertex2TCoords vertecis and the colormap completely white.
I set ambient light for the scene so I reckon it isn't a lighting problem either.

thanks

Gorgon Zola
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

There is a bug in the current version which might causing this. Try to use only textures with a power-of-two size (16x16, 32x32, 64x64, 128x128, 256x256, 512x512 and so on), this might fix the problem.
Gorgon Zola
Posts: 118
Joined: Thu Sep 18, 2003 10:05 pm
Location: switzerland

Post by Gorgon Zola »

Ok, I'll try that

thanks

gorgon
Gorgon Zola
Posts: 118
Joined: Thu Sep 18, 2003 10:05 pm
Location: switzerland

Post by Gorgon Zola »

Sorry just checked the texture size, and it is 512x512 :cry:
Gorgon Zola
Posts: 118
Joined: Thu Sep 18, 2003 10:05 pm
Location: switzerland

Post by Gorgon Zola »

I'm so stupid,
i created the texture for the terrain as a mipmapped texture. and in my procedure i only changed the top most level.

sorry

Gorgon Zola
Post Reply