<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.newlc.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>NewLC - glTexImage2D gives our beloved &amp;#039;KERN-EXEC 3&amp;#039; - Comments</title>
 <link>http://www.newlc.com/forum/glteximage2d-gives-our-beloved-kern-exec-3</link>
 <description>Comments for &quot;glTexImage2D gives our beloved &#039;KERN-EXEC 3&#039;&quot;</description>
 <language>en</language>
<item>
 <title>Re: glTexImage2D gives our beloved &#039;KERN-EXEC 3&#039;</title>
 <link>http://www.newlc.com/forum/glteximage2d-gives-our-beloved-kern-exec-3#comment-42900</link>
 <description>&lt;p&gt;Okay, the persons responsible for porting OpenGL ES to Symbian should be stabbed - repeatedly.&lt;/p&gt;

&lt;p&gt;I spent hours trying to figure out if my CImageDecoder somehow didn&#039;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 &amp; Red component:&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GLubyte* bytes = new GLubyte[width*height*3];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iBitmap-&amp;gt;LockHeap();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TUint8 *tex1 = (TUint8*)iBitmap-&amp;gt;DataAddress();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int i = 0; i &amp;lt; width*height*3; i += 3) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bytes[i] = tex1[i+2];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bytes[i+1] = tex1[i+1];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bytes[i+2] = tex1[i];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, bytes);&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iBitmap-&amp;gt;UnlockHeap();&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;&quot;#¤&amp;&quot;#/&quot;%&amp; Assholes!&lt;/p&gt;</description>
 <pubDate>Mon, 12 Nov 2007 16:21:41 +0100</pubDate>
 <dc:creator>Steel</dc:creator>
 <guid isPermaLink="false">comment 42900 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: glTexImage2D gives our beloved &#039;KERN-EXEC 3&#039;</title>
 <link>http://www.newlc.com/forum/glteximage2d-gives-our-beloved-kern-exec-3#comment-42579</link>
 <description>&lt;p&gt;Thanks for your help, alh, but I never found out what gave that KERN-EXEC 3, because I tried many different things.&lt;/p&gt;

&lt;p&gt;I also tried to synchronously decode my GIF, but that never worked.&lt;/p&gt;

&lt;p&gt;I later got some errors because the created &lt;code&gt;CFbsBitmap&lt;/code&gt; had some strange properties:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;iBitsPerPixel=12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;-- 4096 colors?!&lt;br /&gt;iBitmapSize=32808&lt;br /&gt;iWidth=128&lt;br /&gt;iHeight=128&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;Anyways after a lot of fiddling about i found that &lt;code&gt;SetActive&lt;/code&gt; conflicted with my drawing loop:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;nbsp; CFbsBitmap* iBitmap = new (ELeave) CFbsBitmap();&lt;br /&gt;&amp;nbsp; iBitmap-&amp;gt;Create(iFrameInfo.iOverallSizeInPixels, EColor16M);&lt;br /&gt;&amp;nbsp; // start reading the bitmap: RunL called when complete&lt;br /&gt;&amp;nbsp; iLoadUtil-&amp;gt;Convert(&amp;amp;iStatus, *iBitmap);&lt;br /&gt;//&amp;nbsp; SetActive();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;-- culprit!&lt;br /&gt;&amp;nbsp; User::WaitForRequest(iStatus);&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;The conversion was done, but the drawing loop never started:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;start:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int iFramesPerSecond = 50;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int iOneSecondInMicroSeconds = 1000000;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iPeriodic = CPeriodic::NewL(CActive::EPriorityStandard);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iPeriodic-&amp;gt;Start(100000,iOneSecondInMicroSeconds/iFramesPerSecond,TCallBack(CAppView::DrawCallback,this)); &lt;/code&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;I hope this&#039;ll help other frustrated newbie Symbian developers.&lt;/p&gt;</description>
 <pubDate>Thu, 25 Oct 2007 10:15:40 +0200</pubDate>
 <dc:creator>Steel</dc:creator>
 <guid isPermaLink="false">comment 42579 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: glTexImage2D gives our beloved &#039;KERN-EXEC 3&#039;</title>
 <link>http://www.newlc.com/forum/glteximage2d-gives-our-beloved-kern-exec-3#comment-42555</link>
 <description>&lt;p&gt;You mention your app is multi threaded.&lt;br /&gt;
Is the call to glTexImage2D in the same thread as the main UI thread, where you created the gl context?&lt;br /&gt;
If not, that is your problem...&lt;/p&gt;

&lt;p&gt;gl calls must be in the same thread as where you create the gl context.&lt;br /&gt;
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)&lt;br /&gt;
&lt;/p&gt;</description>
 <pubDate>Wed, 24 Oct 2007 14:53:17 +0200</pubDate>
 <dc:creator>alh</dc:creator>
 <guid isPermaLink="false">comment 42555 at http://www.newlc.com</guid>
</item>
<item>
 <title>glTexImage2D gives our beloved &#039;KERN-EXEC 3&#039;</title>
 <link>http://www.newlc.com/forum/glteximage2d-gives-our-beloved-kern-exec-3</link>
 <description>&lt;p&gt;I&#039;m loading and converting a GIF image using &lt;code&gt;CImageDecoder&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I then create a copy of the resulting &lt;code&gt;CFbsBitmap&lt;/code&gt;, because I read somewhere that handles between threads could cause problems.&lt;/p&gt;

&lt;p&gt;But it is ultimately the &lt;code&gt;glTexImage2D(...)&lt;/code&gt; function which crashes my emulator:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;
  CFbsBitmap* iBitmapCopy = new (ELeave) CFbsBitmap();&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.newlc.com/forum/glteximage2d-gives-our-beloved-kern-exec-3&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://www.newlc.com/forum/glteximage2d-gives-our-beloved-kern-exec-3#comments</comments>
 <category domain="http://www.newlc.com/forums/2d-3d-graphics">Bitmaps and Graphics</category>
 <pubDate>Wed, 24 Oct 2007 13:31:36 +0200</pubDate>
 <dc:creator>Steel</dc:creator>
 <guid isPermaLink="false">19391 at http://www.newlc.com</guid>
</item>
</channel>
</rss>
