SlideShare a Scribd company logo
1 of 10
Download to read offline
Ring Documentation, Release 1.7
// Draw Head
glTranslatef(0.0, 1.0, 0.0)
glutSolidSphere(0.25,20,20)
// Draw Eyes
glPushMatrix()
glColor3f(0.0,0.0,0.0)
glTranslatef(0.05, 0.10, 0.18)
glutSolidSphere(0.05,10,10)
glTranslatef(-0.1, 0.0, 0.0)
glutSolidSphere(0.05,10,10)
glPopMatrix()
// Draw Nose
glColor3f(1.0, 0.5 , 0.5)
glRotatef(0.0,1.0, 0.0, 0.0)
glutSolidCone(0.08,0.5,10,2)
func computePos deltaMove
x += deltaMove * lx * 0.1
z += deltaMove * lz * 0.1
func renderScene
if deltaMove
computePos(deltaMove)
ok
// Clear Color and Depth Buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
// Reset transformations
glLoadIdentity()
// Set the camera
gluLookAt( x, 1.0, z,
x+lx, 1.0, z+lz,
0.0, 1.0, 0.0)
// Draw ground
glColor3f(0.9, 0.9, 0.9)
glBegin(GL_QUADS)
glVertex3f(-100.0, 0.0, -100.0)
glVertex3f(-100.0, 0.0, 100.0)
glVertex3f( 100.0, 0.0, 100.0)
glVertex3f( 100.0, 0.0, -100.0)
glEnd()
// Draw 36 SnowMen
for i = -3 to 2
for j=-3 to 2
glPushMatrix()
glTranslatef(i*10.0,0,j * 10.0)
drawSnowMan()
glPopMatrix()
57.11. Mouse Events 562
Ring Documentation, Release 1.7
next
next
glutSwapBuffers()
func processNormalKeys
key = glutEventKey()
if key = 27
shutdown()
ok
func pressKey
key = glutEventKey()
switch key
on GLUT_KEY_UP
deltaMove = 0.5
on GLUT_KEY_DOWN
deltaMove = -0.5
off
func releaseKey
key = glutEventKey()
switch key
on GLUT_KEY_UP
deltaMove = 0
on GLUT_KEY_DOWN
deltaMove = 0
off
func mouseMove
xx = glutEventX()
yy = glutEventY()
// this will only be true when the left button is down
if xOrigin >= 0
// update deltaAngle
deltaAngle = (xx - xOrigin) * 0.001
// update camera's direction
lx = sin(angle + deltaAngle)
lz = -cos(angle + deltaAngle)
ok
func mouseButton
button = glutEventButton()
state = glutEventState()
xx = glutEventX()
yy = glutEventY()
// only start motion if the left button is pressed
57.11. Mouse Events 563
Ring Documentation, Release 1.7
if button = GLUT_LEFT_BUTTON
// when the button is released
if state = GLUT_UP
angle += deltaAngle
xOrigin = -1
else
// state = GLUT_DOWN
xOrigin = xx
ok
fflush(stdout)
ok
func main
// init GLUT and create window
glutInit()
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA)
glutInitWindowPosition(100,100)
glutInitWindowSize(320,320)
glutCreateWindow("RingFreeGLUT - Test 9")
// register callbacks
glutDisplayFunc(:renderScene)
glutReshapeFunc(:changeSize)
glutIdleFunc(:renderScene)
glutIgnoreKeyRepeat(1)
glutKeyboardFunc(:processNormalKeys)
glutSpecialFunc(:pressKey)
glutSpecialUpFunc(:releaseKey)
// here are the two new functions
glutMouseFunc(:mouseButton)
glutMotionFunc(:mouseMove)
// OpenGL init
glEnable(GL_DEPTH_TEST)
// enter GLUT event processing cycle
glutMainLoop()
57.12 Menu Events
Example:
load "freeglut.ring"
load "opengl21lib.ring"
// angle of rotation for the camera direction
angle = 0.0
// actual vector representing the camera's direction
lx=0.0 lz=-1.0
// XZ position of the camera
57.12. Menu Events 564
Ring Documentation, Release 1.7
x=0.0 z=5.0
// the key states. These variables will be zero
//when no key is being presses
deltaAngle = 0.0
deltaMove = 0
xOrigin = -1
// Constant definitions for Menus
// for RingFreeGLUT - We must have different ID for each menu item
C_RED = 1
C_GREEN = 2
C_BLUE = 3
C_ORANGE = 4
C_FILL = 5
C_LINE = 6
C_SHRINK = 7
C_NORMAL = 8
// Pop up menu identifiers
fillMenu= 0
shrinkMenu= 0
mainMenu=0
colorMenu=0
// color for the nose
red = 1.0 blue=0.5 green=0.5
// scale of snowman
scale = 1.0
// menu status
menuFlag = 0
func changeSize
w = glutEventWidth()
h = glutEventHeight()
// Prevent a divide by zero, when window is too short
// (you cant make a window of zero width).
if h = 0
h = 1
ok
ratio = w * 1.0 / h
// Use the Projection Matrix
glMatrixMode(GL_PROJECTION)
// Reset Matrix
glLoadIdentity()
// Set the viewport to be the entire window
glViewport(0, 0, w, h)
57.12. Menu Events 565
Ring Documentation, Release 1.7
// Set the correct perspective.
gluPerspective(45.0, ratio, 0.1, 100.0)
// Get Back to the Modelview
glMatrixMode(GL_MODELVIEW)
func drawSnowMan
glScalef(scale, scale, scale)
glColor3f(1.0, 1.0, 1.0)
// Draw Body
glTranslatef(0.0 ,0.75, 0.0)
glutSolidSphere(0.75,20,20)
// Draw Head
glTranslatef(0.0, 1.0, 0.0)
glutSolidSphere(0.25,20,20)
// Draw Eyes
glPushMatrix()
glColor3f(0.0,0.0,0.0)
glTranslatef(0.05, 0.10, 0.18)
glutSolidSphere(0.05,10,10)
glTranslatef(-0.1, 0.0, 0.0)
glutSolidSphere(0.05,10,10)
glPopMatrix()
// Draw Nose
glColor3f(red, green, blue)
glRotatef(0.0,1.0, 0.0, 0.0)
glutSolidCone(0.08,0.5,10,2)
glColor3f(1.0, 1.0, 1.0)
func computePos deltaMove
x += deltaMove * lx * 0.1
z += deltaMove * lz * 0.1
func renderScene
if deltaMove
computePos(deltaMove)
ok
// Clear Color and Depth Buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
// Reset transformations
glLoadIdentity()
// Set the camera
gluLookAt( x, 1.0, z,
x+lx, 1.0, z+lz,
0.0, 1.0, 0.0)
57.12. Menu Events 566
Ring Documentation, Release 1.7
// Draw ground
glColor3f(0.9, 0.9, 0.9)
glBegin(GL_QUADS)
glVertex3f(-100.0, 0.0, -100.0)
glVertex3f(-100.0, 0.0, 100.0)
glVertex3f( 100.0, 0.0, 100.0)
glVertex3f( 100.0, 0.0, -100.0)
glEnd()
// Draw 36 SnowMen
for i = -3 to 2
for j = -3 to 2
glPushMatrix()
glTranslatef(i*10.0, 0.0, j * 10.0)
drawSnowMan()
glPopMatrix()
next
next
glutSwapBuffers()
// -----------------------------------
// KEYBOARD
// -----------------------------------
func processNormalKeys
key = glutEventKey()
xx = glutEventX()
yy = glutEventY()
glutSetMenu(mainMenu)
switch key
on 27
glutDestroyMenu(mainMenu)
glutDestroyMenu(fillMenu)
glutDestroyMenu(colorMenu)
glutDestroyMenu(shrinkMenu)
shutdown()
on 's'
if not menuFlag
glutChangeToSubMenu(2,"Shrink",shrinkMenu)
ok
on 'c'
if not menuFlag
glutChangeToSubMenu(2,"Color",colorMenu)
ok
off
if key = 27
shutdown()
ok
func pressKey
key = glutEventKey()
57.12. Menu Events 567
Ring Documentation, Release 1.7
xx = glutEventX()
yy = glutEventY()
switch key
on GLUT_KEY_UP
deltaMove = 0.5
on GLUT_KEY_DOWN
deltaMove = -0.5
off
func releaseKey
key = glutEventKey()
switch key
on GLUT_KEY_UP
deltaMove = 0
on GLUT_KEY_DOWN
deltaMove = 0
off
// -----------------------------------
// MOUSE
// -----------------------------------
func mouseMove
xx = glutEventX()
yy = glutEventY()
// this will only be true when the left button is down
if xOrigin >= 0
// update deltaAngle
deltaAngle = (xx - xOrigin) * 0.001
// update camera's direction
lx = sin(angle + deltaAngle)
lz = -cos(angle + deltaAngle)
ok
func mouseButton
button = glutEventButton()
state = glutEventState()
xx = glutEventX()
yy = glutEventY()
// only start motion if the left button is pressed
if button = GLUT_LEFT_BUTTON
// when the button is released
if state = GLUT_UP
angle += deltaAngle
xOrigin = -1
else
// state = GLUT_DOWN
57.12. Menu Events 568
Ring Documentation, Release 1.7
xOrigin = xx
ok
ok
// -----------------------------------
// MENUS
// -----------------------------------
func processMenuStatus
status = glutEventStatus()
xx = glutEventX()
yy = glutEventY()
if status = GLUT_MENU_IN_USE
menuFlag = 1
else
menuFlag = 0
ok
func processMainMenu
// nothing to do in here
// all actions are for submenus
func processFillMenu
option = glutEventValue()
switch option
on C_FILL
glPolygonMode(GL_FRONT, GL_FILL)
on C_LINE
glPolygonMode(GL_FRONT, GL_LINE)
off
func processShrinkMenu
option = glutEventValue()
switch option
on C_SHRINK
scale = 0.5
on C_NORMAL
scale = 1.0
off
func processColorMenu
option = glutEventValue()
57.12. Menu Events 569
Ring Documentation, Release 1.7
switch option
on C_RED
red = 1.0
green = 0.0
blue = 0.0
on C_GREEN
red = 0.0
green = 1.0
blue = 0.0
on C_BLUE
red = 0.0
green = 0.0
blue = 1.0
on C_ORANGE
red = 1.0
green = 0.5
blue = 0.5
off
func createPopupMenus
shrinkMenu = glutCreateMenu(:processShrinkMenu)
glutAddMenuEntry("Shrink",C_SHRINK)
glutAddMenuEntry("NORMAL",C_NORMAL)
fillMenu = glutCreateMenu(:processFillMenu)
glutAddMenuEntry("Fill",C_FILL)
glutAddMenuEntry("Line",C_LINE)
colorMenu = glutCreateMenu(:processColorMenu)
glutAddMenuEntry("Red",C_RED)
glutAddMenuEntry("Blue",C_BLUE)
glutAddMenuEntry("Green",C_GREEN)
glutAddMenuEntry("Orange",C_ORANGE)
mainMenu = glutCreateMenu(:processMainMenu)
glutAddSubMenu("Polygon Mode", fillMenu)
glutAddSubMenu("Color", colorMenu)
// attach the menu to the right button
glutAttachMenu(GLUT_RIGHT_BUTTON)
// this will allow us to know if the menu is active
glutMenuStatusFunc(:processMenuStatus)
// -----------------------------------
// MAIN
// -----------------------------------
func main
// init GLUT and create window
glutInit()
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA)
57.12. Menu Events 570
Ring Documentation, Release 1.7
glutInitWindowPosition(100,100)
glutInitWindowSize(320,320)
glutCreateWindow("RingFreeGLUT - Test 10")
// register callbacks
glutDisplayFunc(:renderScene)
glutReshapeFunc(:changeSize)
glutIdleFunc(:renderScene)
glutIgnoreKeyRepeat(1)
glutKeyboardFunc(:processNormalKeys)
glutSpecialFunc(:pressKey)
glutSpecialUpFunc(:releaseKey)
// here are the two new functions
glutMouseFunc(:mouseButton)
glutMotionFunc(:mouseMove)
// OpenGL init
glEnable(GL_DEPTH_TEST)
glEnable(GL_CULL_FACE)
// init Menus
createPopupMenus()
// enter GLUT event processing cycle
glutMainLoop()
Screen Shot
57.13 Using Fonts
Example:
57.13. Using Fonts 571

