| |
|
|
Sven Bader | from one this uralten Examples of opengl.org have I something to Profan Translated and it additional yet Texturkoordinaten missed - there were it with so one complex Objekt sure several Approaches.
Download
in the Contrast to the internen OpenGL Objects, ought to the Torus in each drop before me StartList/Endlist stored and DrawList abgerufen go.
Similar How with the bullet (Sphere) can The Segmente in two Dimensionen dial, additional can the inside- and Außenradius indicated go.
to that better understanding, a korrekte Textur must vaguely so aufgebaut his
here only The function self:
Proc Torus
Parameters majorRadius!, minorRadius!, numMajor%, numMinor%
Declare majorStep!, minorStep!
Declare a0!,a1!,x0!,y0!,x1!,y1!,b!,c!,r!,z!,loop2&
majorStep! = 2.0*Pi() / numMajor%
minorStep! = 2.0*Pi() / numMinor%
WhileLoop 0, numMajor% - 1
a0! = &loop * majorStep!
a1! = a0! + majorStep!
x0! = cos(a0!)
y0! = sin(a0!)
x1! = cos(a1!)
y1! = sin(a1!)
loop2& = &loop
oGL("glBegin", ~GL_TRIANGLE_STRIP)
WhileLoop 0, numMinor%
b! = &loop * minorStep!
c! = cos(b!)
r! = minorRadius! * c! + majorRadius!
z! = minorRadius! * sin(b!)
oGL("glNormal3f", x0!*c!, y0!*c!, z!/minorRadius!)
oGL("glTexCoord2f", loop2& / numMajor%, &loop / numMinor%)
oGL("glVertex3f", x0!*r!, y0!*r!, z!)
oGL("glNormal3f", x1!*c!, y1!*c!, z!/minorRadius!)
oGL("glTexCoord2f", (loop2& + 1) / numMajor%, &loop / numMinor%)
oGL("glVertex3f", x1!*r!, y1!*r!, z!)
EndWhile
oGL("glEnd")
EndWhile
Endproc
|
|
|
| |
|
|