Jump to content

Torus and some light


trancexx
 Share

Recommended Posts

Script:

Attached File Torus3.zip (3.91K)

Thank you for Toros. It's fine.

This replacement of _GLDraw() creates a dark-side object.

; Drawing function
Func _GLDraw()
local $R = 0.3

    $nM += 1 ; Speed
    If $nM > 360 Then $nM = 0

    _glClear(BitOR($GL_COLOR_BUFFER_BIT, $GL_DEPTH_BUFFER_BIT)) ; Clean buffers
    _glClearColor(0.0, 0.0, 0.0, 1.0) ; Black Background

    _glPushMatrix() ; Copy the current matrix and push it onto the stack

    _glLightfv($GL_LIGHT0, $GL_POSITION, $pLightPosition); Light
    _glRotatef($nM, $nM, $nM, $nM) ; Do some funny spinning
    _glMaterialfv($GL_FRONT, $GL_DIFFUSE, $pMaterialTorus) ; Color the Torus
    _glCallList($TorusDL); Render the Torus

  ; Start Disc
  Disc ($R, 0, 0, 0, $R/2)

    _glPopMatrix() ; Restore the previous Matrix

    _glFlush() ; Flush the buffer

    ; Replace old with the new one
    _SwapBuffers($hDC)

EndFunc   ;==>_GLDraw

Func Disc ($R, $x, $y, $z, $h, $n = 60)
local $GL_QUADS = 0x0007
local $GL_POLYGON = 0x0009
local $i, $fi, $a = 2*3.14/$n
local $dc
local $d[61], $x1[61], $y1[61], $p1, $q1, $p2, $q2, $z1, $z2

  $z1 = $z+$h
  $z2 = $z-$h
  _glBegin($GL_POLYGON)
  For $i = 0 to $n
   $fi = (2*$i-1)*$a + $a/2
   $x1[$i] = $R*Cos($fi)+$x
   $y1[$i] = $R*Sin($fi)+$y
   _glVertex3f($x1[$i], $y1[$i], $z1)
  Next
  _glEnd();

  _glBegin($GL_POLYGON)
  For $i = 0 to $n
   _glVertex3f($x1[$i], $y1[$i], $z2)
  Next
  _glEnd();

  For $i = 0 to $n
   _glBegin($GL_QUADS)
   $dc = 0.7*$d[$i] + 0.3
   $p1 = $x1[$i]
   $q1 = $y1[$i]
   if $i = $n then 
    $p2 = $x1[0]
    $q2 = $y1[0]
   else
    $p2 = $x1[$i+1]
    $q2 = $y1[$i+1]
   endif
   _glVertex3f($p1, $q1, $z1)
   _glVertex3f($p2, $q2, $z1)
   _glVertex3f($p2, $q2, $z2)
   _glVertex3f($p1, $q1, $z2)
   _glEnd()
  Next

Endfunc

Is your Misc object a part of the LHC-2010 (THE LARGE HADRON COLLIDER)?

;)

The point of world view

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...