Einzelnen Beitrag anzeigen

Benutzerbild von Muellermilchtrinker
Muellermilchtrinker

Registriert seit: 1. Aug 2009
447 Beiträge
 
Delphi 2009 Professional
 
#23

AW: Dreidimensionales Array darstellen.

  Alt 24. Aug 2010, 11:32
Und sag, was ist Urlaub!?
Weißt du das nicht??? Man geht da in ein anderes Land/Gebiet/Stadt und entspannt sich dort.

Aber back to topic:

PROBLEM GELÖST
Ich hab das Problem gelöst (ohne gluOrtho2D ). Mir wurde auf DGL geraten diese Zeile:
gluPerspective(45.0, ClientWidth/ClientHeight, NearClipping, FarClipping); durch diese Zeile zu ersetzen:
gluPerspective(45.0, panel1.ClientWidth/panel1.ClientHeight, NearClipping, FarClipping); Und es hat geklappt. Begründung: mit meinem vorherigen Code hab ich alles auf die Formulargröße gesetzt. MIt diesem Code mach ich das auf mein Panel und das ist ja so schön quadratisch. Und jetzt ist mein Würfel ein Würfel.

Weiter gehts:

Ich hab mir jetzt diese Prozedur geschrieben:
Delphi-Quellcode:
procedure TForm1.Cube(Color:Integer);
begin
    if Color <> 0 then glColor4f(0.5, 0.5, 1.0, 0.8) // Set The Color
    else glColor4f(0.3, 0.3, 0.3, 0.4);
      glVertex3f( 1.0, 1.0,-1.0);         // Top Right Of The Quad (Top)
      glVertex3f(-1.0, 1.0,-1.0);         // Top Left Of The Quad (Top)
      glVertex3f(-1.0, 1.0, 1.0);         // Bottom Left Of The Quad (Top)
      glVertex3f( 1.0, 1.0, 1.0);         // Bottom Right Of The Quad (Top)

    if Color <> 0 then glColor4f(0.5, 0.5, 1.0, 0.8) // Set The Color
    else glColor4f(0.3, 0.3, 0.3, 0.4);
      glVertex3f( 1.0,-1.0, 1.0);         // Top Right Of The Quad (Bottom)
      glVertex3f(-1.0,-1.0, 1.0);         // Top Left Of The Quad (Bottom)
      glVertex3f(-1.0,-1.0,-1.0);         // Bottom Left Of The Quad (Bottom)
      glVertex3f( 1.0,-1.0,-1.0);         // Bottom Right Of The Quad (Bottom)

    if Color <> 0 then glColor4f(0.5, 0.5, 1.0, 0.8) // Set The Color
    else glColor4f(0.3, 0.3, 0.3, 0.4);
      glVertex3f( 1.0, 1.0, 1.0);         // Top Right Of The Quad (Front)
      glVertex3f(-1.0, 1.0, 1.0);         // Top Left Of The Quad (Front)
      glVertex3f(-1.0,-1.0, 1.0);         // Bottom Left Of The Quad (Front)
      glVertex3f( 1.0,-1.0, 1.0);         // Bottom Right Of The Quad (Front)

    if Color <> 0 then glColor4f(0.5, 0.5, 1.0, 0.8) // Set The Color
    else glColor4f(0.3, 0.3, 0.3, 0.4);
      glVertex3f( 1.0,-1.0,-1.0);         // Bottom Left Of The Quad (Back)
      glVertex3f(-1.0,-1.0,-1.0);         // Bottom Right Of The Quad (Back)
      glVertex3f(-1.0, 1.0,-1.0);         // Top Right Of The Quad (Back)
      glVertex3f( 1.0, 1.0,-1.0);         // Top Left Of The Quad (Back)

    if Color <> 0 then glColor4f(0.5, 0.5, 1.0, 0.8) // Set The Color
    else glColor4f(0.3, 0.3, 0.3, 0.4);
      glVertex3f(-1.0, 1.0, 1.0);         // Top Right Of The Quad (Left)
      glVertex3f(-1.0, 1.0,-1.0);         // Top Left Of The Quad (Left)
      glVertex3f(-1.0,-1.0,-1.0);         // Bottom Left Of The Quad (Left)
      glVertex3f(-1.0,-1.0, 1.0);         // Bottom Right Of The Quad (Left)

    if Color <> 0 then glColor4f(0.5, 0.5, 1.0, 0.8) // Set The Color
    else glColor4f(0.3, 0.3, 0.3, 0.4);
      glVertex3f( 1.0, 1.0,-1.0);         // Top Right Of The Quad (Right)
      glVertex3f( 1.0, 1.0, 1.0);         // Top Left Of The Quad (Right)
      glVertex3f( 1.0,-1.0, 1.0);         // Bottom Left Of The Quad (Right)
      glVertex3f( 1.0,-1.0,-1.0);         // Bottom Right Of The Quad (Right)
end;
Damit mache ich mein Cube und kann die Farbe beeinflussen. aber das ist ja nur ein Cube. Ich brauch aber mehrere (genau: 125). Wie schaffe ich die Verschiebung (je nach Koordinate)??? Zwischen den Cubes sollte auch ein bisschen Platz sein.
Chuck Norris doesn't need backups. He just uploads his files and lets the world mirror them.
  Mit Zitat antworten Zitat