[Gui] Render corner cross labels as pixel maps so they are scalable

This commit is contained in:
0penBrain
2021-11-17 12:42:00 +01:00
committed by wmayer
parent abba933757
commit 8890b59f09

View File

@@ -3268,10 +3268,48 @@ void View3DInventorViewer::setViewing(SbBool enable)
//****************************************************************************
// Bitmap representations of an "X", a "Y" and a "Z" for the axis cross.
static GLubyte xbmp[] = { 0x11,0x11,0x0a,0x04,0x0a,0x11,0x11 };
static GLubyte ybmp[] = { 0x04,0x04,0x04,0x04,0x0a,0x11,0x11 };
static GLubyte zbmp[] = { 0x1f,0x10,0x08,0x04,0x02,0x01,0x1f };
// Pixel map representations of an "X", a "Y" and a "Z" for the axis cross.
#define O {0,255} // black pixel
#define I {255,0} // transparent pixel
static uchar xPM[9][7][2] = {
{I,I,I,I,I,I,I},
{I,O,I,I,I,O,I},
{I,O,I,I,I,O,I},
{I,I,O,I,O,I,I},
{I,I,I,O,I,I,I},
{I,I,O,I,O,I,I},
{I,O,I,I,I,O,I},
{I,O,I,I,I,O,I},
{I,I,I,I,I,I,I}
};
static uchar yPM[9][7][2] = {
{I,I,I,I,I,I,I},
{I,I,I,O,I,I,I},
{I,I,I,O,I,I,I},
{I,I,I,O,I,I,I},
{I,I,I,O,I,I,I},
{I,I,O,I,O,I,I},
{I,O,I,I,I,O,I},
{I,O,I,I,I,O,I},
{I,I,I,I,I,I,I}
};
static uchar zPM[9][7][2] = {
{I,I,I,I,I,I,I},
{I,O,O,O,O,O,I},
{I,O,I,I,I,I,I},
{I,I,O,I,I,I,I},
{I,I,I,O,I,I,I},
{I,I,I,I,O,I,I},
{I,I,I,I,I,O,I},
{I,O,O,O,O,O,I},
{I,I,I,I,I,I,I}
};
#undef O
#undef I
void View3DInventorViewer::drawAxisCross(void)
{
@@ -3429,12 +3467,17 @@ void View3DInventorViewer::drawAxisCross(void)
else
glColor3fv(SbVec3f(0.0f, 0.0f, 0.0f).getValue());
//glEnable(GL_ALPHA_TEST);
//glAlphaFunc(GL_GREATER, 0.5);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPixelZoom((float)axiscrossSize/10, (float)axiscrossSize/10);
glRasterPos2d(xpos[0], xpos[1]);
glBitmap(8, 7, 0, 0, 0, 0, xbmp);
glDrawPixels(7, 9, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, xPM);
glRasterPos2d(ypos[0], ypos[1]);
glBitmap(8, 7, 0, 0, 0, 0, ybmp);
glDrawPixels(7, 9, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, yPM);
glRasterPos2d(zpos[0], zpos[1]);
glBitmap(8, 7, 0, 0, 0, 0, zbmp);
glDrawPixels(7, 9, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, zPM);
glPixelStorei(GL_UNPACK_ALIGNMENT, unpack);
glPopMatrix();