Ejemplo n.º 1
0
void  glutBitmapString( void* fontID, const unsigned char *string )
{
    int c;
    int numchar = strlen( string );
    SFG_Font* font = fghFontByID( fontID );
    float raster_position[ 4 ];

    glGetFloatv ( GL_CURRENT_RASTER_POSITION, raster_position );
    glPushClientAttrib( GL_CLIENT_PIXEL_STORE_BIT );
    glPixelStorei( GL_UNPACK_SWAP_BYTES,  GL_FALSE );
    glPixelStorei( GL_UNPACK_LSB_FIRST,   GL_FALSE );
    glPixelStorei( GL_UNPACK_ROW_LENGTH,  0        );
    glPixelStorei( GL_UNPACK_SKIP_ROWS,   0        );
    glPixelStorei( GL_UNPACK_SKIP_PIXELS, 0        );
    glPixelStorei( GL_UNPACK_ALIGNMENT,   1        );

    /*
     * Step through the string, drawing each character.
     * A newline will simply translate the next character's insertion
     * point back to the start of the line and down one line.
     */
    for( c = 0; c < numchar; c++ )
        if( string[c] == '\n' )
        {
            raster_position[ 1 ] -= ( float )font->Height;
            glRasterPos4fv( raster_position );
        }
        else  /* Not an EOL, draw the bitmap character */
        {
            const GLubyte* face = font->Characters[ string[ c ] - 1 ];

            glBitmap(
                face[ 0 ], font->Height,     /* Bitmap's width and height    */
                font->xorig, font->yorig,    /* The origin in the font glyph */
                ( float )( face[ 0 ] ), 0.0, /* The raster advance; inc. x,y */
                ( face + 1 )                 /* The packed bitmap data...    */
            );
        }
    glPopClientAttrib( );
}
Ejemplo n.º 2
0
M(void, glRasterPos4fv, jobject v) {
	glRasterPos4fv(BUFF(GLfloat, v));
}
Ejemplo n.º 3
0
/** Render the volume onto currently selected drawBuffer.
 Viewport size in world coordinates is -1.0 .. +1.0 in both x and y direction
*/
void vvStingray::renderVolumeGL()
{
  GLint viewPort[4];
  GLfloat glsRasterPos[4];                        // current raster position (glRasterPos)
  vvVector3 size;
  static vvStopwatch* sw = new vvStopwatch();     // stop watch for performance measurements
  static int imgSize[2] =                         // width and height of Stingray window
  {
    0,0
  };
  unsigned char* image=NULL;

  vvDebugMsg::msg(3, "vvStingray::renderVolumeGL()");
  cerr << "vvStingray::renderVolumeGL() called" << endl;

  sw->start();

  // Draw boundary lines (must be done before setGLenvironment()):
  size = vd->getSize();
  if (_renderState._boundaries)
  {
    drawBoundingBox(&size, &vd->pos, boundColor);
  }
  if (_renderState.getParameter(VV_CLIP_MODE))
  {
    drawPlanePerimeter(&size, &vd->pos, &_renderState._clipPoint,
      &_renderState._clipNormal, _renderState._clipColor);
  }

  setGLenvironment();

  // Update image size:
  glGetIntegerv(GL_VIEWPORT, viewPort);
  if (viewPort[2]!=imgSize[0] || viewPort[3]!=imgSize[1] || !image)
  {
    imgSize[0] = viewPort[2];
    imgSize[1] = viewPort[3];
    //delete[] image;
    //image = new unsigned char[imgSize[0] * imgSize[1] * 4];
    _stingRay->setImageSize(imgSize[0], imgSize[1]);
    cerr << "New image size: " << imgSize[0] << " x " << imgSize[1] << endl;
  }
  image = _stingRay->renderVolume();

  // Save and set viewing matrix states:
  glMatrixMode(GL_PROJECTION);
  glPushMatrix();
  glLoadIdentity();
  glOrtho(-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f);
  glMatrixMode(GL_MODELVIEW);
  glPushMatrix();
  glLoadIdentity();

  // Store raster position:
  glGetFloatv(GL_CURRENT_RASTER_POSITION, glsRasterPos);

  // Draw stingray image:
  glRasterPos2f(-1.0f,-1.0f);                     // pixmap origin is bottom left corner of output window
  glDrawPixels(viewPort[2], viewPort[3], GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)image);

  // Restore raster position:
  glRasterPos4fv(glsRasterPos);

  // Restore matrix states:
  glPopMatrix();
  glMatrixMode(GL_PROJECTION);
  glPopMatrix();
  glMatrixMode(GL_MODELVIEW);

  /**************************************************************************
   * This function can be used with a definition of
   * setBoundingBox( const double boxWidth, boxHeight, boxDepth )
   **************************************************************************/
  // _stingRay->setBoundingBox()

  /**************************************************************************
   * This function can be used with a definition of
   * setInterpolationType( teInterpolationType eInterpolationType )
   * either F_LINEAR of F_NEAREST_NEIGHBOR
   **************************************************************************/
  // _stingRay->setInterpolationType( fvStingRayCaveRenderer::F_LINEAR )

  vvRenderer::renderVolumeGL();

  _lastRenderTime = sw->getTime();

  unsetGLenvironment();
}
Ejemplo n.º 4
0
Archivo: g_render.c Proyecto: aosm/X11
void __glXDisp_RasterPos4fv(GLbyte *pc)
{
	glRasterPos4fv( 
		(GLfloat  *)(pc + 0)
	);
}