More Related Content

What's hot

The Ring programming language version 1.6 book - Part 57 of 189
The Ring programming language version 1.6 book - Part 57 of 189The Ring programming language version 1.6 book - Part 57 of 189
The Ring programming language version 1.6 book - Part 57 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 59 of 189
The Ring programming language version 1.6 book - Part 59 of 189The Ring programming language version 1.6 book - Part 59 of 189
The Ring programming language version 1.6 book - Part 59 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 59 of 196
The Ring programming language version 1.7 book - Part 59 of 196The Ring programming language version 1.7 book - Part 59 of 196
The Ring programming language version 1.7 book - Part 59 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 62 of 202
The Ring programming language version 1.8 book - Part 62 of 202The Ring programming language version 1.8 book - Part 62 of 202
The Ring programming language version 1.8 book - Part 62 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 55 of 185
The Ring programming language version 1.5.4 book - Part 55 of 185The Ring programming language version 1.5.4 book - Part 55 of 185
The Ring programming language version 1.5.4 book - Part 55 of 185Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 54 of 180
The Ring programming language version 1.5.1 book - Part 54 of 180The Ring programming language version 1.5.1 book - Part 54 of 180
The Ring programming language version 1.5.1 book - Part 54 of 180Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 64 of 202
The Ring programming language version 1.8 book - Part 64 of 202The Ring programming language version 1.8 book - Part 64 of 202
The Ring programming language version 1.8 book - Part 64 of 202Mahmoud Samir Fayed
 
