SlideShare a Scribd company logo
1 of 10
Download to read offline
Ring Documentation, Release 1.7
You can add the source code (*.ring) and Images/Sound Files to the assets folder.
You will find the Flappy Bird 3000 Game ready for building.
The execution starts from the start.ring file
load "game2.ring"
56.3 Building the project
Move to the ring/android/ringlibsdl/project folder
We can build using the next command (We need to do this for one time only).
ndk-build
Then we can create the package (*.apk) using the next command.
56.3. Building the project 542
Ring Documentation, Release 1.7
ant debug
56.3. Building the project 543
CHAPTER
FIFTYSEVEN
USING RINGOPENGL AND RINGFREEGLUT FOR 3D GRAPHICS
In this chapter we will learn about using RingOpenGL
57.1 Samples Source (Authors)
The samples in this chapter are based on C Tutorials
from
1. http://www.lighthouse3d.com/tutorials/glut-tutorial/
2. http://www.wikihow.com/Make-a-Cube-in-OpenGL
57.2 What is RingOpenGL?
RingOpenGL contains the Ring binding to the OpenGL library
You can learn about OpenGL from : https://www.opengl.org/
RingOpenGL comes with support for the next versions
• OpenGL 1.1
• OpenGL 1.2
• OpenGL 1.3
• OpenGL 1.4
• OpenGL 1.5
• OpenGL 2.0
• OpenGL 2.1
• OpenGL 3.0
• OpenGL 3.2
• OpenGL 3.3
• OpenGL 4.0
• OpenGL 4.1
• OpenGL 4.2
• OpenGL 4.3
544
Ring Documentation, Release 1.7
• OpenGL 4.4
• OpenGL 4.5
• OpenGL 4.6
For example, if you want to use OpenGL 2.1 then load RingOpenGL 2.1 library
load "opengl21lib.ring"
57.3 What is RingFreeGLUT?
RingFreeGLUT contains the Ring binding to the FreeGLUT library
You can learn about FreeGLUT from : http://freeglut.sourceforge.net/
To use the RingFreeGLUT library, Just load the library
load "freeglut.ring"
57.4 The First Window using RingFreeGLUT
Example:
load "freeglut.ring"
func main
glutInit()
glutInitDisplayMode(GLUT_SINGLE)
glutInitWindowSize(800, 600)
glutInitWindowPosition(100, 10)
glutCreateWindow("RingFreeGLUT - Test 1")
glutDisplayFunc(:displayCode)
glutMainLoop()
func displaycode
Screen Shot
57.3. What is RingFreeGLUT? 545
Ring Documentation, Release 1.7
57.5 Drawing using RingOpenGL
Example:
load "freeglut.ring"
load "opengl21lib.ring"
func main
glutInit()
glutInitDisplayMode(GLUT_SINGLE)
glutInitWindowSize(800, 600)
glutInitWindowPosition(100, 10)
glutCreateWindow("RingFreeGLUT - Test 2")
glutDisplayFunc(:displayCode)
glutMainLoop()
func displaycode
glClear(GL_COLOR_BUFFER_BIT)
glColor3f(0,255,0)
glBegin(GL_POLYGON)
glVertex3f(0.0, 0.0, 0.0)
57.5. Drawing using RingOpenGL 546
Ring Documentation, Release 1.7
glVertex3f(0.5, 0.0, 0.0)
glVertex3f(0.5, 0.5, 0.0)
glVertex3f(0.0, 0.5, 0.0)
glEnd()
glColor3f(255,0,0)
glBegin(GL_POLYGON)
glVertex3f(0.0, 0.0, 0.0)
glVertex3f(0.5, 0.0, 0.0)
glVertex3f(-0.5,- 1, 0.0)
glVertex3f(0.0, -1, 0.0)
glEnd()
glColor3f(0,0,255)
glBegin(GL_POLYGON)
glVertex3f(0.0, 0.0, 0.0)
glVertex3f(-0.5, 0.0, 0.0)
glVertex3f(-0.5,- 0.5, 0.0)
glVertex3f(0.0, -0.5, 0.0)
glEnd()
glFlush()
Screen Shot
57.5. Drawing using RingOpenGL 547
Ring Documentation, Release 1.7
57.6 The First Triangle
Example:
load "freeglut.ring"
load "opengl21lib.ring"
func main
glutInit()
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA)
glutInitWindowSize(320,320)
glutInitWindowPosition(100, 10)
glutCreateWindow("RingFreeGLUT - Test 3")
glutDisplayFunc(:renderScene)
glutMainLoop()
func renderScene
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
glBegin(GL_TRIANGLES)
glVertex3f(-0.5,-0.5,0.0)
glVertex3f(0.5,0.0,0.0)
glVertex3f(0.0,0.5,0.0)
glEnd()
glutSwapBuffers()
Screen Shot
57.6. The First Triangle 548
Ring Documentation, Release 1.7
57.7 Window Resize Event
Example:
load "freeglut.ring"
load "opengl21lib.ring"
func main
// init GLUT and create window
glutInit()
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA)
glutInitWindowPosition(100,100)
glutInitWindowSize(320,320)
glutCreateWindow("RingFreeGLUT - Test 4")
glutDisplayFunc(:renderScene)
glutReshapeFunc(:changeSize)
glutMainLoop()
func renderScene
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
glBegin(GL_TRIANGLES)
glVertex3f(-2,-2,-5.0)
glVertex3f(2,0.0,-5.0)
glVertex3f(0.0,2,-5.0)
glEnd()
glutSwapBuffers()
func changesize
h = glutEventHeight()
w = glutEventWidth()
// 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)
// Set the correct perspective.
gluPerspective(45,ratio,1,100)
57.7. Window Resize Event 549
Ring Documentation, Release 1.7
// Get Back to the Modelview
glMatrixMode(GL_MODELVIEW)
57.8 Triangle Rotation
Example:
load "freeglut.ring"
load "opengl21lib.ring"
angle = 0
func main
// init GLUT and create window
glutInit()
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA)
glutInitWindowPosition(100,100)
glutInitWindowSize(320,320)
glutCreateWindow("RingFreeGLUT - Test 5")
glutDisplayFunc(:renderScene)
glutReshapeFunc(:changeSize)
glutIdleFunc(:renderScene)
glutMainLoop()
func renderScene
// Clear Color and Depth Buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
// Reset transformations
glLoadIdentity()
// Set the camera
gluLookAt( 0.0, 0.0, 10.0,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0)
glRotatef(angle, 0.0, 1.0, 0.0)
glBegin(GL_TRIANGLES)
glVertex3f(-2.0,-2.0, 0.0)
glVertex3f( 2.0, 0.0, 0.0)
glVertex3f( 0.0, 2.0, 0.0)
glEnd()
angle+=0.1
glutSwapBuffers();
func changesize
h = glutEventHeight()
w = glutEventWidth()
57.8. Triangle Rotation 550
Ring Documentation, Release 1.7
// 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)
// Set the correct perspective.
gluPerspective(45,ratio,1,100)
// Get Back to the Modelview
glMatrixMode(GL_MODELVIEW)
Screen Shot
57.9 Keyboard Events and Colors
Example:
load "freeglut.ring"
load "opengl21lib.ring"
57.9. Keyboard Events and Colors 551

