(Gast)
n/a Beiträge
|
Re: wieder konvertierungs problem
21. Mär 2007, 18:44
Zitat von shmia:
Oder ganz elegant als Einzeiler:
meterlphi := Max(Min(meterlphi, 128.0), 0.0);
Das kommt der IIF anweisung in VB am nächsten
Nur so nebenbei.
Habe noch ein problem bei der For Schleife
Hier mal die Schleife in C++
Code:
for (lphi=0.0f; lphi<=189.0f; lphi+=13.5f)
{
z=-9.0f;
x=(float)(-sin((lphi+45.0f)*M_PI/180.0f)*2.0f)-2.5f;
y=(float)(-cos((lphi+45.0f)*M_PI/180.0f)*2.0f)+yposition;
glTexCoord2f(0.0f,0.0f); glVertex3f(x-hd,y-hd,z);
glTexCoord2f(0.0f,1.0f); glVertex3f(x-hd,y+hd,z);
glTexCoord2f(1.0f,1.0f); glVertex3f(x+hd,y+hd,z);
glTexCoord2f(1.0f,0.0f); glVertex3f(x+hd,y-hd,z);
x+=5.0f;
glTexCoord2f(0.0f,0.0f); glVertex3f(x-hd,y-hd,z);
glTexCoord2f(0.0f,1.0f); glVertex3f(x-hd,y+hd,z);
glTexCoord2f(1.0f,1.0f); glVertex3f(x+hd,y+hd,z);
glTexCoord2f(1.0f,0.0f); glVertex3f(x+hd,y-hd,z);
}
Delphi-Quellcode:
Var
lphi : GLfloat;
rphi : GLfloat;
Delphi-Quellcode:
for lphi := 0.0 to 189.0 do lphi := lphi + 13.5;
begin
z := -9.0;
x := (-sin((lphi+45.0)*M_PI/180.0)*2.0)-2.5;
y := (-cos((lphi+45.0)*M_PI/180.0)*2.0)+yposition;
glTexCoord2f(0.0,0.0); glVertex3f(x-hd,y-hd,z);
glTexCoord2f(0.0,1.0); glVertex3f(x-hd,y+hd,z);
glTexCoord2f(1.0,1.0); glVertex3f(x+hd,y+hd,z);
glTexCoord2f(1.0,0.0); glVertex3f(x+hd,y-hd,z);
x := 5.0;
glTexCoord2f(0.0,0.0); glVertex3f(x-hd,y-hd,z);
glTexCoord2f(0.0,1.0); glVertex3f(x-hd,y+hd,z);
glTexCoord2f(1.0,1.0); glVertex3f(x+hd,y+hd,z);
glTexCoord2f(1.0,0.0); glVertex3f(x+hd,y-hd,z);
end;
jetzt meckert der compiler über diese zeile
for lphi := 0.0 to 189.0 do
Zitat:
[Pascal Error] VisCDRom.pas(775): E2032 For loop control variable must have ordinal type
Ich benötige aber die Variablen als GLfloat
Es muss doch möglich sein in einer schleife GLFloat zu verarbeiten.!
Hier sagt er
lphi := lphi + 13.5;
Zitat:
[Pascal Hint] VisCDRom.pas(775): H2135 FOR or WHILE loop executes zero times - deleted
Gruss Emil
|