i modified the sample cubicsphere.o2bas to become Cubicsphere2.o2bas
by adding some labels and remove some objects as shown in the image below.
but i couldn't change the color of the text label and also there is a dash line at the bottom
of the screen. can some one help to resolve these problems?
thanxx in advance
$ title "Cubic sphere2"
$ FileName "Cubicsphere2.exe"
uses RTL64
$ fontA "Arial",FW_SEMIBOLD
% ExplicitMain
% MultiSamples 4 '0..4..16
include "OpenglSceneFrame.inc"
uses shapes
uses materials
uses glo2\textures
uses particles
uses MinMidi
indexbase 1
float ang1
int cube,sphere,helix,tors,csface
sys hmo 'midi
Cloud cloud1
Smoke smoke1
Plant fern
sub InitMidi()
================
int er
er=midiOutOpen(hmo, 0, 0, 0, CALLBACK_NULL) '0=synth a 2=soft synth
midiOutShortMsg(hmo, 0xC0+0x0D00) 'Xylophone Bells assign
end sub
function ding(int v,n)
======================
if v>127 then v=127
if v<10 then v=10
'midiOutShortMsg(hmo, v*0x10000+n*0x100+0x89) 'percussion off
midiOutShortMsg(hmo, v*0x10000+n*0x100+0x99) 'percussion on
end function
sub initialize(sys hWnd)
========================
'
InitMidi
GDIplus 1
'
static sys p,res=256
BuildTextures 16,res
p=fern.new res,32000 'pixel map
MakeTexture p,res,res,texn[12]
fern.free
'cube=CompileList : CubeForm : glEndList
sphere=CompileList : Spheric 1,1,6 : glEndList
'
SetTimer hWnd,1,10,null
end sub
sub Release(sys hwnd)
'====================
DeleteAllGlCompiled
DeleteTextures 16
Gdiplus 0
killTimer hwnd, 1
MidiOutClose hmo
end sub
sub RenderPlane(int tex, float u,v)
===================================
glBindTexture GL_TEXTURE_2D,tex
glBegin GL_QUADS
glTexCoord2f 0.0,0.0 : glVertex3f -1.0,0,-1.0
glTexCoord2f u ,0.0 : glVertex3f 1.0,0,-1.0
glTexCoord2f u ,v : glVertex3f 1.0,0, 1.0
glTexCoord2f 0.0,v : glVertex3f -1.0,0, 1.0
glend
end sub
sub scene(sys hWnd)
===================
'
static single ra,ri
' increase angle to increase rotation speed
static angi1=5
'
ActiveFrame
' glClearColor 0.5, 0.5, 0.7, 0
glClearColor 0, 224, 200, 0
StandardLighting li
' texture type -- see glo2\textures.inc
int t1=texn[10] ' marble
int t2=texn[11] ' green plane
' soft intense shadow texture texn[5] -- gives a translucent texture
' ' display the text label1
glPushMatrix
' gltranslatef -1.5,0.,-1.0
gltranslatef -.5,0.,-1.0
' glscalef .25,.3,.01
glScalef( 0.15, 0.2, .01)
' glColor3f .99,.99,.00
glColor3f 255,127,80
gprint "My Product"
' display the text label2
glPushMatrix
gltranslatef -.5, -1.5,-1.0
' glscalef .25,.3,.01
glScalef( 0.15, 0.2, .01)
' glColor3f .99,.99,.00
gprint "Label 2"
'
'TILES **************************
glPushMatrix
glEnable GL_TEXTURE_2D
glTranslatef -8.0,-1.99,-5.0
glScalef .25,1.,.25
glPushMatrix
int i,j
for j=1 to 16
for i=1 to 16
RenderPlane t1,1.,1.
glTranslatef 4.,0.,0.
next
glTranslatef -62.,0.,-2.
next
glPopMatrix
glDisable GL_TEXTURE_2D
glPopMatrix
'
' RING -- torus ---------------------------------------------
GoldMaterial.act
'glEnable GL_TEXTURE_2D
'glBindTexture GL_TEXTURE_2D,texn[2]
glPushMatrix
glTranslatef 2.6,1.8,-6.0
'glrotatef -45.,0,1,0
'glrotatef 90.0,1,0,0
glScalef .75,1.00,.75
if not tors
tors=CompileList : torus 1.,.20 : glEndList
end if
glCallList tors
glPopMatrix
glDisable GL_TEXTURE_2D
'
'METALLIC ORBS ---------------------------
glPushMatrix
glTranslatef 0.5,-1.5,-8.0
glScalef .25,.25,.25
SilverMaterial.act
glCallList sphere
glPopMatrix
'
glPushMatrix
glTranslatef 1.0,-1.5,-9.0
glScalef .25,.25,.25
SteelMaterial.act
glCallList sphere
glPopMatrix
'
'GLOBE -- rotating globe in the middle --------------------
if not csface
csface=CompileList
CubicFace 8
glEndList
end if
glPushMatrix
glTranslatef -1.0,0.,-6.0
glRotatef ang1,0,1,0
'RedShinyMaterial.act
'whiteMaterial.act
GoldMaterial.act
' texture is needed to show rotation
glEnable GL_TEXTURE_2D
' using
glBindTexture GL_TEXTURE_2D, texn[10] 't2 'texn(3)
glCallList csface
glRotatef 90.0,0,1,0
glCallList csface
glRotatef 90.0,0,1,0
glCallList csface
glRotatef 90.0,0,1,0
glCallList csface
glRotatef 90.0,1,0,0
glCallList csface
glRotatef 180.0,1,0,0 'top
glCallList csface
glPopMatrix
glDisable GL_TEXTURE_2D
'
'
'CONE
glPushMatrix
SilverMaterial.act
glTranslatef -1.1,-2.,-6.0
glScalef .5,.5,.5
' glBindTexture GL_TEXTURE_2D,t1
ConeFaces 16,0.,2.,0.
glPopMatrix
ang1+=angi1
if ang1>360 then ang1-=360
sleep 10
end sub
MainWindow width,height,WS_OVERLAPPEDWINDOW