PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

N95 Camera & Font Problem

Hello,

I am using the Edgelib example code Animate 3D.
When I add the code to use the N95 camera it looks like the Edgelib Font gets over written by the Camera Image.
i.e. Where the font is displayed on screen the font chars show parts of the moving camera image instead.

I am using
iCamera->StartViewFinderBitmapsL( iLandscapeSize );
for the Camera.
Any ideas why this is?

Cheers,
Lance
Hi Lance,

I suspect that the OpenGL ES texture is changed by the camera finder. Because EDGELIB isn't notified, it still thinks the font texture is bound. You can force the texture binding just before drawing your text.
lanceabson · 09 May 2008, 09:40 UTC — example
Hello,
Thank you for your above answer.
Do you have some example code to do this please?

Kind Regards,
Lance
Hi Lance,

Sure:

Code:

//your code to handle the camera
display->BindTexture(&display-;>fontinternal);
display->DrawFont(x, y, &display-;>fontinternal, "text");
lanceabson · 09 May 2008, 15:15 UTC — No Change
Hello, Thanks for the code, but it didn't change anything. The font is still showing as the camera image.
Any other ideas?
Hi Lance,

The only reason I can think of is that the camera runs in a seperate thread and immediatly changes the texture before the font is drawn.

Does the problem also occur when drawing a 3D texture mapped cube? Perhaps you can try to create a texture manually (using glGenTextures, glBindTexture and glTexImage2D) to see if there is any difference?
fuzzychicken · 08 Jun 2008, 22:07 UTC
If you add SetShading, it will work:

Code:
display->BindTexture(&display-;>fontinternal);
display->SetShading(E3D_TEXTURE);
display->DrawFont(x, y, &display-;>fontinternal, "text");


However, the font has pink background color. How can I get rid of that pink color? What is SetShading doing to create that side effect?

Thanks!
Hi Fuzzychicken,

You need to enable texture blending to remove the purple (transparent) pixels. Use this code:

Code:

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
fuzzychicken · 10 Jun 2008, 03:39 UTC
It works! Thanks a lot.