Problem with Projective Texturing


08-11-2010 15:34:27

Hi, I want to add some texture on meshes by using Projective Texturing but i have some problems with a mesh;
when i have tried it it has worked without a problem in beginning,
for example it is result when i tried it on ogre head:

But i have some problems with this mesh:

it seems normal now but when i place second or third texture Visual Studio gives Acces Violation Error in rendering;
no problem written in ogre log;
to make it clear, this target mesh has been built from a lot of submeshes and it is created in runtime, from manual object then converting to mesh
i needed a generic and a target as a variable(circle numbers or its radiuses may be changed ), so i have made it from submeshes , every circle in it is a submesh.
I have started to think maybe a lot of submeshes make a problem in this case but i am not sure...
Any help will be appreciated.


19-11-2010 21:25:23

Well is the Material created manually too? I got an access violation in the renderOneFrame too, but I get the same exception pretty randomly, having custom created models / materials or not, doesnt really matter.


22-11-2010 16:25:05

i have assigned material when starting to draw with manualobject and i have used "BaseWhiteNoLightning" material
but Acces Violation Error may point to wide range of errors , i use ogre log to solve similar problems but this time it didnt work on it.


13-12-2010 22:44:05

At the call of which Ogre function you get the error?

It's not nice that you get no entry in the Ogre log file.
If you think the source could be the texture, maybe these points help:

* When you load a material, texture, etc. be shure that it does exist.

* When you create stuff (also related to ManualObjects), be shure you always use unique names (especially when you call your creation method twice).
... Before you create stuff, you can check if it still exists.
... Maybe you add a unique suffix to the material name. (e.g. String myMaterialName = "myMaterial_" + System.Guid.NewGuid().ToString() )

* When you create/edit materials, textures, etc. you need a pointer type (e.g. MaterialPtr). Be shure that you call .Dispose() immediately after creation/modification. (You don't need the pointer for the whole runtime, because the MaterialManager, TextureManager, etc. will keep the materials, textures, etc. in memory.)

I hope that could be a little help.