Exemplo n.º 1
0
//---------------------------------------------------------------------------
void __fastcall TGLForm2D::FormCreate(TObject *Sender)
{
    hdc = GetDC(Handle);
    SetPixelFormatDescriptor();
    hrc = wglCreateContext(hdc);
    if(hrc == NULL)
    	ShowMessage(":-)~ hrc == NULL");
    if(wglMakeCurrent(hdc, hrc) == false)
    	ShowMessage("Could not MakeCurrent");
    //Cor de fondo de la ventana
    glClearColor(1.0f, 1.0f, 1.0f, 1.0f);

    //inicialización del volumen de vista
    xRight=200.0; xLeft=-xRight;
    yTop=xRight; yBot=-yTop;
    //Radio del volumen de vista == 1

    //inicialización del puerto de vista
    //ClientWidth=400;
    //ClientHeight=400;
    RatioViewPort=1.0;
    sc = new Escena(xLeft,xRight,yTop,yBot);
    aleatorio = false;
    seleccionar = false;
    embaldosa = false;
    Caption = "Arbol Fractal de Pitagoras";

    // inicialización de las variables del programa
}
Exemplo n.º 2
0
//---------------------------------------------------------------------------
void __fastcall TGLForm2D::FormCreate(TObject *Sender)
{
    hdc = GetDC(Handle);
    SetPixelFormatDescriptor();
    hrc = wglCreateContext(hdc);
    if(hrc == NULL)
    	ShowMessage(":-)~ hrc == NULL");
    if(wglMakeCurrent(hdc, hrc) == false)
    	ShowMessage("Could not MakeCurrent");

    this->SetName("Pactica2");
    this->Caption=this->Name+"-Pelota";

    //Color de fondo de la ventana
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

    //inicialización del volumen de vista
    zoom=1;

    //inicialización del puerto de vista
    //ClientWidth=400;
    //ClientHeight=400;

    selection=0;
    pelota= list<Ball>();

    obstacle= list<Obstacle*>();
    obstacle.push_back( new Circle(Vector(50,-30), 20) );
    obstacle.push_back( new Circle(Vector(-10,25), 25) );
   //ostacle.push_back( new Triangle(Vector(30,-30),Vector(100,60),Vector(-10,20)) );
   obstacle.push_back( new Triangle(Vector(-20,-20),Vector(250, 5), Vector(100,60)) );
}
Exemplo n.º 3
0
//---------------------------------------------------------------------------
void __fastcall TGLForm2D::FormCreate(TObject *Sender)
{
    hdc = GetDC(Handle);
    SetPixelFormatDescriptor();
    hrc = wglCreateContext(hdc);
    if(hrc == NULL)
    	ShowMessage(":-)~ hrc == NULL");
    if(wglMakeCurrent(hdc, hrc) == false)
    	ShowMessage("Could not MakeCurrent");
    //Cor de fondo de la ventana
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

    //inicialización del volumen de vista
    xRight=400.0; xLeft=-xRight;
    yTop=250; yBot=-yTop;
    //Radio del volumen de vista == 1

    //inicialización del puerto de vista
    //ClientWidth=400;
    //ClientHeight=400;
    RatioViewPort=1.0;

    // inicialización de las variables del programa
    tR = new Triangle(PV2D(xRight-30, yTop+20), PV2D(xRight-30, yBot-20), PV2D(xRight+300, yBot-20));
    tT = new Triangle(PV2D(xLeft-20, yTop-30), PV2D(xRight+20, yTop-30), PV2D(xRight+20, yTop+450));
    tL = new Triangle(PV2D(xLeft+30, yBot-20), PV2D(xLeft+30, yTop+20), PV2D(xLeft-300, yTop+20));
    tB = new Triangle(PV2D(xRight+20, yBot+30), PV2D(xLeft-20, yBot+30), PV2D(xLeft-20, yBot-450));

    t1 = new Triangle(PV2D(200, 0), PV2D(200, 200), PV2D(160, 160));
    t2 = new Triangle(PV2D(-250, 0), PV2D(-250, -150), PV2D(-210, -210));

    c1 = new Circle(PV2D(-200, 80), 30);
    c2 = new Circle(PV2D(250, -90), 30);

    obstacles.push_back(tR);
    obstacles.push_back(tT);
    obstacles.push_back(tL);
    obstacles.push_back(tB);
    obstacles.push_back(t1);
    obstacles.push_back(t2);
    obstacles.push_back(c1);
    obstacles.push_back(c2);

    //Set timer properties
    Timer->Enabled = false;
    Timer->Interval = 1;
}
Exemplo n.º 4
0
//---------------------------------------------------------------------------
void __fastcall TGLForm3D::FormCreate(TObject *Sender) {
  hdc=GetDC(Handle);
  SetPixelFormatDescriptor();
  hrc=wglCreateContext(hdc);
  if(hrc==NULL) ShowMessage("Error CreateContex");
  if(wglMakeCurrent(hdc, hrc)==false) ShowMessage("Error MakeCurrent");

  crearObjetosEscena();
  debug = false;
  normals = false;

  glClearColor(0.6,0.7,0.8,1.0);
  glEnable(GL_LIGHTING);

  glEnable(GL_COLOR_MATERIAL);
  glMaterialf(GL_FRONT, GL_SHININESS, 0.1);
  glEnable(GL_DEPTH_TEST);
  glEnable(GL_NORMALIZE);
  glShadeModel(GL_SMOOTH);   //Defecto

  //Cámara
  eyeX=100.0; eyeY=100.0; eyeZ=100.0;
  lookX=0.0; lookY=0.0; lookZ=0.0;
  upX=0; upY=1; upZ=0;
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  gluLookAt(eyeX, eyeY, eyeZ, lookX, lookY, lookZ, upX, upY, upZ);

  //Volumen de vista
  N=1; F=1000;
  xRight=5; xLeft=-xRight;
  yTop=5; yBot=-yTop;

  //Ratio del volumen de vista =1
  //ClientWidth=400;
  //ClientHeight=400;
  RatioViewPort=1.0;

  //Luz0
  glEnable(GL_LIGHT0);
  GLfloat LuzDifusa[]={1.0,1.0,1.0,1.0};
  glLightfv(GL_LIGHT0, GL_DIFFUSE, LuzDifusa);
  GLfloat LuzAmbiente[]={0.3,0.3,0.3,1.0};
  glLightfv(GL_LIGHT0, GL_AMBIENT, LuzAmbiente);
  GLfloat PosicionLuz0[]={25.0, 25.0, 0.0, 1.0};
  glLightfv(GL_LIGHT0, GL_POSITION, PosicionLuz0);
}
Exemplo n.º 5
0
//---------------------------------------------------------------------------
void __fastcall TFormMain::FormCreate(TObject *Sender)
{
    hdc = GetDC(Handle);
    SetPixelFormatDescriptor();
    hrc = wglCreateContext(hdc);
    if(hrc == NULL)
    	ShowMessage(":-)~ hrc == NULL");
    if(wglMakeCurrent(hdc, hrc) == false)
    	ShowMessage("Could not MakeCurrent");
    w = ClientWidth;
    h = ClientHeight;

    glEnable(GL_DEPTH_TEST);
    glEnable(GL_CULL_FACE);

    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    SetupLighting();
    SetupTextures();
    CreateInpriseCorporateLogo();
}
Exemplo n.º 6
0
//---------------------------------------------------------------------------
void __fastcall TGLForm2D::FormCreate(TObject *Sender)
{
    hdc = GetDC(Handle);
    SetPixelFormatDescriptor();
    hrc = wglCreateContext(hdc);
    if(hrc == NULL)
    	ShowMessage(":-)~ hrc == NULL");
    if(wglMakeCurrent(hdc, hrc) == false)
    	ShowMessage("Could not MakeCurrent");
    //Cor de fondo de la ventana
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    colorLinea1=1;colorLinea2=1;colorLinea3=1;//Lineas blancas
    colorCentro1=0;colorCentro2=0;colorCentro3=1;//Centro AVE azul
    colorGravedad1=1;colorGravedad2=0;colorGravedad3=0;//Centro Gravedad rojo
    grosorCentro=4;
    grosorGravedad=4;
    grosorLinea=1.0;

    oscurecer=false;
    anidamientoTotal=false;
    //inicialización del volumen de vista
    xRight=200.0; xLeft=-xRight;
    yTop=xRight; yBot=-yTop;
    //Radio del volumen de vista == 1

    //inicialización del puerto de vista
    //ClientWidth=400;
    //ClientHeight=400;
    RatioViewPort=1.0;

    // inicialización de las variables del programa
    nTriangulos=1;             //Solo tenemos el triángulo inicial
    mEmbaldosado = false;      //Modo embaldosado a falso
    mDesplazar = false;        //Modo desplazar a falso
    nCol = 1;                  //Variable de número columnas para embaldosar a 1
    nFil = 1;                  //Variable de número filas para embaldosar a 1
}