More Related Content

What's hot

The Ring programming language version 1.9 book - Part 63 of 210
The Ring programming language version 1.9 book - Part 63 of 210The Ring programming language version 1.9 book - Part 63 of 210
The Ring programming language version 1.9 book - Part 63 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 43 of 84
The Ring programming language version 1.2 book - Part 43 of 84The Ring programming language version 1.2 book - Part 43 of 84
The Ring programming language version 1.2 book - Part 43 of 84Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 58 of 181
The Ring programming language version 1.5.2 book - Part 58 of 181The Ring programming language version 1.5.2 book - Part 58 of 181
The Ring programming language version 1.5.2 book - Part 58 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 42 of 84
The Ring programming language version 1.2 book - Part 42 of 84The Ring programming language version 1.2 book - Part 42 of 84
The Ring programming language version 1.2 book - Part 42 of 84Mahmoud 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.6 book - Part 73 of 189
The Ring programming language version 1.6 book - Part 73 of 189The Ring programming language version 1.6 book - Part 73 of 189
The Ring programming language version 1.6 book - Part 73 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 76 of 184
The Ring programming language version 1.5.3 book - Part 76 of 184The Ring programming language version 1.5.3 book - Part 76 of 184
The Ring programming language version 1.5.3 book - Part 76 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 13 of 212
The Ring programming language version 1.10 book - Part 13 of 212The Ring programming language version 1.10 book - Part 13 of 212
The Ring programming language version 1.10 book - Part 13 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 64 of 189
The Ring programming language version 1.6 book - Part 64 of 189The Ring programming language version 1.6 book - Part 64 of 189
The Ring programming language version 1.6 book - Part 64 of 189Mahmoud Samir Fayed
 