551 pd fsam_fayed_ring_doc_1.5.2
551 pd fsam_fayed_ring_doc_1.5.2551 pd fsam_fayed_ring_doc_1.5.2
551 pd fsam_fayed_ring_doc_1.5.2Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 54 of 185
The Ring programming language version 1.5.4 book - Part 54 of 185The Ring programming language version 1.5.4 book - Part 54 of 185
The Ring programming language version 1.5.4 book - Part 54 of 185Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 65 of 212
The Ring programming language version 1.10 book - Part 65 of 212The Ring programming language version 1.10 book - Part 65 of 212
The Ring programming language version 1.10 book - Part 65 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 8 of 181
The Ring programming language version 1.5.2 book - Part 8 of 181The Ring programming language version 1.5.2 book - Part 8 of 181
The Ring programming language version 1.5.2 book - Part 8 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 62 of 196
The Ring programming language version 1.7 book - Part 62 of 196The Ring programming language version 1.7 book - Part 62 of 196
The Ring programming language version 1.7 book - Part 62 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 64 of 184
The Ring programming language version 1.5.3 book - Part 64 of 184The Ring programming language version 1.5.3 book - Part 64 of 184
The Ring programming language version 1.5.3 book - Part 64 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 14 of 210
The Ring programming language version 1.9 book - Part 14 of 210The Ring programming language version 1.9 book - Part 14 of 210
The Ring programming language version 1.9 book - Part 14 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 12 of 202
The Ring programming language version 1.8 book - Part 12 of 202The Ring programming language version 1.8 book - Part 12 of 202
The Ring programming language version 1.8 book - Part 12 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 56 of 180
The Ring programming language version 1.5.1 book - Part 56 of 180The Ring programming language version 1.5.1 book - Part 56 of 180
The Ring programming language version 1.5.1 book - Part 56 of 180Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 55 of 180
The Ring programming language version 1.5.1 book - Part 55 of 180The Ring programming language version 1.5.1 book - Part 55 of 180
The Ring programming language version 1.5.1 book - Part 55 of 180Mahmoud Samir Fayed
 
Robot Motion Source code
Robot Motion Source codeRobot Motion Source code
Robot Motion Source codeBrian Goggins
 
The Ring programming language version 1.8 book - Part 63 of 202
The Ring programming language version 1.8 book - Part 63 of 202The Ring programming language version 1.8 book - Part 63 of 202
The Ring programming language version 1.8 book - Part 63 of 202Mahmoud Samir Fayed
 

What's hot (20)

The Ring programming language version 1.6 book - Part 57 of 189
The Ring programming language version 1.6 book - Part 57 of 189The Ring programming language version 1.6 book - Part 57 of 189
The Ring programming language version 1.6 book - Part 57 of 189
 
The Ring programming language version 1.6 book - Part 59 of 189
The Ring programming language version 1.6 book - Part 59 of 189The Ring programming language version 1.6 book - Part 59 of 189
The Ring programming language version 1.6 book - Part 59 of 189
 
The Ring programming language version 1.7 book - Part 59 of 196
The Ring programming language version 1.7 book - Part 59 of 196The Ring programming language version 1.7 book - Part 59 of 196
The Ring programming language version 1.7 book - Part 59 of 196
 
The Ring programming language version 1.8 book - Part 62 of 202
The Ring programming language version 1.8 book - Part 62 of 202The Ring programming language version 1.8 book - Part 62 of 202
The Ring programming language version 1.8 book - Part 62 of 202
 
The Ring programming language version 1.5.4 book - Part 55 of 185
The Ring programming language version 1.5.4 book - Part 55 of 185The Ring programming language version 1.5.4 book - Part 55 of 185
The Ring programming language version 1.5.4 book - Part 55 of 185
 
The Ring programming language version 1.5.1 book - Part 54 of 180
The Ring programming language version 1.5.1 book - Part 54 of 180The Ring programming language version 1.5.1 book - Part 54 of 180
The Ring programming language version 1.5.1 book - Part 54 of 180
 
