SlideShare a Scribd company logo
Ring Documentation, Release 1.9
on 5
oGame.aObjects[2].aMap[nRow][nCol] = 0
oGameState.DoorKey = true
oGameState.Score += 500
checkopenwall(oGame)
oGame { Sound {
once = true
file = "sound/sfx_point.wav"
} }
off
func checkstarskeycol oGame,oSelf
nValue = oGame.aObjects[2].getvalue(oSelf.x,oSelf.y)
nRow = oGame.aObjects[2].getrow(oSelf.x,oSelf.y)
nCol = oGame.aObjects[2].getcol(oSelf.x,oSelf.y)
checkstarskey(oGame,oSelf,nValue,nRow,nCol)
nValue = oGame.aObjects[2].getvalue(oSelf.x+oSelf.width,oSelf.y+oSelf.height)
nRow = oGame.aObjects[2].getrow(oSelf.x+oSelf.width,oSelf.y+oSelf.height)
nCol = oGame.aObjects[2].getcol(oSelf.x+oSelf.width,oSelf.y+oSelf.height)
checkstarskey(oGame,oSelf,nValue,nRow,nCol)
nValue = oGame.aObjects[2].getvalue(oSelf.x+oSelf.width,oSelf.y)
nRow = oGame.aObjects[2].getrow(oSelf.x+oSelf.width,oSelf.y)
nCol = oGame.aObjects[2].getcol(oSelf.x+oSelf.width,oSelf.y)
checkstarskey(oGame,oSelf,nValue,nRow,nCol)
nValue = oGame.aObjects[2].getvalue(oSelf.x,oSelf.y+oSelf.height)
nRow = oGame.aObjects[2].getrow(oSelf.x,oSelf.y+oSelf.height)
nCol = oGame.aObjects[2].getcol(oSelf.x,oSelf.y+oSelf.height)
checkstarskey(oGame,oSelf,nValue,nRow,nCol)
func callenemystate oGame
for t in oGame.aObjects
t {
if type = GE_TYPE_ENEMY
call state(oGame,t)
ok
}
next
Class GameState
down = 3
gameresult = false
Score = 0
startplay=false
lastcol = 0
playerwin = false
DoorKey = false
playerindex = 4
value = 1000
moveplayer = false
Screen Shot:
59.29. Super Man 2016 Game 589
Ring Documentation, Release 1.9
59.29. Super Man 2016 Game 590
CHAPTER
SIXTY
BUILDING GAMES FOR ANDROID
In this chapter we will learn about Building RingLibSDL Games for Mobile.
So we can create packages (*.apk) for the applications that are developed using Ring Game Engine for 2D Games.
60.1 Download Requirements and Update the Android SDK
• The Android SDK Tools
https://developer.android.com/studio/index.html
• The Android NDK (Tested using android-ndk-r10c)
https://developer.android.com/ndk/index.html
• Apache Ant v1.8 or later
http://ant.apache.org/bindownload.cgi
• Java SE Development Kit (JDK) v6 or later
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
• Update the Android SDK to get the API and tools packages required for development
Tested using Android 4.4.2 (API 19)
• In Windows - Define the next Environment Variables based on your system.
1. JAVA_HOME
For Example : C:Program Files (x86)Javajdk1.8.0_05
2. ANDROID_HOME
For Example : B:mahmoudToolsJava-Androidadt-bundle-windows-x86-20140702sdk
60.2 Project Folder
Open the project folder : ring/android/ringlibsdl/project
591
Ring Documentation, Release 1.9
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"
60.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.
60.3. Building the project 592
Ring Documentation, Release 1.9
ant debug
60.3. Building the project 593
CHAPTER
SIXTYONE
USING RINGOPENGL AND RINGFREEGLUT FOR 3D GRAPHICS
In this chapter we will learn about using RingOpenGL
61.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
61.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
594
Ring Documentation, Release 1.9
• 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"
61.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"
61.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
61.3. What is RingFreeGLUT? 595
Ring Documentation, Release 1.9
61.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)
61.5. Drawing using RingOpenGL 596
Ring Documentation, Release 1.9
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
61.5. Drawing using RingOpenGL 597
Ring Documentation, Release 1.9
61.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
61.6. The First Triangle 598

More Related Content

