//=======================================================================
//@V@:Note: This file generated by vgen V1.00 (10:45:42 AM 12 Sep 1996).
//	tglcnv.cpp:	Source for testGLCanvasPane class
//=======================================================================

#include "tglcnv.h"

  static int initDone = 0;

//===================>>> testGLCanvasPane::testGLCanvasPane <<<====================
  testGLCanvasPane::testGLCanvasPane()
  {
  }

//===================>>> testGLCanvasPane::~testGLCanvasPane <<<====================
  testGLCanvasPane::~testGLCanvasPane()
  {
  }

//==================>>> testGLCanvasPane::graphicsInit <<<========================
  void testGLCanvasPane::graphicsInit(void)
  {
    vBaseGLCanvasPane::graphicsInit();	// Always call the superclass first!

    glEnable(GL_DEPTH_TEST);
    glClearDepth(1.0);
    glClearColor(0.0, 0.0, 0.0, 0.0);  /* clear to black */
    glMatrixMode(GL_PROJECTION);
    gluPerspective(40.0, 1.0, 10.0, 200.0);
    glMatrixMode(GL_MODELVIEW);
    glTranslatef(0.0, 0.0, -50.0);
    glRotatef(-58.0, 0.0, 1.0, 0.0);

    initDone = 1;
  }

//======================>>> testGLCanvasPane::Spin <<<========================
  void testGLCanvasPane::Spin()
  {
    vglMakeCurrent();
    glRotatef(2.5, 1.0, 0.0, 0.0);
    Redraw(0,0,0,0);
  }

//======================>>> testGLCanvasPane::HPage <<<========================
  void testGLCanvasPane::HPage(int shown, int top)
  {
    vBaseGLCanvasPane::HPage(shown, top);
  }

//======================>>> testGLCanvasPane::VPage <<<========================
  void testGLCanvasPane::VPage(int shown, int top)
  {
    vBaseGLCanvasPane::VPage(shown, top);
  }

//=======================>>> testGLCanvasPane::HScroll <<<======================
  void testGLCanvasPane::HScroll(int step)
  {
    vBaseGLCanvasPane::HScroll(step);
  }

//======================>>> testGLCanvasPane::VScroll <<<======================
  void testGLCanvasPane::VScroll(int step)
  {
    vBaseGLCanvasPane::VScroll(step);
  }

//======================>>> testGLCanvasPane::MouseDown <<<======================
  void testGLCanvasPane::MouseDown(int X, int Y, int button)
  {
    vBaseGLCanvasPane::MouseDown(X,Y,button);
  }

//========================>>> testGLCanvasPane::MouseUp <<<======================
  void testGLCanvasPane::MouseUp(int X, int Y, int button)
  {
    vBaseGLCanvasPane::MouseUp(X,Y,button);
  }

//======================>>> testGLCanvasPane::MouseMove <<<======================
  void testGLCanvasPane::MouseMove(int x, int y, int button)
  {
    vBaseGLCanvasPane::MouseMove(x,y,button);
  }

//=========================>>> testGLCanvasPane::Redraw <<<======================
  void testGLCanvasPane::Redraw(int x, int y, int w, int h)
  {
    static int inRedraw = 0;

    if (inRedraw || !initDone)	// Don't draw until initialized
 	return;

    inRedraw = 1;		// Don't allow recursive redraws.

    vglMakeCurrent();

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glBegin(GL_POLYGON);
    glColor3f(0.0, 0.0, 0.0);
    glVertex3f(-10.0, -10.0, 0.0);
    glColor3f(0.7, 0.7, 0.7);
    glVertex3f(10.0, -10.0, 0.0);
    glColor3f(1.0, 1.0, 1.0);
    glVertex3f(-10.0, 10.0, 0.0);
    glEnd();

    glBegin(GL_POLYGON);
    glColor3f(1.0, 1.0, 0.0);
    glVertex3f(0.0, -10.0, -10.0);
    glColor3f(0.0, 1.0, 0.7);
    glVertex3f(0.0, -10.0, 10.0);
    glColor3f(0.0, 0.0, 1.0);
    glVertex3f(0.0, 5.0, -10.0);
    glEnd();

    glBegin(GL_POLYGON);
    glColor3f(1.0, 1.0, 0.0);
    glVertex3f(-10.0, 6.0, 4.0);
    glColor3f(1.0, 0.0, 1.0);
    glVertex3f(-10.0, 3.0, 4.0);
    glColor3f(0.0, 0.0, 1.0);
    glVertex3f(4.0, -9.0, -10.0);
    glColor3f(1.0, 0.0, 1.0);
    glVertex3f(4.0, -6.0, -10.0);
    glEnd();

    vglFlush();

    inRedraw = 0;

  }

//======================>>> testGLCanvasPane::Resize <<<======================
  void testGLCanvasPane::Resize(int w, int h)
  {
    vBaseGLCanvasPane::Resize(w,h);
  }
