Handbook
Glossary
begin-world ( world -- )
Factor handbook
»
UI framework
»
Implementing new gadgets
»
Customizing gadget appearance
»
Implementing custom drawing logic
»
Subclassing worlds
Next:
end-world ( world -- )
Vocabulary
ui
.
gadgets
.
worlds
Inputs
world
a
world
Outputs
None
Word description
Called immediately after
world
's OpenGL context has been created. The world's OpenGL context is current when this method is called.
Definition
IN:
ui.gadgets.worlds
GENERIC:
begin-world
( world -- )
Methods
USING:
accessors
bunny
bunny.model
kernel
opengl.demo-support
opengl.gl
ui.gadgets.worlds
;
M:
bunny-world
begin-world
GL_DEPTH_TEST
glEnable
0.0 0.0 0.375
set-demo-orientation
download-bunny
read-model
[
>>model-triangles
]
[
<bunny-geom>
>>geom
]
bi
dup
make-draws
>>draw-seq
0
>>draw-n
drop
;
USING:
accessors
game.input
game.loop
game.worlds
game.worlds.private
kernel
ui.gadgets.worlds
;
M:
game-world
begin-world
dup
use-game-input?>>
[
open-game-input
]
when
dup
use-audio-engine?>>
[
dup
open-game-audio-engine
>>audio-engine
]
when
dup
[
tick-interval-nanos>>
]
[
]
bi
<game-loop>
[
>>game-loop
begin-game-world
]
keep
start-loop
;
USING:
game.input
generic
kernel
tools.deploy.test.8
ui.gadgets.worlds
;
M:
my-world
begin-world
[
drop
open-game-input
]
[
M\
my-world
begin-world
(call-next-method)
]
bi
;
USING:
kernel
ui.gadgets.worlds
ui.gadgets.worlds.null
;
M:
null-world
begin-world
drop
;
USING:
accessors
kernel
opengl.capabilities
opengl.demo-support
opengl.gl
spheres
ui.gadgets.worlds
;
M:
spheres-world
begin-world
"2.0"
{
"GL_ARB_shader_objects"
}
require-gl-version-or-extensions
{
"GL_EXT_framebuffer_object"
}
require-gl-extensions
GL_DEPTH_TEST
glEnable
GL_VERTEX_ARRAY
glEnableClientState
0.15 0.15 1.0 1.0
glClearColor
20.0 10.0 20.0
set-demo-orientation
(plane-program)
>>plane-program
(solid-sphere-program)
>>solid-sphere-program
(texture-sphere-program)
>>texture-sphere-program
(make-reflection-texture)
>>reflection-texture
(make-reflection-depthbuffer)
[
>>reflection-depthbuffer
]
keep
(make-reflection-framebuffer)
>>reflection-framebuffer
drop
;
USING:
kernel
ui.gadgets.worlds
;
M:
world
begin-world
drop
;