PDF
The Ring programming language version 1.5.3 book - Part 63 of 184
PDF
The Ring programming language version 1.5.4 book - Part 53 of 185
PDF
The Ring programming language version 1.5.3 book - Part 72 of 184
PDF
The Ring programming language version 1.5.3 book - Part 71 of 184
PDF
The Ring programming language version 1.2 book - Part 43 of 84
PDF
The Ring programming language version 1.5.1 book - Part 58 of 180
PDF
The Ring programming language version 1.10 book - Part 64 of 212
PDF
The Ring programming language version 1.7 book - Part 67 of 196
The Ring programming language version 1.5.3 book - Part 63 of 184
The Ring programming language version 1.5.4 book - Part 53 of 185
The Ring programming language version 1.5.3 book - Part 72 of 184
The Ring programming language version 1.5.3 book - Part 71 of 184
The Ring programming language version 1.2 book - Part 43 of 84
The Ring programming language version 1.5.1 book - Part 58 of 180
The Ring programming language version 1.10 book - Part 64 of 212
The Ring programming language version 1.7 book - Part 67 of 196

What's hot (20)

PDF
The Ring programming language version 1.2 book - Part 42 of 84
PDF
Zone.js 2017
PDF
The Ring programming language version 1.10 book - Part 74 of 212
PDF
The Ring programming language version 1.9 book - Part 76 of 210
PDF
The Ring programming language version 1.5.2 book - Part 52 of 181
PPTX
Ogdc 2013 lets remake the wheel
PPTX
OGDC2013_Lets remake the wheel_ Mr Nguyen Trung Hung
PDF
The Ring programming language version 1.8 book - Part 69 of 202
ODP
MySQL vs. PostgreSQL
PDF
The Ring programming language version 1.5.2 book - Part 64 of 181
PDF
The Ring programming language version 1.6 book - Part 55 of 189
PDF
The Ring programming language version 1.3 book - Part 45 of 88
PDF
The Ring programming language version 1.5.3 book - Part 15 of 184
PDF
The Ring programming language version 1.6 book - Part 64 of 189
PDF
What they don't tell you about JavaScript
PDF
The Ring programming language version 1.5.2 book - Part 59 of 181
PDF
The Ring programming language version 1.10 book - Part 13 of 212
PPTX
Node.js and angular js
PDF
The Ring programming language version 1.6 book - Part 7 of 189
PDF
The Ring programming language version 1.4.1 book - Part 16 of 31
The Ring programming language version 1.2 book - Part 42 of 84
Zone.js 2017
The Ring programming language version 1.10 book - Part 74 of 212
The Ring programming language version 1.9 book - Part 76 of 210
The Ring programming language version 1.5.2 book - Part 52 of 181
Ogdc 2013 lets remake the wheel
OGDC2013_Lets remake the wheel_ Mr Nguyen Trung Hung
The Ring programming language version 1.8 book - Part 69 of 202
MySQL vs. PostgreSQL
The Ring programming language version 1.5.2 book - Part 64 of 181
The Ring programming language version 1.6 book - Part 55 of 189
The Ring programming language version 1.3 book - Part 45 of 88
The Ring programming language version 1.5.3 book - Part 15 of 184
The Ring programming language version 1.6 book - Part 64 of 189
What they don't tell you about JavaScript
The Ring programming language version 1.5.2 book - Part 59 of 181
The Ring programming language version 1.10 book - Part 13 of 212
Node.js and angular js
The Ring programming language version 1.6 book - Part 7 of 189
The Ring programming language version 1.4.1 book - Part 16 of 31
Ad

Similar to The Ring programming language version 1.9 book - Part 63 of 210 (20)