OpenStack, The Open Source Cloud Operating System
OpenStack, The Open Source Cloud Operating SystemOpenStack, The Open Source Cloud Operating System
OpenStack, The Open Source Cloud Operating SystemHedi Magroun
 
The Ring programming language version 1.10 book - Part 74 of 212
The Ring programming language version 1.10 book - Part 74 of 212The Ring programming language version 1.10 book - Part 74 of 212
The Ring programming language version 1.10 book - Part 74 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 45 of 88
The Ring programming language version 1.3 book - Part 45 of 88The Ring programming language version 1.3 book - Part 45 of 88
The Ring programming language version 1.3 book - Part 45 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 73 of 212
The Ring programming language version 1.10 book - Part 73 of 212The Ring programming language version 1.10 book - Part 73 of 212
The Ring programming language version 1.10 book - Part 73 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 59 of 181
The Ring programming language version 1.5.2 book - Part 59 of 181The Ring programming language version 1.5.2 book - Part 59 of 181
The Ring programming language version 1.5.2 book - Part 59 of 181Mahmoud Samir Fayed
 
UberFire Quick Intro and Overview (early beta Jul 2013)
UberFire Quick Intro and Overview (early beta Jul 2013)UberFire Quick Intro and Overview (early beta Jul 2013)
UberFire Quick Intro and Overview (early beta Jul 2013)Mark Proctor
 

What's hot (15)

The Ring programming language version 1.9 book - Part 63 of 210
The Ring programming language version 1.9 book - Part 63 of 210The Ring programming language version 1.9 book - Part 63 of 210
The Ring programming language version 1.9 book - Part 63 of 210
 
The Ring programming language version 1.2 book - Part 43 of 84
The Ring programming language version 1.2 book - Part 43 of 84The Ring programming language version 1.2 book - Part 43 of 84
The Ring programming language version 1.2 book - Part 43 of 84
 
The Ring programming language version 1.5.2 book - Part 58 of 181
The Ring programming language version 1.5.2 book - Part 58 of 181The Ring programming language version 1.5.2 book - Part 58 of 181
The Ring programming language version 1.5.2 book - Part 58 of 181
 
The Ring programming language version 1.2 book - Part 42 of 84
The Ring programming language version 1.2 book - Part 42 of 84The Ring programming language version 1.2 book - Part 42 of 84
The Ring programming language version 1.2 book - Part 42 of 84
 
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.6 book - Part 73 of 189
The Ring programming language version 1.6 book - Part 73 of 189The Ring programming language version 1.6 book - Part 73 of 189
The Ring programming language version 1.6 book - Part 73 of 189
 
The Ring programming language version 1.5.3 book - Part 76 of 184
The Ring programming language version 1.5.3 book - Part 76 of 184The Ring programming language version 1.5.3 book - Part 76 of 184
The Ring programming language version 1.5.3 book - Part 76 of 184
 
The Ring programming language version 1.10 book - Part 13 of 212
The Ring programming language version 1.10 book - Part 13 of 212The Ring programming language version 1.10 book - Part 13 of 212
The Ring programming language version 1.10 book - Part 13 of 212
 
The Ring programming language version 1.6 book - Part 64 of 189
The Ring programming language version 1.6 book - Part 64 of 189The Ring programming language version 1.6 book - Part 64 of 189
The Ring programming language version 1.6 book - Part 64 of 189
 
