PocketMatrix forums

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

Mix 2D and 3D

Hi Edgelib team!

I am new to Edgelib and can't find a solution for the following problem. I am trying to mix 2D graphics for menus and 3D graphics for the game. Pretty much like mixing the blastar and turtle example. I tried to first draw menu items (text, etc) to a background image, then upload the texture and display it using display->Perspective2D and display->BltFast which worked out but is very slow, so effects like flashing text (blastar) don't make sense. As an alternative to 2D menu text handling I tried to use the display->DrawFont in 3D but in contrast to 2D there doesn't seem to be a possibility to change text properties like color.

Thanks in advance for any advice!
Hi,

To use blending and change text color use the following call prior to BltFast and DrawFont:

Code:

display->SetShading(E3D_TEXTURE | EFX_COLORIZE, E_RGBA(255, 0, 0, 255));
//Your render call here
display->SetShading(E3D_TEXTURE);
Hi Edge,

thanks for your answer. Text colors now work perfectly. One more question about setting the display orientation. config->orientation = DOR_LANDSCAPE works using the edgelib renderer. Using OpenGL orientation is always PORTRAIT on the device. How can I switch in OpenGL?

Thanks,
Olli
Hi,

To rotate in OpenGL, call this after Perspective2D:

Code:

glRotatef(90, 0, 0, 1);
glTranslatex(0, -320, 0);