Making textures from memory

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
User avatar
Hoodlum Smurf
Gnoblar
Posts: 21
Joined: Mon Sep 15, 2003 8:45 pm
Location: Toronto, ON

Making textures from memory

Post by Hoodlum Smurf »

I just recently ported my application from Ogre 0.14 to 1.0. I have a section of code that runs each frame where a texture is updated based on a new image which is in memory.

The code I have to do this is below:

Code: Select all

	HardwarePixelBufferSharedPtr pBuf = m_pTexture.get()->getBuffer();
	pBuf->blitFromMemory(PixelBox(m_pImage->GetPrevWidth(),m_pImage->GetPrevHeight(),nDepth,PF_A8R8G8B8,m_pImage->GetByteBuffer()));
The blitFromMemory call works correctly and there are no errors, but it is very slow. Noticeably slower than when I had it running on Ogre 0.14. Is there a more efficient way to perform this operation under Ogre 1.0?
User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark
Contact:

Post by DWORD »

See Creating dynamic textures in the wiki, and the DynTex demo.
User avatar
Hoodlum Smurf
Gnoblar
Posts: 21
Joined: Mon Sep 15, 2003 8:45 pm
Location: Toronto, ON

Post by Hoodlum Smurf »

Thanks for the reply DWORD. I took a look at the link you sent and the DynTex demo. I am basically doing the same thing.

I did take a look at the source for blitFromMemory though and I think I know why I'm having performance issues. I think it's the mipmap generation. I don't want Ogre to automatically generate mipmaps even if the card is capable of it. From what I see the best way to prevent mipmaps from automatically being generated is to affect the value of TU_AUTOMIPMAP. Could anyone tell me how to set TU_AUTOMIPMAP to "false"? Or another way of preventing the automatic generation of mipmaps?
User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark
Contact:

Post by DWORD »

You pass the number of mipmaps to generate in the call to TextureManager::createManual(), so just set it to 0 there. There are more options, see the API reference for that function for further details.
Post Reply