OpenStack, The Open Source Cloud Operating System
OpenStack, The Open Source Cloud Operating SystemOpenStack, The Open Source Cloud Operating System
OpenStack, The Open Source Cloud Operating System
 
The Ring programming language version 1.10 book - Part 74 of 212
The Ring programming language version 1.10 book - Part 74 of 212The Ring programming language version 1.10 book - Part 74 of 212
The Ring programming language version 1.10 book - Part 74 of 212
 
The Ring programming language version 1.3 book - Part 45 of 88
The Ring programming language version 1.3 book - Part 45 of 88The Ring programming language version 1.3 book - Part 45 of 88
The Ring programming language version 1.3 book - Part 45 of 88
 
The Ring programming language version 1.10 book - Part 73 of 212
The Ring programming language version 1.10 book - Part 73 of 212The Ring programming language version 1.10 book - Part 73 of 212
The Ring programming language version 1.10 book - Part 73 of 212
 
The Ring programming language version 1.5.2 book - Part 59 of 181
The Ring programming language version 1.5.2 book - Part 59 of 181The Ring programming language version 1.5.2 book - Part 59 of 181
The Ring programming language version 1.5.2 book - Part 59 of 181
 
UberFire Quick Intro and Overview (early beta Jul 2013)
UberFire Quick Intro and Overview (early beta Jul 2013)UberFire Quick Intro and Overview (early beta Jul 2013)
UberFire Quick Intro and Overview (early beta Jul 2013)
 

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

The Ring programming language version 1.5.1 book - Part 52 of 180
The Ring programming language version 1.5.1 book - Part 52 of 180The Ring programming language version 1.5.1 book - Part 52 of 180
The Ring programming language version 1.5.1 book - Part 52 of 180Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 60 of 202
The Ring programming language version 1.8 book - Part 60 of 202The Ring programming language version 1.8 book - Part 60 of 202
The Ring programming language version 1.8 book - Part 60 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 77 of 202
The Ring programming language version 1.8 book - Part 77 of 202The Ring programming language version 1.8 book - Part 77 of 202
The Ring programming language version 1.8 book - Part 77 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 75 of 196
The Ring programming language version 1.7 book - Part 75 of 196The Ring programming language version 1.7 book - Part 75 of 196
The Ring programming language version 1.7 book - Part 75 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 8 of 88
The Ring programming language version 1.3 book - Part 8 of 88The Ring programming language version 1.3 book - Part 8 of 88
The Ring programming language version 1.3 book - Part 8 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 7 of 180
The Ring programming language version 1.5.1 book - Part 7 of 180The Ring programming language version 1.5.1 book - Part 7 of 180
The Ring programming language version 1.5.1 book - Part 7 of 180Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 8 of 185
The Ring programming language version 1.5.4 book - Part 8 of 185The Ring programming language version 1.5.4 book - Part 8 of 185
The Ring programming language version 1.5.4 book - Part 8 of 185Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 10 of 181
The Ring programming language version 1.5.2 book - Part 10 of 181The Ring programming language version 1.5.2 book - Part 10 of 181
The Ring programming language version 1.5.2 book - Part 10 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 8 of 184
The Ring programming language version 1.5.3 book - Part 8 of 184The Ring programming language version 1.5.3 book - Part 8 of 184
The Ring programming language version 1.5.3 book - Part 8 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 63 of 184
The Ring programming language version 1.5.3 book - Part 63 of 184The Ring programming language version 1.5.3 book - Part 63 of 184
The Ring programming language version 1.5.3 book - Part 63 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 72 of 212
The Ring programming language version 1.10 book - Part 72 of 212The Ring programming language version 1.10 book - Part 72 of 212
The Ring programming language version 1.10 book - Part 72 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 89 of 210
The Ring programming language version 1.9 book - Part 89 of 210The Ring programming language version 1.9 book - Part 89 of 210
The Ring programming language version 1.9 book - Part 89 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.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 85 of 202
The Ring programming language version 1.8 book - Part 85 of 202The Ring programming language version 1.8 book - Part 85 of 202
The Ring programming language version 1.8 book - Part 85 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 51 of 202
The Ring programming language version 1.8 book - Part 51 of 202The Ring programming language version 1.8 book - Part 51 of 202
The Ring programming language version 1.8 book - Part 51 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 8 of 196
The Ring programming language version 1.7 book - Part 8 of 196The Ring programming language version 1.7 book - Part 8 of 196
The Ring programming language version 1.7 book - Part 8 of 196Mahmoud 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.3 book - Part 7 of 88
The Ring programming language version 1.3 book - Part 7 of 88The Ring programming language version 1.3 book - Part 7 of 88
The Ring programming language version 1.3 book - Part 7 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 92 of 196
The Ring programming language version 1.7 book - Part 92 of 196The Ring programming language version 1.7 book - Part 92 of 196
The Ring programming language version 1.7 book - Part 92 of 196Mahmoud Samir Fayed
 

