Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

REALBuildPictureFromBuffer weirdness. (Real Studio Plugins Mailinglist archive)

Back to the thread list
Next thread: Re: MOOV ATOM information


macosx and unix paths   -   GOLD
  REALBuildPictureFromBuffer weirdness.   -   Dan
   Re: REALBuildPictureFromBuffer weirdness.   -   Dan

REALBuildPictureFromBuffer weirdness.
Date: 21.06.11 14:28 (Tue, 21 Jun 2011 13:28:46 +0000 (UTC))
From: Dan
OK, so I have some C++ flavored OpenGL code to draw a line to a renderbuffer in
XCode 3.2.2. I then use glReadPixels to get the pixels to pass into
REALBuildPictureFromBuffer. Here's where things get odd;

<a bunch of openGL code goes here, and I can post it all if need be, but bear
with me…>

//Allocating my buffer.
unsigned char myBuf[imageWidth * imageHeight * 3];

//Populating my buffer.
glReadPixels( 0, 0, imageWidth, imageHeight, GL_RGB,
GL_UNSIGNED_BYTE, &myBuf);

//Cleaning up after myself.
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glDeleteRenderbuffersEXT(1, &renderbuffer);

//Maximum strangeness happens here;
return REALBuildPictureFromBuffer(imageWidth, imageHeight,
kRBPixelRGB24, myBuf, imageWidth * 3);

Here's the issue. When imageWidth = imageHeight, it works perfectly. When
imageWidth <> imageHeight, my test app which calls my plugin method crashes
almost instantly. Now it's quite possible that I'm overlooking something
fundamental, as I've only just begun my XCode odyssey and there's a TON I don't
know. Still, this has me scratching my head. Why would it work as expected in
just one, limited case?

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: REALBuildPictureFromBuffer weirdness.
Date: 22.06.11 13:43 (Wed, 22 Jun 2011 12:43:32 +0000 (UTC))
From: Dan
Answered it myself. Changed to;

unsigned int myBuf[imageWidth * imageHeight * 4];

glReadPixels( 0, 0, imageWidth, imageHeight, GL_BGRA,
GL_UNSIGNED_INT_8_8_8_8, &myBuf);

return REALBuildPictureFromBuffer(imageWidth, imageHeight,
kRBPixelBGRX32, myBuf, imageWidth * 4);

…and things work much better. Amazing what a little googling can do.



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>