glTexImage2D gives our beloved 'KERN-EXEC 3'
| Wed, 2007-10-24 12:31 | |
|
|
I'm loading and converting a GIF image using I then create a copy of the resulting But it is ultimately the CFbsBitmap* iBitmapCopy = new (ELeave) CFbsBitmap();Any ideas? |






Forum posts: 1134
You mention your app is multi threaded.
Is the call to glTexImage2D in the same thread as the main UI thread, where you created the gl context?
If not, that is your problem...
gl calls must be in the same thread as where you create the gl context.
And in S60, you also have to create the gl context in the main UI thread (or provide a (new) instance of CCoeEnv/CEikonEnv in the new thread)
Forum posts: 6
Thanks for your help, alh, but I never found out what gave that KERN-EXEC 3, because I tried many different things.
I also tried to synchronously decode my GIF, but that never worked.
I later got some errors because the created
CFbsBitmaphad some strange properties:iBitsPerPixel=12 <-- 4096 colors?!iBitmapSize=32808
iWidth=128
iHeight=128
Even though my GIF is only 16 colors, these are chosen from a 24-bit palette, so you loose accuracy with only 12 bpp, right? I now forced my bitmap to 24 bpp.
Anyways after a lot of fiddling about i found that
SetActiveconflicted with my drawing loop:CFbsBitmap* iBitmap = new (ELeave) CFbsBitmap();iBitmap->Create(iFrameInfo.iOverallSizeInPixels, EColor16M);
// start reading the bitmap: RunL called when complete
iLoadUtil->Convert(&iStatus, *iBitmap);
// SetActive(); <-- culprit!
User::WaitForRequest(iStatus);
The conversion was done, but the drawing loop never started:
start:int iFramesPerSecond = 50;
int iOneSecondInMicroSeconds = 1000000;
iPeriodic = CPeriodic::NewL(CActive::EPriorityStandard);
iPeriodic->Start(100000,iOneSecondInMicroSeconds/iFramesPerSecond,TCallBack(CAppView::DrawCallback,this));
I hope this'll help other frustrated newbie Symbian developers.
Forum posts: 6
Okay, the persons responsible for porting OpenGL ES to Symbian should be stabbed - repeatedly.
I spent hours trying to figure out if my CImageDecoder somehow didn't load the GIF/PNG/JPG correctly, but it seems a 24-bit CFbsBitmap has its colors in BGR format. So after your convertion is finished, you have to swap the Blue & Red component:
GLubyte* bytes = new GLubyte[width*height*3];iBitmap->LockHeap();
TUint8 *tex1 = (TUint8*)iBitmap->DataAddress();
for(int i = 0; i < width*height*3; i += 3) {
bytes[i] = tex1[i+2];
bytes[i+1] = tex1[i+1];
bytes[i+2] = tex1[i];
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, bytes);
iBitmap->UnlockHeap();
"#ยค&"#/"%& Assholes!