Similar to The Ring programming language version 1.7 book - Part 58 of 196 (20)

The Ring programming language version 1.5.1 book - Part 52 of 180
The Ring programming language version 1.5.1 book - Part 52 of 180The Ring programming language version 1.5.1 book - Part 52 of 180
The Ring programming language version 1.5.1 book - Part 52 of 180
 
The Ring programming language version 1.8 book - Part 60 of 202
The Ring programming language version 1.8 book - Part 60 of 202The Ring programming language version 1.8 book - Part 60 of 202
The Ring programming language version 1.8 book - Part 60 of 202
 
The Ring programming language version 1.8 book - Part 77 of 202
The Ring programming language version 1.8 book - Part 77 of 202The Ring programming language version 1.8 book - Part 77 of 202
The Ring programming language version 1.8 book - Part 77 of 202
 
The Ring programming language version 1.7 book - Part 75 of 196
The Ring programming language version 1.7 book - Part 75 of 196The Ring programming language version 1.7 book - Part 75 of 196
The Ring programming language version 1.7 book - Part 75 of 196
 
The Ring programming language version 1.3 book - Part 8 of 88
The Ring programming language version 1.3 book - Part 8 of 88The Ring programming language version 1.3 book - Part 8 of 88
The Ring programming language version 1.3 book - Part 8 of 88
 
The Ring programming language version 1.5.1 book - Part 7 of 180
The Ring programming language version 1.5.1 book - Part 7 of 180The Ring programming language version 1.5.1 book - Part 7 of 180
The Ring programming language version 1.5.1 book - Part 7 of 180
 
The Ring programming language version 1.5.4 book - Part 8 of 185
The Ring programming language version 1.5.4 book - Part 8 of 185The Ring programming language version 1.5.4 book - Part 8 of 185
The Ring programming language version 1.5.4 book - Part 8 of 185
 
The Ring programming language version 1.5.2 book - Part 10 of 181
The Ring programming language version 1.5.2 book - Part 10 of 181The Ring programming language version 1.5.2 book - Part 10 of 181
The Ring programming language version 1.5.2 book - Part 10 of 181
 
The Ring programming language version 1.5.3 book - Part 8 of 184
The Ring programming language version 1.5.3 book - Part 8 of 184The Ring programming language version 1.5.3 book - Part 8 of 184
The Ring programming language version 1.5.3 book - Part 8 of 184
 
The Ring programming language version 1.5.3 book - Part 63 of 184
The Ring programming language version 1.5.3 book - Part 63 of 184The Ring programming language version 1.5.3 book - Part 63 of 184
The Ring programming language version 1.5.3 book - Part 63 of 184
 
The Ring programming language version 1.10 book - Part 72 of 212
The Ring programming language version 1.10 book - Part 72 of 212The Ring programming language version 1.10 book - Part 72 of 212
The Ring programming language version 1.10 book - Part 72 of 212
 
The Ring programming language version 1.9 book - Part 89 of 210
The Ring programming language version 1.9 book - Part 89 of 210The Ring programming language version 1.9 book - Part 89 of 210
The Ring programming language version 1.9 book - Part 89 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.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 85 of 202
The Ring programming language version 1.8 book - Part 85 of 202The Ring programming language version 1.8 book - Part 85 of 202
The Ring programming language version 1.8 book - Part 85 of 202
 
