Problem creating a blank image

Started by mot, September 20, 2007, 13:20:32

Previous topic - Next topic

mot

I had trouble creating a blank image using DevIL. It was hard to find a way to do it at all and finally I found out in the original DevIL documentation that this should be done using ilTexImage with the Data parameter set to NULL.

However the LWJGL version of ilTexImage doesn't allow Data to be null so I allocated a direct ByteBuffer, left it empty and passed it to ilTexImage. When trying to blit another (loaded) image into this new image I got a memory access violation.

Since then my need to create blank images has diminished (I do the blitting using OpenGL now). Still wondering though if there's a way to create blank images that I missed. As a simple and ugly workaround I load a small blank PNG file, scale it to the desired size and clear it...

Evil-Devil

Just create a ByteBuffer of the appropriate texture size and use it as your blank texture. That works fine for me.