// Initialize the window for rendering.
void vtkOSMesaRenderWindow::WindowInitialize (void)
{
  TraceBegin("vtkOSMesaRenderWindow::WindowInitialize");

  int width = this->Size[0];
  int height = this->Size[1];
  this->DoubleBuffer = 0;
  if (!this->Internal->OffScreenWindow)
    {
    this->Internal->OffScreenWindow = vtkOSMesaCreateWindow(width,height);
    this->Size[0] = width;
    this->Size[1] = height;      
    }    
  this->Internal->OffScreenContextId = OSMesaCreateContext(GL_RGBA, NULL);

  this->MakeCurrent();
  this->Mapped = 0;

  // tell our renderers about us
  vtkRenderer* ren;
  for (this->Renderers->InitTraversal(); 
       (ren = this->Renderers->GetNextItem());)
    {
    ren->SetRenderWindow(0);
    ren->SetRenderWindow(this);
    }

  this->OpenGLInit();
  glAlphaFunc(GL_GREATER,0);

  TraceEnd("vtkOSMesaRenderWindow::WindowInitialize");
}
vtkOSMesaRenderWindow::vtkOSMesaRenderWindow() : vtkMesaRenderWindow()
{
  TraceInit();
  TraceBegin("vtkOSMesaRenderWindow::vtkOSMesaRenderWindow");
  this->Internal = new vtkOSMesaRenderWindowInternal;
  TraceEnd("vtkOSMesaRenderWindow::vtkOSMesaRenderWindow");
}
void *vtkOSMesaCreateWindow(int width, int height) 
{
  TraceBegin("vtkOSMesaCreateWindow");
  void *retval = malloc(width*height*4);
  TraceEnd("vtkOSMesaCreateWindow");
  return retval;
}
// End the rendering process and display the image.
void vtkOSMesaRenderWindow::Frame(void)
{
    TraceBegin("vtkOSMesaRenderWindow::Frame");

  this->MakeCurrent();
  glFlush();

    TraceEnd("vtkOSMesaRenderWindow::Frame");
}
Beispiel #5
0
void CTraceNdb::closeSchemaTransaction(CTraceNdbSchemaCon* aSchemaCon)
{
  Ndb::closeSchemaTransaction(aSchemaCon);
  TraceBegin();
  TraceNdb(this);
  TraceMethod("closeSchemaTransaction");
  TraceReturn();
  TraceVoid();
  TraceEnd();
}
// free up memory & close the window
vtkOSMesaRenderWindow::~vtkOSMesaRenderWindow()
{
  TraceBegin("vtkOSMesaRenderWindow::~vtkOSMesaRenderWindow");
  // close-down all system-specific drawing resources
  this->Finalize();

  delete this->Internal;

  TraceEnd("vtkOSMesaRenderWindow::~vtkOSMesaRenderWindow");
  TraceFinalize();
}
Beispiel #7
0
void CTraceNdb::closeTransaction(CTraceNdbConnection* aConnection)
{
  Ndb::closeTransaction(aConnection);
  TraceBegin();
  TraceNdb(this);
  TraceMethod("closeTransaction");
  TraceNdbConnection(aConnection);
  TraceReturn();
  TraceVoid();
  TraceEnd();
}
Beispiel #8
0
int CTraceNdbOperation::readTupleExclusive()
{
  int i = NdbOperation::readTupleExclusive();
  TraceBegin();
  TraceNdbOperation(this);
  TraceMethod("readTupleExclusive");
  TraceReturn();
  TraceInt(i);
  TraceEnd();
  return i;
}
Beispiel #9
0
int CTraceNdbSchemaCon::execute()
{
  int i = NdbSchemaCon::execute();
  TraceBegin();
  TraceNdbSchemaCon(this);
  TraceMethod("execute");
  TraceReturn();
  TraceInt(i);
  TraceEnd();
  return i;
}
Beispiel #10
0
const NdbError & CTraceNdbConnection::getNdbError(void) const
{
  const NdbError& err = NdbConnection::getNdbError();
  TraceBegin();
  TraceNdbConnection(this);
  TraceMethod("getNdbError");
  TraceReturn();
  TraceNdbError(err);
  TraceEnd();
  return err;
}
Beispiel #11
0
Uint32 CTraceNdbRecAttr::u_32_value()
{
  Uint32 n = NdbRecAttr::u_32_value();
  TraceBegin();
  TraceNdbRecAttr(this);
  TraceMethod("u_32_value");
  TraceReturn();
  TraceUint32(n);
  TraceEnd();
  return n;
}
Beispiel #12
0
int CTraceNdbOperation::interpretedUpdateTuple()
{
  int i = NdbOperation::interpretedUpdateTuple();
  TraceBegin();
  TraceNdbOperation(this);
  TraceMethod("interpretedUpdateTuple");
  TraceReturn();
  TraceInt(i);
  TraceEnd();
  return i;
}
Beispiel #13
0
CTraceNdbSchemaOp* CTraceNdbSchemaCon::getNdbSchemaOp()
{ 
  NdbSchemaOp* pNdbSchemaOp = NdbSchemaCon::getNdbSchemaOp();
  TraceBegin();
  TraceNdbSchemaCon(this);
  TraceMethod("getNdbSchemaOp");
  TraceReturn();
  TraceNdbSchemaOp(pNdbSchemaOp);
  TraceEnd();
  return (CTraceNdbSchemaOp*)pNdbSchemaOp; 
}
Beispiel #14
0
CTraceNdb::CTraceNdb(const char* aDataBase)
: Ndb(aDataBase) 
{
  TraceBegin();
  TraceNdb(this);
  TraceMethod("Ndb");
  TraceString(aDataBase);
  TraceReturn();
  TraceVoid();
  TraceEnd();
}
Beispiel #15
0
CTraceNdbConnection* CTraceNdb::startTransaction()
{ 
  NdbConnection* pNdbConnection = Ndb::startTransaction();
  TraceBegin();
  TraceNdb(this);
  TraceMethod("startTransaction");
  TraceReturn();
  TraceNdbConnection(pNdbConnection);
  TraceEnd();
  return (CTraceNdbConnection*)pNdbConnection;
}
Beispiel #16
0
int CTraceNdbOperation::deleteTuple()
{
  int i = NdbOperation::deleteTuple();
  TraceBegin();
  TraceNdbOperation(this);
  TraceMethod("deleteTuple");
  TraceReturn();
  TraceInt(i);
  TraceEnd();
  return i;
}
Beispiel #17
0
CTraceNdbRecAttr* CTraceNdbIndexOperation::getValue(const char* anAttrName)
{
  NdbRecAttr* pNdbRecAttr = NdbIndexOperation::getValue(anAttrName);
  TraceBegin();
  TraceNdbIndexOperation(this);
  TraceMethod("getValue");
  TraceString(anAttrName);
  TraceReturn();
  TraceNdbRecAttr(pNdbRecAttr);
  TraceEnd();
  return (CTraceNdbRecAttr*)pNdbRecAttr;
}
Beispiel #18
0
int CTraceNdbConnection::execute(ExecType aTypeOfExec)
{
  int i = NdbConnection::execute(aTypeOfExec);
  TraceBegin();
  TraceNdbConnection(this);
  TraceMethod("execute");
  TraceExecType(aTypeOfExec);
  TraceReturn();
  TraceInt(i);
  TraceEnd();
  return i;
}
Beispiel #19
0
int CTraceNdbSchemaOp::createTable(const char* aTableName)
{
  int i = NdbSchemaOp::createTable(aTableName);
  TraceBegin();
  TraceNdbSchemaOp(this);
  TraceMethod("createTable");
  TraceString(aTableName);
  TraceReturn();
  TraceInt(i);
  TraceEnd();
  return i;
}
Beispiel #20
0
CTraceNdbOperation* CTraceNdbConnection::getNdbOperation(const char* aTableName)
{
  NdbOperation* pNdbOperation = NdbConnection::getNdbOperation(aTableName);
  TraceBegin();
  TraceNdbConnection(this);
  TraceMethod("getNdbOperation");
  TraceString(aTableName);
  TraceReturn();
  TraceNdbOperation(pNdbOperation);
  TraceEnd();
  return (CTraceNdbOperation*)pNdbOperation; 
}
Beispiel #21
0
int CTraceNdbIndexOperation::incValue(const char* anAttrName, Uint32 aValue)
{
  int i = NdbIndexOperation::incValue(anAttrName, aValue);
  TraceBegin();
  TraceNdbIndexOperation(this);
  TraceMethod("incValue");
  TraceString(anAttrName);
  TraceUint32(aValue);
  TraceReturn();
  TraceInt(i);
  TraceEnd();
  return i;
}
Beispiel #22
0
int CTraceNdbOperation::equal(const char* anAttrName, Uint32 aValue)
{
  int i = NdbOperation::equal(anAttrName, aValue);
  TraceBegin();
  TraceNdbOperation(this);
  TraceMethod("equal");
  TraceString(anAttrName);
  TraceUint32(aValue);
  TraceReturn();
  TraceInt(i);
  TraceEnd();
  return i;
}
Beispiel #23
0
int CTraceNdbSchemaOp::createAttribute(const char* aAttrName, KeyType aTupleyKey)
{
  int i = NdbSchemaOp::createAttribute(aAttrName, aTupleyKey);
  TraceBegin();
  TraceNdbSchemaOp(this);
  TraceMethod("createAttribute");
  TraceString(aAttrName);
  TraceKeyType(aTupleyKey);
  TraceReturn();
  TraceInt(i);
  TraceEnd();
  return i;
}
// Resize the window.
void
vtkOSMesaRenderWindow::WindowRemap(void)
{
  TraceBegin("vtkOSMesaRenderWindow::WindowRemap");

  // shut everything down
  this->Finalize();

  // set everything up again 
  this->Initialize();

  TraceEnd("vtkOSMesaRenderWindow::WindowRemap");
}
// Begin the rendering process.
void vtkOSMesaRenderWindow::Start(void)
{
  TraceBegin("vtkOSMesaRenderWindow::Start");

  // if the renderer has not been initialized, do so now
  if (!this->Internal->OffScreenContextId)
    {
    this->Initialize();
    }

  // set the current window 
  this->MakeCurrent();

  TraceEnd("vtkOSMesaRenderWindow::Start");
}
// Initialize the rendering window.
void vtkOSMesaRenderWindow::Initialize (void)
{
  TraceBegin("vtkOSMesaRenderWindow::Initialize");
  // make sure we havent already been initialized 

  if (this->Internal->OffScreenContextId)
    {
    TraceEnd("vtkOSMesaRenderWindow::Initialize");
    return;
    }

  // now initialize the window 
  this->WindowInitialize();

  TraceEnd("vtkOSMesaRenderWindow::Initialize");
}
void vtkOSMesaRenderWindow::MakeCurrent()
{
  TraceBegin("vtkOSMesaRenderWindow::MakeCurrent");

  if (this->Internal->OffScreenContextId) 
    {
    if (OSMesaMakeCurrent(this->Internal->OffScreenContextId, 
                          this->Internal->OffScreenWindow, GL_UNSIGNED_BYTE, 
                          this->Size[0], this->Size[1]) != GL_TRUE) 
      {
      vtkWarningMacro("failed call to OSMesaMakeCurrent");
      }
    }

  TraceEnd("vtkOSMesaRenderWindow::MakeCurrent");
}
// Specify the size of the rendering window.
void vtkOSMesaRenderWindow::SetSize(int x,int y)
{
  TraceBegin("vtkOSMesaRenderWindow::SetSize");

  if ((this->Size[0] != x)||(this->Size[1] != y))
    {
    this->Modified();
    this->Size[0] = x;
    this->Size[1] = y;
    }

  if (this->Internal->OffScreenWindow)
    {
    vtkRenderer *ren;
    // Disconnect renderers from this render window.
    vtkRendererCollection *renderers = this->Renderers;
    renderers->Register(this);
    this->Renderers->Delete();
    this->Renderers = vtkRendererCollection::New();
    renderers->InitTraversal();
    while ( (ren = renderers->GetNextItem()) )
      {
      ren->SetRenderWindow(NULL);
      }
    
    // Destroy the offscreen context and memory
    OSMesaDestroyContext(this->Internal->OffScreenContextId);
    this->Internal->OffScreenContextId = NULL;
    vtkOSMesaDestroyWindow(this->Internal->OffScreenWindow);
    this->Internal->OffScreenWindow = NULL;
    // Recreate the offscreen context and memory
    this->WindowInitialize();
    
    // Add the renders back into the render window.
    renderers->InitTraversal();
    while ( (ren = renderers->GetNextItem()) )
      {
      this->AddRenderer(ren);
      }
    renderers->Delete();
    }

  TraceEnd("vtkOSMesaRenderWindow::SetSize");
}
void vtkOSMesaRenderWindow::SetWindowInfo(char*)
{
    TraceBegin("vtkOSMesaRenderWindow::SetWindowInfo");
}
void vtkOSMesaRenderWindow::Finalize (void)
{
  vtkRenderer *ren;
  GLuint id;
  short cur_light;
   
  TraceBegin("vtkOSMesaRenderWindow::Finalize");

  // make sure we have been initialized 
  if (this->Internal->OffScreenContextId)
    {
    this->MakeCurrent();

    // tell each of the renderers that this render window/graphics context
    // is being removed (the RendererCollection is removed by vtkRenderWindow's
    // destructor)
    this->Renderers->InitTraversal();
    for ( ren = vtkMesaRenderer::SafeDownCast(this->Renderers->GetNextItemAsObject());
          ren != NULL;
          ren = vtkMesaRenderer::SafeDownCast(this->Renderers->GetNextItemAsObject())  )
      {
      ren->SetRenderWindow(NULL);
      }
        
    /* first delete all the old lights */
    for (cur_light = GL_LIGHT0; cur_light < GL_LIGHT0+MAX_LIGHTS; cur_light++)
      {
      glDisable((GLenum)cur_light);
      }

    /* now delete all textures */
    glDisable(GL_TEXTURE_2D);
    for (int i = 1; i < this->TextureResourceIds->GetNumberOfIds(); i++)
      {
      id = (GLuint) this->TextureResourceIds->GetId(i);
#ifdef GL_VERSION_1_1
      if (glIsTexture(id))
        {
        glDeleteTextures(1, &id);
        }
#else
      if (glIsList(id))
        {
        glDeleteLists(id,1);
        }
#endif
      }

    glFinish();

    if (this->Internal->OffScreenContextId)
      {
      OSMesaDestroyContext(this->Internal->OffScreenContextId);
      this->Internal->OffScreenContextId = NULL;
      vtkOSMesaDestroyWindow(this->Internal->OffScreenWindow);
      this->Internal->OffScreenWindow = NULL;
      }
    }

  TraceEnd("vtkOSMesaRenderWindow::Finalize");
}