The Ring programming language version 1.8 book - Part 64 of 202
The Ring programming language version 1.8 book - Part 64 of 202The Ring programming language version 1.8 book - Part 64 of 202
The Ring programming language version 1.8 book - Part 64 of 202
 
551 pd fsam_fayed_ring_doc_1.5.2
551 pd fsam_fayed_ring_doc_1.5.2551 pd fsam_fayed_ring_doc_1.5.2
551 pd fsam_fayed_ring_doc_1.5.2
 
The Ring programming language version 1.5.4 book - Part 54 of 185
The Ring programming language version 1.5.4 book - Part 54 of 185The Ring programming language version 1.5.4 book - Part 54 of 185
The Ring programming language version 1.5.4 book - Part 54 of 185
 
The Ring programming language version 1.10 book - Part 65 of 212
The Ring programming language version 1.10 book - Part 65 of 212The Ring programming language version 1.10 book - Part 65 of 212
The Ring programming language version 1.10 book - Part 65 of 212
 
The Ring programming language version 1.5.2 book - Part 8 of 181
The Ring programming language version 1.5.2 book - Part 8 of 181The Ring programming language version 1.5.2 book - Part 8 of 181
The Ring programming language version 1.5.2 book - Part 8 of 181
 
The Ring programming language version 1.7 book - Part 62 of 196
The Ring programming language version 1.7 book - Part 62 of 196The Ring programming language version 1.7 book - Part 62 of 196
The Ring programming language version 1.7 book - Part 62 of 196
 
The Ring programming language version 1.5.3 book - Part 64 of 184
The Ring programming language version 1.5.3 book - Part 64 of 184The Ring programming language version 1.5.3 book - Part 64 of 184
The Ring programming language version 1.5.3 book - Part 64 of 184
 
The Ring programming language version 1.9 book - Part 14 of 210
The Ring programming language version 1.9 book - Part 14 of 210The Ring programming language version 1.9 book - Part 14 of 210
The Ring programming language version 1.9 book - Part 14 of 210
 
The Ring programming language version 1.8 book - Part 12 of 202
The Ring programming language version 1.8 book - Part 12 of 202The Ring programming language version 1.8 book - Part 12 of 202
The Ring programming language version 1.8 book - Part 12 of 202
 
The Ring programming language version 1.5.1 book - Part 56 of 180
The Ring programming language version 1.5.1 book - Part 56 of 180The Ring programming language version 1.5.1 book - Part 56 of 180
The Ring programming language version 1.5.1 book - Part 56 of 180
 
The Ring programming language version 1.5.1 book - Part 55 of 180
The Ring programming language version 1.5.1 book - Part 55 of 180The Ring programming language version 1.5.1 book - Part 55 of 180
The Ring programming language version 1.5.1 book - Part 55 of 180
 
Robot Motion Source code
Robot Motion Source codeRobot Motion Source code
Robot Motion Source code
 
J2 me 07_5
J2 me 07_5J2 me 07_5
J2 me 07_5
 
The Ring programming language version 1.8 book - Part 63 of 202
The Ring programming language version 1.8 book - Part 63 of 202The Ring programming language version 1.8 book - Part 63 of 202
The Ring programming language version 1.8 book - Part 63 of 202
 

Similar to The Ring programming language version 1.7 book - Part 60 of 196

The Ring programming language version 1.5.4 book - Part 58 of 185
The Ring programming language version 1.5.4 book - Part 58 of 185The Ring programming language version 1.5.4 book - Part 58 of 185
The Ring programming language version 1.5.4 book - Part 58 of 185Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 64 of 210
The Ring programming language version 1.9 book - Part 64 of 210The Ring programming language version 1.9 book - Part 64 of 210
The Ring programming language version 1.9 book - Part 64 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 60 of 189
The Ring programming language version 1.6 book - Part 60 of 189The Ring programming language version 1.6 book - Part 60 of 189
The Ring programming language version 1.6 book - Part 60 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 58 of 189
The Ring programming language version 1.6 book - Part 58 of 189The Ring programming language version 1.6 book - Part 58 of 189
The Ring programming language version 1.6 book - Part 58 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 11 of 196
The Ring programming language version 1.7 book - Part 11 of 196The Ring programming language version 1.7 book - Part 11 of 196
The Ring programming language version 1.7 book - Part 11 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 10 of 189
The Ring programming language version 1.6 book - Part 10 of 189The Ring programming language version 1.6 book - Part 10 of 189
The Ring programming language version 1.6 book - Part 10 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 55 of 181
The Ring programming language version 1.5.2 book - Part 55 of 181The Ring programming language version 1.5.2 book - Part 55 of 181
The Ring programming language version 1.5.2 book - Part 55 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 56 of 189
The Ring programming language version 1.6 book - Part 56 of 189The Ring programming language version 1.6 book - Part 56 of 189
The Ring programming language version 1.6 book - Part 56 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 69 of 212
The Ring programming language version 1.10 book - Part 69 of 212The Ring programming language version 1.10 book - Part 69 of 212
The Ring programming language version 1.10 book - Part 69 of 212Mahmoud Samir Fayed
 
Tutorial Open GL (Listing Code)
Tutorial Open GL (Listing Code)Tutorial Open GL (Listing Code)
Tutorial Open GL (Listing Code)Aila Gema Safitri
 
The Ring programming language version 1.5.2 book - Part 53 of 181
The Ring programming language version 1.5.2 book - Part 53 of 181The Ring programming language version 1.5.2 book - Part 53 of 181
The Ring programming language version 1.5.2 book - Part 53 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 56 of 185
The Ring programming language version 1.5.4 book - Part 56 of 185The Ring programming language version 1.5.4 book - Part 56 of 185
The Ring programming language version 1.5.4 book - Part 56 of 185Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 57 of 181
The Ring programming language version 1.5.2 book - Part 57 of 181The Ring programming language version 1.5.2 book - Part 57 of 181
The Ring programming language version 1.5.2 book - Part 57 of 181Mahmoud Samir Fayed
 

