how to modify textures?

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
Phenix
Posts: 51
Joined: Sat Nov 15, 2003 3:15 pm
Location: Earth
Contact:

how to modify textures?

Post by Phenix »

hi,what do you think is the best way to modify textures at runtime?
I tried to acces directly to texture pixel data calling ITexture::lock,
but it works well only with not mipmapped textures.
I tried to disable mipmapping when loading the textures I need to
modify using texture creation flag,and reactivating it when loading
textures i don't need to modify,but with direct3d 8.1 mipmapping
seems to enable and disable in an almost random way.
so what shall I do?I have to modify textures every frame,so I need
a fast way.
thank you for your attention,and excuse me for my english.
bye
uzik
Posts: 24
Joined: Wed Sep 22, 2004 4:56 pm

Post by uzik »

Any chance you can make all the textures you need in advance?
It would be much simpler!
Phenix
Posts: 51
Joined: Sat Nov 15, 2003 3:15 pm
Location: Earth
Contact:

Post by Phenix »

well,I would like to use runtime-modified textures to render a spaceship command console.
I considered to use a 2d bitmap instead (like many space combats games,as xwing vs tie fighter),but a command console on texture would be much better,because i would like to make possible to walk around the space ship.
If I found good documentations on the way textures with mipmaps are stored in memory,I think i'll implement a proc that draws bitmaps correctly
and fastly to textures.
I hope i'we wrote something understandable :wink:
goodbye and good coding!
johnjones
Posts: 5
Joined: Sun Sep 05, 2004 1:12 am

Post by johnjones »

If you wanted to make stairs like on lemmings, it would be much easier to be able to add them to a bitmap being used as a mask for collision detection than to make an array or linked list of steps that you have to go through all the time to check if the character is on the stairs or not, because with adding them to the mask bitmap you can just use getpixel and check the color of the pixel under the character's foot to see if they are there. So, being able to edit a bitmap in game is something desirable, although perhaps old school.
Guest

Post by Guest »

are you talking about 2d lemmings?I think the problem is quite different:textures(mipmapped ones) are harder to modify,I need to update every mipmap level.
anyway I'm writing some code that writes IImage to direct3d texture,I think to solve my problem in this way.
old school?i think the access to video memory it's really slow compared to access to system memory on modern hardware,but i need to write not too much pixels (about 10% of texture surface approx),so maybe it's faster than hardware rebuilding all the texture everytime.
Post Reply