PDA

View Full Version : Achieving quality postscript



naruto
05-21-2004, 03:45 AM
Hi OpenGL

I found this link from the official site of opengl. The example from this link works just fine. But i tried to add some code that display some text. So from the red book (chapter 8) i copy some code (see below) and try to compile and run the whole application. Everything is fine until i run the application. I see all the examples (torus and teapot) but i dont see the letters that i include to the examples. maybe i did something wrong and hope someon can tell me what.

linkt to the article:
http://www.opengl.org/resources/code/rendering/mjktips/Feedback.html?opengl+to+postscript#first_hit

code that i add:
GLubyte rasters[24] = {
0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00,
0xc0, 0x00, 0xff, 0x00, 0xff, 0x00, 0xc0, 0x00,
0xc0, 0x00, 0xc0, 0x00, 0xff, 0xc0, 0xff, 0xc0}; // contains the letter f

//add to the render function and changed case 0 from glutSolidSphere(..) to this
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glRasterPos2i (20.5, 20.5);
glBitmap(10, 12, 0.0, 0.0, 12.0, 0.0, rasters);
glBitmap(10, 12, 0.0, 0.0, 12.0, 0.0, rasters);
glBitmap(10, 12, 0.0, 0.0, 12.0, 0.0, rasters);

regards

evanGLizr
05-21-2004, 12:25 PM
Originally posted by naruto:
Hi OpenGL

I found this link from the official site of opengl. The example from this link works just fine. But i tried to add some code that display some text. So from the red book (chapter 8) i copy some code (see below) and try to compile and run the whole application. Everything is fine until i run the application. I see all the examples (torus and teapot) but i dont see the letters that i include to the examples. maybe i did something wrong and hope someon can tell me what.

linkt to the article:
http://www.opengl.org/resources/code/rendering/mjktips/Feedback.html?opengl +to+postscript#first_hit (http://www.opengl.org/resources/code/rendering/mjktips/Feedback.html?opengl+to+postscript#first_hit)
[...]
regardsIf you read the code you'll see that the method doesn't work for textured rendering (bitmap are textures at the end of the day):
Be warned that operations such as depth testing (for hidden surface removal) and texturing and blending are therefore not available in feedback mode.
So it only works with colored geometry (it defines & uses the postscript function gouraudtriangle to render all the geometry).

A quick fix is to use geometry for text instead of bitmaps (in Windows it would be wglUseFontOutlines (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/ntopnglr_6kdv.asp) function).