Similar to The Ring programming language version 1.7 book - Part 60 of 196 (13)

The Ring programming language version 1.5.4 book - Part 58 of 185
The Ring programming language version 1.5.4 book - Part 58 of 185The Ring programming language version 1.5.4 book - Part 58 of 185
The Ring programming language version 1.5.4 book - Part 58 of 185
 
The Ring programming language version 1.9 book - Part 64 of 210
The Ring programming language version 1.9 book - Part 64 of 210The Ring programming language version 1.9 book - Part 64 of 210
The Ring programming language version 1.9 book - Part 64 of 210
 
The Ring programming language version 1.6 book - Part 60 of 189
The Ring programming language version 1.6 book - Part 60 of 189The Ring programming language version 1.6 book - Part 60 of 189
The Ring programming language version 1.6 book - Part 60 of 189
 
The Ring programming language version 1.6 book - Part 58 of 189
The Ring programming language version 1.6 book - Part 58 of 189The Ring programming language version 1.6 book - Part 58 of 189
The Ring programming language version 1.6 book - Part 58 of 189
 
The Ring programming language version 1.7 book - Part 11 of 196
The Ring programming language version 1.7 book - Part 11 of 196The Ring programming language version 1.7 book - Part 11 of 196
The Ring programming language version 1.7 book - Part 11 of 196
 
The Ring programming language version 1.6 book - Part 10 of 189
The Ring programming language version 1.6 book - Part 10 of 189The Ring programming language version 1.6 book - Part 10 of 189
The Ring programming language version 1.6 book - Part 10 of 189
 
The Ring programming language version 1.5.2 book - Part 55 of 181
The Ring programming language version 1.5.2 book - Part 55 of 181The Ring programming language version 1.5.2 book - Part 55 of 181
The Ring programming language version 1.5.2 book - Part 55 of 181
 
The Ring programming language version 1.6 book - Part 56 of 189
The Ring programming language version 1.6 book - Part 56 of 189The Ring programming language version 1.6 book - Part 56 of 189
The Ring programming language version 1.6 book - Part 56 of 189
 
The Ring programming language version 1.10 book - Part 69 of 212
The Ring programming language version 1.10 book - Part 69 of 212The Ring programming language version 1.10 book - Part 69 of 212
The Ring programming language version 1.10 book - Part 69 of 212
 
Tutorial Open GL (Listing Code)
Tutorial Open GL (Listing Code)Tutorial Open GL (Listing Code)
Tutorial Open GL (Listing Code)
 
The Ring programming language version 1.5.2 book - Part 53 of 181
The Ring programming language version 1.5.2 book - Part 53 of 181The Ring programming language version 1.5.2 book - Part 53 of 181
The Ring programming language version 1.5.2 book - Part 53 of 181
 
The Ring programming language version 1.5.4 book - Part 56 of 185
The Ring programming language version 1.5.4 book - Part 56 of 185The Ring programming language version 1.5.4 book - Part 56 of 185
The Ring programming language version 1.5.4 book - Part 56 of 185
 
The Ring programming language version 1.5.2 book - Part 57 of 181
The Ring programming language version 1.5.2 book - Part 57 of 181The Ring programming language version 1.5.2 book - Part 57 of 181
The Ring programming language version 1.5.2 book - Part 57 of 181
 

More from Mahmoud Samir Fayed

The Ring programming language version 1.10 book - Part 212 of 212
The Ring programming language version 1.10 book - Part 212 of 212The Ring programming language version 1.10 book - Part 212 of 212
The Ring programming language version 1.10 book - Part 212 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 211 of 212
The Ring programming language version 1.10 book - Part 211 of 212The Ring programming language version 1.10 book - Part 211 of 212
The Ring programming language version 1.10 book - Part 211 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 210 of 212
The Ring programming language version 1.10 book - Part 210 of 212The Ring programming language version 1.10 book - Part 210 of 212
The Ring programming language version 1.10 book - Part 210 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 208 of 212
The Ring programming language version 1.10 book - Part 208 of 212The Ring programming language version 1.10 book - Part 208 of 212
The Ring programming language version 1.10 book - Part 208 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 207 of 212
The Ring programming language version 1.10 book - Part 207 of 212The Ring programming language version 1.10 book - Part 207 of 212
The Ring programming language version 1.10 book - Part 207 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 205 of 212
The Ring programming language version 1.10 book - Part 205 of 212The Ring programming language version 1.10 book - Part 205 of 212
The Ring programming language version 1.10 book - Part 205 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 206 of 212
The Ring programming language version 1.10 book - Part 206 of 212The Ring programming language version 1.10 book - Part 206 of 212
The Ring programming language version 1.10 book - Part 206 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 204 of 212
The Ring programming language version 1.10 book - Part 204 of 212The Ring programming language version 1.10 book - Part 204 of 212
The Ring programming language version 1.10 book - Part 204 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 203 of 212
The Ring programming language version 1.10 book - Part 203 of 212The Ring programming language version 1.10 book - Part 203 of 212
The Ring programming language version 1.10 book - Part 203 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 202 of 212
The Ring programming language version 1.10 book - Part 202 of 212The Ring programming language version 1.10 book - Part 202 of 212
The Ring programming language version 1.10 book - Part 202 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 201 of 212
The Ring programming language version 1.10 book - Part 201 of 212The Ring programming language version 1.10 book - Part 201 of 212
The Ring programming language version 1.10 book - Part 201 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 200 of 212
The Ring programming language version 1.10 book - Part 200 of 212The Ring programming language version 1.10 book - Part 200 of 212
The Ring programming language version 1.10 book - Part 200 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 199 of 212
The Ring programming language version 1.10 book - Part 199 of 212The Ring programming language version 1.10 book - Part 199 of 212
The Ring programming language version 1.10 book - Part 199 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 198 of 212
The Ring programming language version 1.10 book - Part 198 of 212The Ring programming language version 1.10 book - Part 198 of 212
The Ring programming language version 1.10 book - Part 198 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 197 of 212
The Ring programming language version 1.10 book - Part 197 of 212The Ring programming language version 1.10 book - Part 197 of 212
The Ring programming language version 1.10 book - Part 197 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 196 of 212
The Ring programming language version 1.10 book - Part 196 of 212The Ring programming language version 1.10 book - Part 196 of 212
The Ring programming language version 1.10 book - Part 196 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 195 of 212
The Ring programming language version 1.10 book - Part 195 of 212The Ring programming language version 1.10 book - Part 195 of 212
The Ring programming language version 1.10 book - Part 195 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 194 of 212
The Ring programming language version 1.10 book - Part 194 of 212The Ring programming language version 1.10 book - Part 194 of 212
The Ring programming language version 1.10 book - Part 194 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 193 of 212
The Ring programming language version 1.10 book - Part 193 of 212The Ring programming language version 1.10 book - Part 193 of 212
The Ring programming language version 1.10 book - Part 193 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 192 of 212
The Ring programming language version 1.10 book - Part 192 of 212The Ring programming language version 1.10 book - Part 192 of 212
The Ring programming language version 1.10 book - Part 192 of 212Mahmoud Samir Fayed
 