The Ring programming language version 1.8 book - Part 51 of 202
The Ring programming language version 1.8 book - Part 51 of 202The Ring programming language version 1.8 book - Part 51 of 202
The Ring programming language version 1.8 book - Part 51 of 202
 
The Ring programming language version 1.7 book - Part 8 of 196
The Ring programming language version 1.7 book - Part 8 of 196The Ring programming language version 1.7 book - Part 8 of 196
The Ring programming language version 1.7 book - Part 8 of 196
 
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.3 book - Part 7 of 88
The Ring programming language version 1.3 book - Part 7 of 88The Ring programming language version 1.3 book - Part 7 of 88
The Ring programming language version 1.3 book - Part 7 of 88
 
The Ring programming language version 1.7 book - Part 92 of 196
The Ring programming language version 1.7 book - Part 92 of 196The Ring programming language version 1.7 book - Part 92 of 196
The Ring programming language version 1.7 book - Part 92 of 196
 

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

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

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

  • 1. Ring Documentation, Release 1.7 You can add the source code (*.ring) and Images/Sound Files to the assets folder. You will find the Flappy Bird 3000 Game ready for building. The execution starts from the start.ring file load "game2.ring" 56.3 Building the project Move to the ring/android/ringlibsdl/project folder We can build using the next command (We need to do this for one time only). ndk-build Then we can create the package (*.apk) using the next command. 56.3. Building the project 542
  • 2. Ring Documentation, Release 1.7 ant debug 56.3. Building the project 543
  • 3. CHAPTER FIFTYSEVEN USING RINGOPENGL AND RINGFREEGLUT FOR 3D GRAPHICS In this chapter we will learn about using RingOpenGL 57.1 Samples Source (Authors) The samples in this chapter are based on C Tutorials from 1. http://www.lighthouse3d.com/tutorials/glut-tutorial/ 2. http://www.wikihow.com/Make-a-Cube-in-OpenGL 57.2 What is RingOpenGL? RingOpenGL contains the Ring binding to the OpenGL library You can learn about OpenGL from : https://www.opengl.org/ RingOpenGL comes with support for the next versions • OpenGL 1.1 • OpenGL 1.2 • OpenGL 1.3 • OpenGL 1.4 • OpenGL 1.5 • OpenGL 2.0 • OpenGL 2.1 • OpenGL 3.0 • OpenGL 3.2 • OpenGL 3.3 • OpenGL 4.0 • OpenGL 4.1 • OpenGL 4.2 • OpenGL 4.3 544
  • 4. Ring Documentation, Release 1.7 • OpenGL 4.4 • OpenGL 4.5 • OpenGL 4.6 For example, if you want to use OpenGL 2.1 then load RingOpenGL 2.1 library load "opengl21lib.ring" 57.3 What is RingFreeGLUT? RingFreeGLUT contains the Ring binding to the FreeGLUT library You can learn about FreeGLUT from : http://freeglut.sourceforge.net/ To use the RingFreeGLUT library, Just load the library load "freeglut.ring" 57.4 The First Window using RingFreeGLUT Example: load "freeglut.ring" func main glutInit() glutInitDisplayMode(GLUT_SINGLE) glutInitWindowSize(800, 600) glutInitWindowPosition(100, 10) glutCreateWindow("RingFreeGLUT - Test 1") glutDisplayFunc(:displayCode) glutMainLoop() func displaycode Screen Shot 57.3. What is RingFreeGLUT? 545
  • 5. Ring Documentation, Release 1.7 57.5 Drawing using RingOpenGL Example: load "freeglut.ring" load "opengl21lib.ring" func main glutInit() glutInitDisplayMode(GLUT_SINGLE) glutInitWindowSize(800, 600) glutInitWindowPosition(100, 10) glutCreateWindow("RingFreeGLUT - Test 2") glutDisplayFunc(:displayCode) glutMainLoop() func displaycode glClear(GL_COLOR_BUFFER_BIT) glColor3f(0,255,0) glBegin(GL_POLYGON) glVertex3f(0.0, 0.0, 0.0) 57.5. Drawing using RingOpenGL 546
  • 6. Ring Documentation, Release 1.7 glVertex3f(0.5, 0.0, 0.0) glVertex3f(0.5, 0.5, 0.0) glVertex3f(0.0, 0.5, 0.0) glEnd() glColor3f(255,0,0) glBegin(GL_POLYGON) glVertex3f(0.0, 0.0, 0.0) glVertex3f(0.5, 0.0, 0.0) glVertex3f(-0.5,- 1, 0.0) glVertex3f(0.0, -1, 0.0) glEnd() glColor3f(0,0,255) glBegin(GL_POLYGON) glVertex3f(0.0, 0.0, 0.0) glVertex3f(-0.5, 0.0, 0.0) glVertex3f(-0.5,- 0.5, 0.0) glVertex3f(0.0, -0.5, 0.0) glEnd() glFlush() Screen Shot 57.5. Drawing using RingOpenGL 547
  • 7. Ring Documentation, Release 1.7 57.6 The First Triangle Example: load "freeglut.ring" load "opengl21lib.ring" func main glutInit() glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA) glutInitWindowSize(320,320) glutInitWindowPosition(100, 10) glutCreateWindow("RingFreeGLUT - Test 3") glutDisplayFunc(:renderScene) glutMainLoop() func renderScene glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glBegin(GL_TRIANGLES) glVertex3f(-0.5,-0.5,0.0) glVertex3f(0.5,0.0,0.0) glVertex3f(0.0,0.5,0.0) glEnd() glutSwapBuffers() Screen Shot 57.6. The First Triangle 548
  • 8. Ring Documentation, Release 1.7 57.7 Window Resize Event Example: load "freeglut.ring" load "opengl21lib.ring" func main // init GLUT and create window glutInit() glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA) glutInitWindowPosition(100,100) glutInitWindowSize(320,320) glutCreateWindow("RingFreeGLUT - Test 4") glutDisplayFunc(:renderScene) glutReshapeFunc(:changeSize) glutMainLoop() func renderScene glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glBegin(GL_TRIANGLES) glVertex3f(-2,-2,-5.0) glVertex3f(2,0.0,-5.0) glVertex3f(0.0,2,-5.0) glEnd() glutSwapBuffers() func changesize h = glutEventHeight() w = glutEventWidth() // 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) // Set the correct perspective. gluPerspective(45,ratio,1,100) 57.7. Window Resize Event 549
  • 9. Ring Documentation, Release 1.7 // Get Back to the Modelview glMatrixMode(GL_MODELVIEW) 57.8 Triangle Rotation Example: load "freeglut.ring" load "opengl21lib.ring" angle = 0 func main // init GLUT and create window glutInit() glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA) glutInitWindowPosition(100,100) glutInitWindowSize(320,320) glutCreateWindow("RingFreeGLUT - Test 5") glutDisplayFunc(:renderScene) glutReshapeFunc(:changeSize) glutIdleFunc(:renderScene) glutMainLoop() func renderScene // Clear Color and Depth Buffers glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) // Reset transformations glLoadIdentity() // Set the camera gluLookAt( 0.0, 0.0, 10.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0) glRotatef(angle, 0.0, 1.0, 0.0) glBegin(GL_TRIANGLES) glVertex3f(-2.0,-2.0, 0.0) glVertex3f( 2.0, 0.0, 0.0) glVertex3f( 0.0, 2.0, 0.0) glEnd() angle+=0.1 glutSwapBuffers(); func changesize h = glutEventHeight() w = glutEventWidth() 57.8. Triangle Rotation 550
  • 10. Ring Documentation, Release 1.7 // 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) // Set the correct perspective. gluPerspective(45,ratio,1,100) // Get Back to the Modelview glMatrixMode(GL_MODELVIEW) Screen Shot 57.9 Keyboard Events and Colors Example: load "freeglut.ring" load "opengl21lib.ring" 57.9. Keyboard Events and Colors 551