PDF
The Ring programming language version 1.3 book - Part 43 of 88
PDF
The Ring programming language version 1.9 book - Part 10 of 210
PDF
The Ring programming language version 1.7 book - Part 58 of 196
PDF
The Ring programming language version 1.9 book - Part 12 of 210
PDF
The Ring programming language version 1.8 book - Part 10 of 202
PDF
The Ring programming language version 1.9 book - Part 70 of 210
PDF
The Ring programming language version 1.8 book - Part 90 of 202
PDF
The Ring programming language version 1.5.2 book - Part 10 of 181
PDF
The Ring programming language version 1.3 book - Part 8 of 88
PDF
The Ring programming language version 1.8 book - Part 8 of 202
PDF
The Ring programming language version 1.5.1 book - Part 52 of 180
PDF
The Ring programming language version 1.8 book - Part 60 of 202
PDF
The Ring programming language version 1.10 book - Part 11 of 212
PDF
The Ring programming language version 1.10 book - Part 90 of 212
PDF
The Ring programming language version 1.3 book - Part 7 of 88
PDF
The Ring programming language version 1.5.2 book - Part 53 of 181
PDF
The Ring programming language version 1.7 book - Part 8 of 196
PDF
The Ring programming language version 1.10 book - Part 10 of 212
PDF
The Ring programming language version 1.6 book - Part 56 of 189
PDF
The Ring programming language version 1.5.4 book - Part 15 of 185
The Ring programming language version 1.3 book - Part 43 of 88
The Ring programming language version 1.9 book - Part 10 of 210
The Ring programming language version 1.7 book - Part 58 of 196
The Ring programming language version 1.9 book - Part 12 of 210
The Ring programming language version 1.8 book - Part 10 of 202
The Ring programming language version 1.9 book - Part 70 of 210
The Ring programming language version 1.8 book - Part 90 of 202
The Ring programming language version 1.5.2 book - Part 10 of 181
The Ring programming language version 1.3 book - Part 8 of 88
The Ring programming language version 1.8 book - Part 8 of 202
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.10 book - Part 11 of 212
The Ring programming language version 1.10 book - Part 90 of 212
The Ring programming language version 1.3 book - Part 7 of 88
The Ring programming language version 1.5.2 book - Part 53 of 181
The Ring programming language version 1.7 book - Part 8 of 196
The Ring programming language version 1.10 book - Part 10 of 212
The Ring programming language version 1.6 book - Part 56 of 189
The Ring programming language version 1.5.4 book - Part 15 of 185
Ad

More from Mahmoud Samir Fayed (20)

PDF
The Ring programming language version 1.10 book - Part 212 of 212
PDF
The Ring programming language version 1.10 book - Part 211 of 212
PDF
The Ring programming language version 1.10 book - Part 210 of 212
PDF
The Ring programming language version 1.10 book - Part 208 of 212
PDF
The Ring programming language version 1.10 book - Part 207 of 212
PDF
The Ring programming language version 1.10 book - Part 205 of 212
PDF
The Ring programming language version 1.10 book - Part 206 of 212
PDF
The Ring programming language version 1.10 book - Part 204 of 212
PDF
The Ring programming language version 1.10 book - Part 203 of 212
PDF
The Ring programming language version 1.10 book - Part 202 of 212
PDF
The Ring programming language version 1.10 book - Part 201 of 212
PDF
The Ring programming language version 1.10 book - Part 200 of 212
PDF
The Ring programming language version 1.10 book - Part 199 of 212
PDF
The Ring programming language version 1.10 book - Part 198 of 212
PDF
The Ring programming language version 1.10 book - Part 197 of 212
PDF
The Ring programming language version 1.10 book - Part 196 of 212
PDF
The Ring programming language version 1.10 book - Part 195 of 212
PDF
The Ring programming language version 1.10 book - Part 194 of 212
PDF
The Ring programming language version 1.10 book - Part 193 of 212
PDF
The Ring programming language version 1.10 book - Part 192 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 210 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 205 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 203 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 200 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 197 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 194 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

Recently uploaded (20)

PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
System and Network Administration Chapter 2
PDF
AI in Product Development-omnex systems
PDF
medical staffing services at VALiNTRY
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Reimagine Home Health with the Power of Agentic AI​
PPTX
L1 - Introduction to python Backend.pptx
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PTS Company Brochure 2025 (1).pdf.......
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Understanding Forklifts - TECH EHS Solution
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
How to Choose the Right IT Partner for Your Business in Malaysia
System and Network Administration Chapter 2
AI in Product Development-omnex systems
medical staffing services at VALiNTRY
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Upgrade and Innovation Strategies for SAP ERP Customers
Reimagine Home Health with the Power of Agentic AI​
L1 - Introduction to python Backend.pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Design an Analysis of Algorithms I-SECS-1021-03
Which alternative to Crystal Reports is best for small or large businesses.pdf
VVF-Customer-Presentation2025-Ver1.9.pptx
How to Migrate SBCGlobal Email to Yahoo Easily
Softaken Excel to vCard Converter Software.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025