More from Mahmoud Samir Fayed (20)

The Ring programming language version 1.10 book - Part 212 of 212
The Ring programming language version 1.10 book - Part 212 of 212The Ring programming language version 1.10 book - Part 212 of 212
The Ring programming language version 1.10 book - Part 212 of 212
 
The Ring programming language version 1.10 book - Part 211 of 212
The Ring programming language version 1.10 book - Part 211 of 212The Ring programming language version 1.10 book - Part 211 of 212
The Ring programming language version 1.10 book - Part 211 of 212
 
The Ring programming language version 1.10 book - Part 210 of 212
The Ring programming language version 1.10 book - Part 210 of 212The Ring programming language version 1.10 book - Part 210 of 212
The Ring programming language version 1.10 book - Part 210 of 212
 
The Ring programming language version 1.10 book - Part 208 of 212
The Ring programming language version 1.10 book - Part 208 of 212The Ring programming language version 1.10 book - Part 208 of 212
The Ring programming language version 1.10 book - Part 208 of 212
 
The Ring programming language version 1.10 book - Part 207 of 212
The Ring programming language version 1.10 book - Part 207 of 212The Ring programming language version 1.10 book - Part 207 of 212
The Ring programming language version 1.10 book - Part 207 of 212
 
The Ring programming language version 1.10 book - Part 205 of 212
The Ring programming language version 1.10 book - Part 205 of 212The Ring programming language version 1.10 book - Part 205 of 212
The Ring programming language version 1.10 book - Part 205 of 212
 
The Ring programming language version 1.10 book - Part 206 of 212
The Ring programming language version 1.10 book - Part 206 of 212The Ring programming language version 1.10 book - Part 206 of 212
The Ring programming language version 1.10 book - Part 206 of 212
 
The Ring programming language version 1.10 book - Part 204 of 212
The Ring programming language version 1.10 book - Part 204 of 212The Ring programming language version 1.10 book - Part 204 of 212
The Ring programming language version 1.10 book - Part 204 of 212
 
The Ring programming language version 1.10 book - Part 203 of 212
The Ring programming language version 1.10 book - Part 203 of 212The Ring programming language version 1.10 book - Part 203 of 212
The Ring programming language version 1.10 book - Part 203 of 212
 
The Ring programming language version 1.10 book - Part 202 of 212
The Ring programming language version 1.10 book - Part 202 of 212The Ring programming language version 1.10 book - Part 202 of 212
The Ring programming language version 1.10 book - Part 202 of 212
 
The Ring programming language version 1.10 book - Part 201 of 212
The Ring programming language version 1.10 book - Part 201 of 212The Ring programming language version 1.10 book - Part 201 of 212
The Ring programming language version 1.10 book - Part 201 of 212
 
The Ring programming language version 1.10 book - Part 200 of 212
The Ring programming language version 1.10 book - Part 200 of 212The Ring programming language version 1.10 book - Part 200 of 212
The Ring programming language version 1.10 book - Part 200 of 212
 
The Ring programming language version 1.10 book - Part 199 of 212
The Ring programming language version 1.10 book - Part 199 of 212The Ring programming language version 1.10 book - Part 199 of 212
The Ring programming language version 1.10 book - Part 199 of 212
 
The Ring programming language version 1.10 book - Part 198 of 212
The Ring programming language version 1.10 book - Part 198 of 212The Ring programming language version 1.10 book - Part 198 of 212
The Ring programming language version 1.10 book - Part 198 of 212
 
The Ring programming language version 1.10 book - Part 197 of 212
The Ring programming language version 1.10 book - Part 197 of 212The Ring programming language version 1.10 book - Part 197 of 212
The Ring programming language version 1.10 book - Part 197 of 212
 
The Ring programming language version 1.10 book - Part 196 of 212
The Ring programming language version 1.10 book - Part 196 of 212The Ring programming language version 1.10 book - Part 196 of 212
The Ring programming language version 1.10 book - Part 196 of 212
 
The Ring programming language version 1.10 book - Part 195 of 212
The Ring programming language version 1.10 book - Part 195 of 212The Ring programming language version 1.10 book - Part 195 of 212
The Ring programming language version 1.10 book - Part 195 of 212
 
The Ring programming language version 1.10 book - Part 194 of 212
The Ring programming language version 1.10 book - Part 194 of 212The Ring programming language version 1.10 book - Part 194 of 212
The Ring programming language version 1.10 book - Part 194 of 212
 
The Ring programming language version 1.10 book - Part 193 of 212
The Ring programming language version 1.10 book - Part 193 of 212The Ring programming language version 1.10 book - Part 193 of 212
The Ring programming language version 1.10 book - Part 193 of 212
 
The Ring programming language version 1.10 book - Part 192 of 212
The Ring programming language version 1.10 book - Part 192 of 212The Ring programming language version 1.10 book - Part 192 of 212
The Ring programming language version 1.10 book - Part 192 of 212
 

