bar file problems and image resources

Started by
0 comments, last by GreenToad 19 years, 5 months ago
For those having trouble with bar files and loading image resources, here a few things to try: 1. When you're updating your resources in the BREW resource editor be sure to click "apply" in the bottom right corner for the changes to take effect. 2. After you've made changes to your .bar file and re-compiled it, try exiting the emulator and restarting it before trying to use your new resources in your application. The emulator may sill be using the old .bar data from before the updates, and so the IDs for your new resources are invalid. 3. Make sure you're NOT using the resource type "binary" for your images. It's currently not supported. Instead use the type "object". You'll have to change your .bar file and recompile it if you're using "binary". You may also want to try this alternative method of loading your .bmp files for textures: -In the resource editor, create a new resource of type "object". Make the data for the object point to your .bmp file. Compile the .bar and restart the emulator. -In your application: IDIB* pDib; IBitmap* pBmp = ISHELL_LoadResBitmap(shell, "res file name", "your res ID"); IBITMAP_QueryInterface(pBmp, AEECLSID_DIB, (void**) &pDib); if(dib != NULL) { //now use the data members of pDib to access your image. //Note: you may have to swap the red and blue channels in your image data due to byte-ordering. } The image data is accessed using the pBmp member of pDib. The nPitch member tells you whether your image is top-down (nPitch is positive) or bottom up (nPitch is negative). So, an example of how to create a GLES texture from a bottom-up bitmap: glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, pDib->cx, pDib->cy, 0, GL_RGB, GL_UNSIGNED_BYTE, pDib->pBmp+((pDib->nPitch)*(pDib->cy-1))); See the BREW documentation for more detailed information about IDIB. Hope that helps.
Advertisement
Thanks, this helps a great deal!

This topic is closed to new replies.

Advertisement