The Ring programming language version 1.9 book - Part 63 of 210

  • 1. Ring Documentation, Release 1.9 on 5 oGame.aObjects[2].aMap[nRow][nCol] = 0 oGameState.DoorKey = true oGameState.Score += 500 checkopenwall(oGame) oGame { Sound { once = true file = "sound/sfx_point.wav" } } off func checkstarskeycol oGame,oSelf nValue = oGame.aObjects[2].getvalue(oSelf.x,oSelf.y) nRow = oGame.aObjects[2].getrow(oSelf.x,oSelf.y) nCol = oGame.aObjects[2].getcol(oSelf.x,oSelf.y) checkstarskey(oGame,oSelf,nValue,nRow,nCol) nValue = oGame.aObjects[2].getvalue(oSelf.x+oSelf.width,oSelf.y+oSelf.height) nRow = oGame.aObjects[2].getrow(oSelf.x+oSelf.width,oSelf.y+oSelf.height) nCol = oGame.aObjects[2].getcol(oSelf.x+oSelf.width,oSelf.y+oSelf.height) checkstarskey(oGame,oSelf,nValue,nRow,nCol) nValue = oGame.aObjects[2].getvalue(oSelf.x+oSelf.width,oSelf.y) nRow = oGame.aObjects[2].getrow(oSelf.x+oSelf.width,oSelf.y) nCol = oGame.aObjects[2].getcol(oSelf.x+oSelf.width,oSelf.y) checkstarskey(oGame,oSelf,nValue,nRow,nCol) nValue = oGame.aObjects[2].getvalue(oSelf.x,oSelf.y+oSelf.height) nRow = oGame.aObjects[2].getrow(oSelf.x,oSelf.y+oSelf.height) nCol = oGame.aObjects[2].getcol(oSelf.x,oSelf.y+oSelf.height) checkstarskey(oGame,oSelf,nValue,nRow,nCol) func callenemystate oGame for t in oGame.aObjects t { if type = GE_TYPE_ENEMY call state(oGame,t) ok } next Class GameState down = 3 gameresult = false Score = 0 startplay=false lastcol = 0 playerwin = false DoorKey = false playerindex = 4 value = 1000 moveplayer = false Screen Shot: 59.29. Super Man 2016 Game 589
  • 2. Ring Documentation, Release 1.9 59.29. Super Man 2016 Game 590
  • 3. CHAPTER SIXTY BUILDING GAMES FOR ANDROID In this chapter we will learn about Building RingLibSDL Games for Mobile. So we can create packages (*.apk) for the applications that are developed using Ring Game Engine for 2D Games. 60.1 Download Requirements and Update the Android SDK • The Android SDK Tools https://developer.android.com/studio/index.html • The Android NDK (Tested using android-ndk-r10c) https://developer.android.com/ndk/index.html • Apache Ant v1.8 or later http://ant.apache.org/bindownload.cgi • Java SE Development Kit (JDK) v6 or later http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html • Update the Android SDK to get the API and tools packages required for development Tested using Android 4.4.2 (API 19) • In Windows - Define the next Environment Variables based on your system. 1. JAVA_HOME For Example : C:Program Files (x86)Javajdk1.8.0_05 2. ANDROID_HOME For Example : B:mahmoudToolsJava-Androidadt-bundle-windows-x86-20140702sdk 60.2 Project Folder Open the project folder : ring/android/ringlibsdl/project 591
  • 4. Ring Documentation, Release 1.9 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" 60.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. 60.3. Building the project 592
  • 5. Ring Documentation, Release 1.9 ant debug 60.3. Building the project 593
  • 6. CHAPTER SIXTYONE USING RINGOPENGL AND RINGFREEGLUT FOR 3D GRAPHICS In this chapter we will learn about using RingOpenGL 61.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 61.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 594
  • 7. Ring Documentation, Release 1.9 • 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" 61.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" 61.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 61.3. What is RingFreeGLUT? 595
  • 8. Ring Documentation, Release 1.9 61.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) 61.5. Drawing using RingOpenGL 596
  • 9. Ring Documentation, Release 1.9 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 61.5. Drawing using RingOpenGL 597
  • 10. Ring Documentation, Release 1.9 61.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 61.6. The First Triangle 598