Oodles of Questions

Okay, as if I haven’t bothered enough… here’s more.

First, printing:

It seems as if my printing output is placing parts of an object that are behind the front surface on top of the front surface. Is this supposed to happen (ie: stuff rendered to a bitmap is drawn in the order they’re rendered, so if you render the front object and then an object behind, it will be flattened to the top of the original object)?

If so, how do I fix it?

And secondly, billboards:

I need to use 2D text in my app. I’ve heard about the performance of 2D-bitmap text, let alone not being able to get it to even work (The display lists create, but no output). I’m using 3D-TTF flattened fonts, but they have very poor resolution. So my final solution is dynamic billboards, which I know of all the obvious benefits.

Two things with that though… first, how do I create them?

Second, How do I keep the billboard front facing when the scene its attached to rotates?

Sorry to make you digest all that at once.

Thanx in advance for any help.

Siwko

You mean drawing directly to a printer DC? Well, I don’t think many printers support Z-buffering at the moment… :slight_smile: Try rendering to a DIB instead, then blit from the DIB to the printer DC.

You can draw 2D text using gluOrtho2D(), but I couldn’t get it to work, so I used gluUnproject(), it’s probably not very efficient (heck, I use sprintf()!), but it works for me.
Incidentally, one of the reasons it’s not very well written is that I had to get it finished as a show-piece for a job I applied for, and I had very little time to finish it. So I decided to just get it working, rather that making it work efficiently. I hope to hear this week whether I’ve got it or not.

// Display the frame rate counter.
if (m_fpsToggle) {
glPushMatrix();
// We just want solid colour.
glDisable(GL_LIGHTING);
glColor3f(0.7f, 0.2f, 0.8f);
// Get us some matrixes.
glGetDoublev(GL_MODELVIEW_MATRIX, mod);
glGetDoublev(GL_PROJECTION_MATRIX, proj);
glGetIntegerv(GL_VIEWPORT, vp);
// Find the screen point (10.0, 10.0, 0.01) in world coords
gluUnProject(10.0, 10.0, 0.01, mod, proj, vp, &tx, &ty, &tz);
glRasterPos3f(tx, ty, tz);
// Build our message.
glListBase(m_fontBase);
char mess[64];
sprintf(mess, “FPS: %0.2f”, m_fps);
// Display it.
glCallLists(strlen(mess), GL_UNSIGNED_BYTE, (GLvoid*)mess);
// Revert to prevous state.
glEnable(GL_LIGHTING);
glPopMatrix();
}

He Who Really Wants This Job.

-John

Originally posted by MikeC:
You mean drawing directly to a printer DC? Well, I don’t think many printers support Z-buffering at the moment… :slight_smile: Try rendering to a DIB instead, then blit from the DIB to the printer DC.

No, not to a printer DC. I render to the DIB section first, then the DIB gets copied to the printer DC via StretchBlt(). (OpenGL SuperBible, et al).

I set it up to save to a bitmap as well now. I’m going to run some visual tests to see if they come out right.

Any other suggestions (no metafiles allowed).

Originally posted by JohnD:
You can draw 2D text using gluOrtho2D(), but I couldn’t get it to work, so I used gluUnproject(), it’s probably not very efficient (heck, I use sprintf()!), but it works for me.

Good luck on the job BTW.

As far as the rest goes, what are you using for the display lists? wglBitmapFonts or wglFontOutlines? I’m using font outlines because the bitmap fonts didn’t work, period. I don’t want to use the fond outlines because of the unnecessare polycount, and also because their quality on a monitor sucks when scaled down.

I’m using wglUseFontBitmaps(). This is the code I use to build them (combine it with the code earlier, and that’s all I use for fonts). There’s no error checking, but you could put it in if you want. I modified this code from “OpenGL Programming for Windows 95/NT”, which is quite a useful book.

GLuint BuildFont(LPCTSTR fontName) {
HDC hDC = wglGetCurrentDC();
HFONT newFont;
HFONT oldFont;
LOGFONT lf;
GLuint id;

lf.lfHeight = -12;
lf.lfWidth = 0;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
lf.lfWeight = FW_NORMAL;
lf.lfItalic = FALSE;
lf.lfUnderline = FALSE;
lf.lfStrikeOut = FALSE;
lf.lfCharSet = ANSI_CHARSET;
lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfQuality = DEFAULT_QUALITY;
lf.lfPitchAndFamily = FF_DONTCARE | DEFAULT_PITCH;
lstrcpy(lf.lfFaceName, fontName);

newFont = CreateFontIndirect(&lf);
oldFont = (HFONT)SelectObject(hDC, newFont);
id = glGenLists(128);
wglUseFontBitmaps(hDC, 0, 128, id);
SelectObject(hDC, oldFont);
return id;
}

Hw Who Has More Books That Shelf Space.

-JohnD

[This message has been edited by JohnD (edited 05-25-2000).]

[This message has been edited by JohnD (edited 05-25-2000).]

Originally posted by JohnD:
I’m using wglUseFontBitmaps(). This is

Strange… I tried almost exactly the same thing, and it did NOT work. I could not get font bitmaps to display at all. That’s why I’m stuck with font outlines. Maybe I’ll try again.

Thanx