Recently uploaded

costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 

Recently uploaded (20)

costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 

The Ring programming language version 1.7 book - Part 60 of 196

  • 1. Ring Documentation, Release 1.7 // Draw Head glTranslatef(0.0, 1.0, 0.0) glutSolidSphere(0.25,20,20) // Draw Eyes glPushMatrix() glColor3f(0.0,0.0,0.0) glTranslatef(0.05, 0.10, 0.18) glutSolidSphere(0.05,10,10) glTranslatef(-0.1, 0.0, 0.0) glutSolidSphere(0.05,10,10) glPopMatrix() // Draw Nose glColor3f(1.0, 0.5 , 0.5) glRotatef(0.0,1.0, 0.0, 0.0) glutSolidCone(0.08,0.5,10,2) func computePos deltaMove x += deltaMove * lx * 0.1 z += deltaMove * lz * 0.1 func renderScene if deltaMove computePos(deltaMove) ok // Clear Color and Depth Buffers glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) // Reset transformations glLoadIdentity() // Set the camera gluLookAt( x, 1.0, z, x+lx, 1.0, z+lz, 0.0, 1.0, 0.0) // Draw ground glColor3f(0.9, 0.9, 0.9) glBegin(GL_QUADS) glVertex3f(-100.0, 0.0, -100.0) glVertex3f(-100.0, 0.0, 100.0) glVertex3f( 100.0, 0.0, 100.0) glVertex3f( 100.0, 0.0, -100.0) glEnd() // Draw 36 SnowMen for i = -3 to 2 for j=-3 to 2 glPushMatrix() glTranslatef(i*10.0,0,j * 10.0) drawSnowMan() glPopMatrix() 57.11. Mouse Events 562
  • 2. Ring Documentation, Release 1.7 next next glutSwapBuffers() func processNormalKeys key = glutEventKey() if key = 27 shutdown() ok func pressKey key = glutEventKey() switch key on GLUT_KEY_UP deltaMove = 0.5 on GLUT_KEY_DOWN deltaMove = -0.5 off func releaseKey key = glutEventKey() switch key on GLUT_KEY_UP deltaMove = 0 on GLUT_KEY_DOWN deltaMove = 0 off func mouseMove xx = glutEventX() yy = glutEventY() // this will only be true when the left button is down if xOrigin >= 0 // update deltaAngle deltaAngle = (xx - xOrigin) * 0.001 // update camera's direction lx = sin(angle + deltaAngle) lz = -cos(angle + deltaAngle) ok func mouseButton button = glutEventButton() state = glutEventState() xx = glutEventX() yy = glutEventY() // only start motion if the left button is pressed 57.11. Mouse Events 563
  • 3. Ring Documentation, Release 1.7 if button = GLUT_LEFT_BUTTON // when the button is released if state = GLUT_UP angle += deltaAngle xOrigin = -1 else // state = GLUT_DOWN xOrigin = xx ok fflush(stdout) ok func main // init GLUT and create window glutInit() glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA) glutInitWindowPosition(100,100) glutInitWindowSize(320,320) glutCreateWindow("RingFreeGLUT - Test 9") // register callbacks glutDisplayFunc(:renderScene) glutReshapeFunc(:changeSize) glutIdleFunc(:renderScene) glutIgnoreKeyRepeat(1) glutKeyboardFunc(:processNormalKeys) glutSpecialFunc(:pressKey) glutSpecialUpFunc(:releaseKey) // here are the two new functions glutMouseFunc(:mouseButton) glutMotionFunc(:mouseMove) // OpenGL init glEnable(GL_DEPTH_TEST) // enter GLUT event processing cycle glutMainLoop() 57.12 Menu Events Example: load "freeglut.ring" load "opengl21lib.ring" // angle of rotation for the camera direction angle = 0.0 // actual vector representing the camera's direction lx=0.0 lz=-1.0 // XZ position of the camera 57.12. Menu Events 564
  • 4. Ring Documentation, Release 1.7 x=0.0 z=5.0 // the key states. These variables will be zero //when no key is being presses deltaAngle = 0.0 deltaMove = 0 xOrigin = -1 // Constant definitions for Menus // for RingFreeGLUT - We must have different ID for each menu item C_RED = 1 C_GREEN = 2 C_BLUE = 3 C_ORANGE = 4 C_FILL = 5 C_LINE = 6 C_SHRINK = 7 C_NORMAL = 8 // Pop up menu identifiers fillMenu= 0 shrinkMenu= 0 mainMenu=0 colorMenu=0 // color for the nose red = 1.0 blue=0.5 green=0.5 // scale of snowman scale = 1.0 // menu status menuFlag = 0 func changeSize w = glutEventWidth() h = glutEventHeight() // Prevent a divide by zero, when window is too short // (you cant make a window of zero width). if h = 0 h = 1 ok ratio = w * 1.0 / h // Use the Projection Matrix glMatrixMode(GL_PROJECTION) // Reset Matrix glLoadIdentity() // Set the viewport to be the entire window glViewport(0, 0, w, h) 57.12. Menu Events 565
  • 5. Ring Documentation, Release 1.7 // Set the correct perspective. gluPerspective(45.0, ratio, 0.1, 100.0) // Get Back to the Modelview glMatrixMode(GL_MODELVIEW) func drawSnowMan glScalef(scale, scale, scale) glColor3f(1.0, 1.0, 1.0) // Draw Body glTranslatef(0.0 ,0.75, 0.0) glutSolidSphere(0.75,20,20) // Draw Head glTranslatef(0.0, 1.0, 0.0) glutSolidSphere(0.25,20,20) // Draw Eyes glPushMatrix() glColor3f(0.0,0.0,0.0) glTranslatef(0.05, 0.10, 0.18) glutSolidSphere(0.05,10,10) glTranslatef(-0.1, 0.0, 0.0) glutSolidSphere(0.05,10,10) glPopMatrix() // Draw Nose glColor3f(red, green, blue) glRotatef(0.0,1.0, 0.0, 0.0) glutSolidCone(0.08,0.5,10,2) glColor3f(1.0, 1.0, 1.0) func computePos deltaMove x += deltaMove * lx * 0.1 z += deltaMove * lz * 0.1 func renderScene if deltaMove computePos(deltaMove) ok // Clear Color and Depth Buffers glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) // Reset transformations glLoadIdentity() // Set the camera gluLookAt( x, 1.0, z, x+lx, 1.0, z+lz, 0.0, 1.0, 0.0) 57.12. Menu Events 566
  • 6. Ring Documentation, Release 1.7 // Draw ground glColor3f(0.9, 0.9, 0.9) glBegin(GL_QUADS) glVertex3f(-100.0, 0.0, -100.0) glVertex3f(-100.0, 0.0, 100.0) glVertex3f( 100.0, 0.0, 100.0) glVertex3f( 100.0, 0.0, -100.0) glEnd() // Draw 36 SnowMen for i = -3 to 2 for j = -3 to 2 glPushMatrix() glTranslatef(i*10.0, 0.0, j * 10.0) drawSnowMan() glPopMatrix() next next glutSwapBuffers() // ----------------------------------- // KEYBOARD // ----------------------------------- func processNormalKeys key = glutEventKey() xx = glutEventX() yy = glutEventY() glutSetMenu(mainMenu) switch key on 27 glutDestroyMenu(mainMenu) glutDestroyMenu(fillMenu) glutDestroyMenu(colorMenu) glutDestroyMenu(shrinkMenu) shutdown() on 's' if not menuFlag glutChangeToSubMenu(2,"Shrink",shrinkMenu) ok on 'c' if not menuFlag glutChangeToSubMenu(2,"Color",colorMenu) ok off if key = 27 shutdown() ok func pressKey key = glutEventKey() 57.12. Menu Events 567
  • 7. Ring Documentation, Release 1.7 xx = glutEventX() yy = glutEventY() switch key on GLUT_KEY_UP deltaMove = 0.5 on GLUT_KEY_DOWN deltaMove = -0.5 off func releaseKey key = glutEventKey() switch key on GLUT_KEY_UP deltaMove = 0 on GLUT_KEY_DOWN deltaMove = 0 off // ----------------------------------- // MOUSE // ----------------------------------- func mouseMove xx = glutEventX() yy = glutEventY() // this will only be true when the left button is down if xOrigin >= 0 // update deltaAngle deltaAngle = (xx - xOrigin) * 0.001 // update camera's direction lx = sin(angle + deltaAngle) lz = -cos(angle + deltaAngle) ok func mouseButton button = glutEventButton() state = glutEventState() xx = glutEventX() yy = glutEventY() // only start motion if the left button is pressed if button = GLUT_LEFT_BUTTON // when the button is released if state = GLUT_UP angle += deltaAngle xOrigin = -1 else // state = GLUT_DOWN 57.12. Menu Events 568
  • 8. Ring Documentation, Release 1.7 xOrigin = xx ok ok // ----------------------------------- // MENUS // ----------------------------------- func processMenuStatus status = glutEventStatus() xx = glutEventX() yy = glutEventY() if status = GLUT_MENU_IN_USE menuFlag = 1 else menuFlag = 0 ok func processMainMenu // nothing to do in here // all actions are for submenus func processFillMenu option = glutEventValue() switch option on C_FILL glPolygonMode(GL_FRONT, GL_FILL) on C_LINE glPolygonMode(GL_FRONT, GL_LINE) off func processShrinkMenu option = glutEventValue() switch option on C_SHRINK scale = 0.5 on C_NORMAL scale = 1.0 off func processColorMenu option = glutEventValue() 57.12. Menu Events 569
  • 9. Ring Documentation, Release 1.7 switch option on C_RED red = 1.0 green = 0.0 blue = 0.0 on C_GREEN red = 0.0 green = 1.0 blue = 0.0 on C_BLUE red = 0.0 green = 0.0 blue = 1.0 on C_ORANGE red = 1.0 green = 0.5 blue = 0.5 off func createPopupMenus shrinkMenu = glutCreateMenu(:processShrinkMenu) glutAddMenuEntry("Shrink",C_SHRINK) glutAddMenuEntry("NORMAL",C_NORMAL) fillMenu = glutCreateMenu(:processFillMenu) glutAddMenuEntry("Fill",C_FILL) glutAddMenuEntry("Line",C_LINE) colorMenu = glutCreateMenu(:processColorMenu) glutAddMenuEntry("Red",C_RED) glutAddMenuEntry("Blue",C_BLUE) glutAddMenuEntry("Green",C_GREEN) glutAddMenuEntry("Orange",C_ORANGE) mainMenu = glutCreateMenu(:processMainMenu) glutAddSubMenu("Polygon Mode", fillMenu) glutAddSubMenu("Color", colorMenu) // attach the menu to the right button glutAttachMenu(GLUT_RIGHT_BUTTON) // this will allow us to know if the menu is active glutMenuStatusFunc(:processMenuStatus) // ----------------------------------- // MAIN // ----------------------------------- func main // init GLUT and create window glutInit() glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA) 57.12. Menu Events 570
  • 10. Ring Documentation, Release 1.7 glutInitWindowPosition(100,100) glutInitWindowSize(320,320) glutCreateWindow("RingFreeGLUT - Test 10") // register callbacks glutDisplayFunc(:renderScene) glutReshapeFunc(:changeSize) glutIdleFunc(:renderScene) glutIgnoreKeyRepeat(1) glutKeyboardFunc(:processNormalKeys) glutSpecialFunc(:pressKey) glutSpecialUpFunc(:releaseKey) // here are the two new functions glutMouseFunc(:mouseButton) glutMotionFunc(:mouseMove) // OpenGL init glEnable(GL_DEPTH_TEST) glEnable(GL_CULL_FACE) // init Menus createPopupMenus() // enter GLUT event processing cycle glutMainLoop() Screen Shot 57.13 Using Fonts Example: 57.13. Using Fonts 571