Hello Antonio,

This is a good idea, but there is a problem. Using testTextPixmap I obtained an ImagePtr of the text I wanna draw:
     ImagePtr imagePtr = face->makeImage(layoutResult, offset);

then I set the foreground:
     ImageForegroundPtr imp = ImageForeground::create(  );
     beginEditCP(imp);
     //NOTE: the position values are between 0 and 1
     //and are relative to the viewport!
     ImagePtr imagePtr = oText->getImage();
     imp->addImage( imagePtr, Pnt2f(0.1,0) );                
    endEditCP(imp);

    viewport->getMFForegrounds()->push_back(imp);

But, when I start my program no text is drawn and this error occurs:
WARNING: Window:frameExit: Caught stry OpenGL error not valid enumerator (0x500).

Someone can help me? Loading a png as ImagePtr the program works fine, but not with the ImagePtr obtained by TextPixmapFace.

The problem is that the image created by the text function uses the pixel format GL_INTENSITY. This works when the image is used as a texture (inside a TextureChunk). But the ImageForeground uses a glDrawPixels() call to copy the image to the screen, and glDrawPixels () does not handle GL_INTENSITY.

As a workaround, you can change the pixelformat by calling setPixelFormat() on the image, eg. to GL_LUMINANCE or GL_ALPHA. I do not know how the result looks like - I never used glDrawPixels(). Another solution is to convert the image to GL_LUMINANCE_ALPHA by calling the reformat() method.

Bye,

Patrick



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to