www.jpct.net
jPCT-AE - a 3d engine for Android => Support => Topic started by: lawless_c on June 03, 2016, 06:24:54 pm
-
Is it possible to swap texture name assignments and texture info's while running a game?
eg assign like this
TextureManager m;
Texture tex1;
Texture tex2;
m.addTexture( "textureA ", tex1) ;
m.addTexture( "textureB", tex2) ;
//Then swap them ?
m.addTexture( "textureA", tex2) ;
m.addTexture( "textureB", tex1) ;
Maybe with a 3rd texture as temporary holder.
-
That wouldn't swap textures on the objects...there's a replaceTexture()-method that can be used for that. But the actual question is: Why would you want to swap textures? It might be a better idea to do that on the objects and not in the manager.
-
Just experimenting with some way of post processing, i wanted to rapidly switch between two.
Basically im creating a world with the textured object in it , using the object shader to perform a process on the shader that writes a result back to the same texture via the framebuffer.
I can't find the replaceTexture method :-[
-
It's in the TextureManager... ???
-
Would something like this work? to swap between two textures every time the function is called?
<code>
private void swapTexture()
{
Temp = texture;
texture=texture2;
texture2=Temp;
tm.replaceTexture("my_little_texture", texture2);
}
</code>
-
It should.
-
I'm an idiot ;D .
I was using the texture swapping as i wanted to avoid writing to a texture while simultaneously reading from it... completely unnecessary as the frame-buffer does the drawing first then outputs the result to the texture..
swapping them was also a very slow operation
-
swapping them was also a very slow operation
Yes, because it may trigger a new texture upload.