void OSGDrawingArea::on_realize ()
{
#ifdef DEBUG
    std::cout <<"void OSGDrawingArea::on_realize ()<<"<< std::endl;
#endif
    Gtk::DrawingArea::on_realize ();

    //
    // Init glew.
    /*klGLEW::instance ()->init ();
    if (klGLEW::instance ()->isInitialized ())
        KDBG_OUT ("", "GLEW init() succesfully");
    else
        KDBG_OUT ("", "GLEW init() failed!");*/


    if (!beginGL ())
        return;

    onRealize ();

    endGL ();
#ifdef DEBUG
    std::cout <<"void OSGDrawingArea::on_realize ()>>"<< std::endl;
#endif
}
Пример #2
0
// ---------------------------------------------------------------------------
void X11WindowImpl::destroyGLFont()
{
  if (beginGL()) {
    glDeleteLists(font.listBase + font.firstGlyph, font.nglyph);
    delete [] font.widths;  
    endGL();
  }
}
Пример #3
0
// ---------------------------------------------------------------------------
void X11WindowImpl::initGLFont()
{
  if (beginGL()) {
    font.nglyph     = GL_BITMAP_FONT_COUNT;
    font.firstGlyph = GL_BITMAP_FONT_FIRST_GLYPH;
    GLuint listBase = glGenLists(font.nglyph);
    font.listBase   = listBase - font.firstGlyph;
    glXUseXFont(factory->xfont, font.firstGlyph, font.nglyph, listBase);

    font.widths = new unsigned int[font.nglyph];

    for(unsigned int i=0;i<font.nglyph;i++)
      font.widths[i] = 9;
    endGL();  // Should this be added?
  }
}
void OSGDrawingArea::onResizeInternal (Gtk::Allocation& pAllocation)
{
#ifdef DEBUG
    //??std::cout <<"void OSGDrawingArea::onResizeInternal (Gtk::Allocation& pAllocation)<<"<< std::endl;
#endif // DEBUG

    if (!is_realized ())
        return;

    if (!beginGL ())
        return;

    onResize (pAllocation);

    endGL ();

#ifdef DEBUG
    //??std::cout <<"void OSGDrawingArea::onResizeInternal (Gtk::Allocation& pAllocation)>>"<< std::endl;
#endif // DEBUG
}
bool OSGDrawingArea::on_configure_event (GdkEventConfigure* pEvent)
{
#ifdef DEBUG
    //??std::cout <<"bool OSGDrawingArea::on_configure_event (GdkEventConfigure* pEvent)<<"<< std::endl;
#endif

    bool lRetVal = Gtk::DrawingArea::on_configure_event (pEvent);

    if (!beginGL ())
        return lRetVal;

    onConfigure (pEvent);

    endGL ();

#ifdef DEBUG
    //??std::cout <<"bool OSGDrawingArea::on_configure_event (GdkEventConfigure* pEvent)>>"<< std::endl;
#endif
    return lRetVal;
}
Пример #6
0
   void initGLBitmapFont(u8 firstGlyph, u8 lastGlyph) {
 
     beginGL();
 
     SelectObject (dcHandle, GetStockObject (SYSTEM_FONT) ); 
 
     font.nglyph     = lastGlyph-firstGlyph+1;
 
     font.widths     = new unsigned int [font.nglyph];
 
     GLuint listBase = glGenLists(font.nglyph);
 
     font.firstGlyph = firstGlyph;
     font.listBase   = listBase - firstGlyph;
 
     GetCharWidth32( dcHandle, font.firstGlyph, lastGlyph,  (LPINT) font.widths );
 
     wglUseFontBitmaps(dcHandle, font.firstGlyph, font.nglyph, listBase);
 
     endGL();
   }
bool OSGDrawingArea::on_expose_event (GdkEventExpose* pEvent)
{
#ifdef DEBUG
    //??std::cout <<"bool OSGDrawingArea::on_expose_event (GdkEventExpose* pEvent)<<"<< std::endl;
#endif // DEBUG

    bool lRetVal = Gtk::DrawingArea::on_expose_event (pEvent);

    if (!beginGL())
        return lRetVal;

    onExpose (pEvent);

    swapBuffers ();

    endGL ();

#ifdef DEBUG
    //??std::cout <<"bool OSGDrawingArea::on_expose_event (GdkEventExpose* pEvent)>>"<< std::endl;
#endif // DEBUG

    return lRetVal;
}
Пример #8
0
 void destroyGLFont(void) {
   beginGL();
   glDeleteLists( font.listBase + font.firstGlyph, font.nglyph);
   delete [] font.widths;
   endGL();
 }