void printString(char *s)
{
   bool haveInitialized = false;
   if( !haveInitialized ) makeRasterFont();
   glPushAttrib (GL_LIST_BIT);
   glListBase(fontOffset);
   glCallLists(strlen(s), GL_UNSIGNED_BYTE, (GLubyte *) s);
   glPopAttrib ();
}
Example #2
0
void init()
{
	glShadeModel (GL_FLAT);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluOrtho2D(0,2000,0,2000);
   	makeRasterFont();

}
void ParticleShaderText::drawParticle(int i)
{
	
	int val = i;
	if((useScalar) && (scalar))
		val = (int) scalar->getScalar(i);

	makeRasterFont();
    char wholestring[6];
	char teststring[5];
	char zero[] = " ";

	//glRasterPos3i(0,0,0);
	glRasterPos2i(0,0);
	sprintf(teststring,"%i",val);
	
	strcpy(wholestring, zero);
	strcat(wholestring,teststring);
   	printString(wholestring);


	//	GLfloat black[3] = {0.0, 1.0, 0.0};
//	int j,k;

//	int sSz = 5; // teststring size

    //glPushAttrib(GL_COLOR_BUFFER_BIT);
	//glClear(GL_COLOR_BUFFER_BIT);
//    glColor3fv(black);
    /*for (j = 32; j < 127; j += sSz) {
        //glRasterPos2i(20, 200 - 18*j/sSz);
		glRasterPos3i(0,0,0);
        for (k = 0; k < sSz; k++)
            teststring[k] = (char) (j+k);
        teststring[sSz-1] = 0;
        printString(teststring);
    }*/
    //glRasterPos2i(20, 100);
	
//	float clr[4];
	
//	glGetFloatv(GL_CURRENT_RASTER_COLOR,clr);
	
	
	//printString("123");
    //glRasterPos2i(20, 82);
    //printString("over a lazy dog.");
    //glFlush ();
	//glPopAttrib();


}
Example #4
0
void glutBitmapCharacter(void *font, int character)
{
    GLint para[16];
    int i;

    glGetIntegerv(GL_MODELVIEW_MATRIX, (GLint*)&para);

    if (glfont_was_init == 0)
    {
	glfont_was_init = 1;
	makeRasterFont();
    }

    for (i = 0; i < 16; i++)
	lastpara[i] = para[i];

    wasstroke = 0;

    glPushAttrib (GL_LIST_BIT);
    glListBase(fontOffset);
    glCallLists(1, GL_UNSIGNED_BYTE, (GLubyte *) &character);
    glPopAttrib ();
}
Example #5
0
void init(void)
{
   glShadeModel (GL_FLAT);
   makeRasterFont();
}
Example #6
0
int 
Lpanel::openWindow(const char *title)
{

  int status;
  
  XVisualInfo *vi = NULL;
  XSetWindowAttributes swa;
  XSizeHints hints;
  XEvent ev;
  int *attr;

  dpy = XOpenDisplay(0);
  if (dpy == NULL)
   {
    fprintf(stderr, "Can't connect to display \"%s\"\n", getenv("DISPLAY"));
    return 0;
   }

  attr = RGBA_DB_attributes;
  vi = glXChooseVisual(dpy, DefaultScreen(dpy), attr);
  if (vi == NULL) 
   {
    fprintf(stderr, "Can't find visual\n");
    return 0;
  }


  glXGetConfig(dpy, vi, GLX_USE_GL, &status);
  if (!status) 
   {
    printf("Your system must support OpenGL to run lightpanel\n");
    return 0;
  }

  swa.border_pixel = 0;
  swa.colormap = XCreateColormap(dpy, RootWindow(dpy, vi->screen),
                                 vi->visual, AllocNone);
  swa.event_mask = ExposureMask | StructureNotifyMask | KeyPressMask | KeyReleaseMask |
    ButtonPressMask | ButtonReleaseMask ;

  float geom_aspect = (bbox.xyz_max[0] - bbox.xyz_min[0]) / (bbox.xyz_max[1] - bbox.xyz_min[1]);
  window_ysize = (int) ( (float) window_xsize / geom_aspect);

  window = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 500, 500, window_xsize, window_ysize,
                         0, vi->depth, InputOutput, vi->visual,
                         CWBorderPixel | CWColormap | CWEventMask, &swa);

  wmDeleteMessage = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
  XSetWMProtocols(dpy, window, &wmDeleteMessage, 1);

  XStoreName(dpy, window, title);

  hints.width = 500;
  hints.height = 125;
  hints.min_aspect.x = window_xsize;
  hints.min_aspect.y = window_ysize;
  hints.max_aspect.x = window_xsize;
  hints.max_aspect.y = window_ysize;
  hints.flags = PSize | PAspect;
  XSetNormalHints(dpy, window, &hints);

  XMapWindow(dpy, window);
  XIfEvent(dpy, &ev, WaitForMapNotify, (char *)window);

  if ((cx = glXCreateContext(dpy, vi, 0, GL_TRUE)) == NULL) {
    printf("lightpanel: Can't create context\n");
    return 0;
  }
  if (!glXMakeCurrent(dpy, window, cx)) {
    printf("lightpanel: Can't make window current to context\n");
    return 0;
  }

 resizeWindow();
 initGraphics();

 cursor[0] = (bbox.xyz_max[0] + bbox.xyz_min[0]) * .5;
 cursor[1] = (bbox.xyz_max[1] + bbox.xyz_min[1]) * .5;
 makeRasterFont();
 make_cursor_text();

 return 1;
}
Example #7
0
void init(){
	glShadeModel(GL_FLAT);
	makeRasterFont();
	
	glClearColor(0.5, 0.5, 0.5, 1.0);
}