Post by glneo on Jun 21, 2004 19:16:42 GMT -5
O.K. I need help getting the bird to have the right angle you'll see. p.s. It's a vary weird demo and the code is vary messy
dim lix#
dim liy#
dim angle#
dim x#: x# = 1
dim y#: y# = 1
dim c#(360)
dim s#(360)
dim i
dim y2#
dim x2#
dim xrot#
dim yrot#
dim zrot#
dim x
dim texture
dim dis
dim lightpos# (3)
dim lightdif# (3)
dim light2dif# (3)
dim light2pos# (3)
dim lightamb# (3)
dim lightx#
dim lighty#
dim star#(1000)(2)
dim t
dim rt
dim wing#
dim wings#
for t = 1 to 1000
star#(t) = vec3 (rnd () % 201 - 100, rnd () % 201 - 100, -t)
next
x = 1
FOR i = 0 TO 359
c#(i) = COS(i * 3.14 / 180)
s#(i) = SIN(i * 3.14 / 180)
NEXT
wings# = 9.5
angle# = 0
texture = LoadMipmapTexture ("Data/tim.bmp")
if texture = 0 then print "Failed to load texture": end: endif
glEnable(gl_light1)
glEnable(gl_light2)
glEnable(gl_lighting)
glEnable(GL_texture_2D)
glEnable(GL_cull_face)
glEnable(gl_fog)
glfogi(gl_fog_mode, GL_Linear)
glfogf(gl_fog_end, 1000)
glfogf(gl_fog_start, 0)
glfogfv(GL_fog_color, vec3(1, 1, 0))
glBindTexture(GL_TEXTURE_2D, texture)
dis = glgenlists (1)
glnewlist (dis, gl_compile)
glbegin (gl_quads)
glnormal3f (0.0, 0.0, 1.0)
gltexcoord2f(.35, 0): glvertex3f( -.3, -2.3, 0.0) '1
gltexcoord2f(.35, 1): glvertex3f( -.3, 1.0, 0.0) '2
gltexcoord2f(.65, 1): glvertex3f( .3, 1.0, 0.0) '3
gltexcoord2f(.65, 0): glvertex3f(.3, -2.3, 0.0) '4
glnormal3f (0.0, 0.0, 1.0)
gltexcoord2f(0, .62955556): glvertex3f(-.9, -.3, 0.0) '5
gltexcoord2f(0, .800222222): glvertex3f(-.9, .3, 0.0) '6
gltexcoord2f(1, .800222222): glvertex3f(.9, .3, 0.0) '7
gltexcoord2f(1, .62955556): glvertex3f(.9, -.3, 0.0) '8
glnormal3f (0.0, 0.0, -1.0)
gltexcoord2f(.65, 0): glvertex3f(.3, -2.3, 0.4)
gltexcoord2f(.65, 1): glvertex3f( .3, 1.0, 0.4)
gltexcoord2f(.35, 1): glvertex3f( -.3, 1.0, 0.4)
gltexcoord2f(.35, 0): glvertex3f( -.3, -2.3, 0.4)
glnormal3f (0.0, 0.0, -1.0)
gltexcoord2f(1, .62955556): glvertex3f(.9, -.3, 0.4)
gltexcoord2f(1, .800222222): glvertex3f(.9, .3, 0.4)
gltexcoord2f(0, .800222222): glvertex3f(-.9, .3, 0.4)
gltexcoord2f(0, .62955556): glvertex3f(-.9, -.3, 0.4)
glnormal3f (0.0, 1.0, 0.0)
gltexcoord2f(0, .61111111): glvertex3f(-.9, .3, 0.4)
gltexcoord2f(1, .61111111): glvertex3f(.9, .3, 0.4)
gltexcoord2f(1, .38888888): glvertex3f(.9, .3, 0.0)
gltexcoord2f(0, .38888888): glvertex3f(-.9, .3, 0.0)
glnormal3f (0.0, -1.0, 0.0)
gltexcoord2f(0, .38888888): glvertex3f(-.9, -.3, 0.0)
gltexcoord2f(1, .38888888): glvertex3f(.9, -.3, 0.0)
gltexcoord2f(1, .61111111): glvertex3f(.9, -.3, 0.4)
gltexcoord2f(0, .61111111): glvertex3f(-.9, -.3, 0.4)
glnormal3f (-1.0, 0.0, 0.0)
gltexcoord2f(.4, 0): glvertex3f(-.3, -2.3, 0.4)
gltexcoord2f(.4, 1): glvertex3f(-.3, 1.0, 0.4)
gltexcoord2f(.6, 1): glvertex3f(-.3, 1.0, 0.0)
gltexcoord2f(.6, 0): glvertex3f(-.3, -2.3, 0.0)
glnormal3f (1.0, 0.0, 0.0)
gltexcoord2f(.6, 0): glvertex3f(.3, -2.3, 0.0)
gltexcoord2f(.6, 1): glvertex3f(.3, 1.0, 0.0)
gltexcoord2f(.4, 1): glvertex3f(.3, 1.0, 0.4)
gltexcoord2f(.4, 0): glvertex3f(.3, -2.3, 0.4)
glnormal3f (0.0, 1.0, 0.0)
gltexcoord2f(.3333333, .3888888): glvertex3f( -.3, 1.0, 0.0)
gltexcoord2f(.3333333, .6111111): glvertex3f( -.3, 1.0, 0.4)
gltexcoord2f(.6666666, .6111111): glvertex3f( .3, 1.0, 0.4)
gltexcoord2f(.6666666, .3888888): glvertex3f(.3, 1.0, 0.0)
glnormal3f (0.0, -1.0, 0.0)
gltexcoord2f(.6666666, .6111111): glvertex3f( -.3, -2.3, 0.4)
gltexcoord2f(.6666666, .3888888): glvertex3f( -.3, -2.3, 0.0)
gltexcoord2f(.3333333, .3888888): glvertex3f( .3, -2.3, 0.0)
gltexcoord2f(.3333333, .6111111): glvertex3f(.3, -2.3, 0.4)
glnormal3f (1.0, 0.0, 0.0)
gltexcoord2f(.4, .6060606): glvertex3f( .9, -.3, 0.0)
gltexcoord2f(.4, .7878787): glvertex3f( .9, .3, 0.0)
gltexcoord2f(.6, .7878787): glvertex3f( .9, .3, 0.4)
gltexcoord2f(.6, .6060606): glvertex3f( .9, -.3, 0.4)
glnormal3f (-1.0, 0.0, 0.0)
gltexcoord2f(.6, .6060606): glvertex3f( -.9, -.3, 0.4)
gltexcoord2f(.6, .7878787): glvertex3f( -.9, .3, 0.4)
gltexcoord2f(.4, .7878787): glvertex3f( -.9, .3, 0.0)
gltexcoord2f(.4, .6060606): glvertex3f( -.9, -.3, 0.0)
glend ()
glendlist ()
while x = 1
angle# = angle# + 1
if angle# >= 360 then angle# = 0: endif
x2# = (X# * c#(angle#)) + (Y# * s#(angle#))
y2# = (Y# * c#(angle#)) - (X# * s#(angle#))
lix# = x2# + 0
liy# = y2# + 0
lightdif# = Vec4 (1.5, 1.5, 1.5, 1): gllightfv(gl_light1, gl_diffuse, lightdif#)
lightpos# = Vec4 (lix#, 1, -liy#, 1): gllightfv(gl_light1, gl_position, lightpos#)
light2dif# = Vec4 (1, 0, 0, 1): gllightfv(gl_light2, gl_diffuse, light2dif#)
light2pos# = Vec4 (0, 2, .2, 1): gllightfv(gl_light2, gl_position, light2pos#)
glclear ( gl_color_buffer_bit or gl_depth_buffer_bit )
glloadidentity ()
gltranslatef ( 0.0, 0.0, -6.0)
glrotatef (xrot#, 1.0, 0.0, 0.0)
glrotatef (yrot#, 0.0, 1.0, 0.0)
glrotatef (zrot#, 0.0, 0.0, 1.0)
for t = 1 to 1000
star#(t) = star#(t) + vec3(0, 0, 1)
if star#(t)(2) >= 0 then star#(t)(2) = -1000 endif
glBegin(gl_points)
glvertex3fv(star#(t))
glend ()
next
if wing# >= 2 then rt = 1: endif
if rt = 1 then
wing# = wing# - .3
endif
if wing# <= -2 then rt = 0: endif
if rt = 0 then
wing# = wing# + .3
endif
glbegin (gl_quads)
glVertex3f(-0.1 + lix#, .9, 0.1 + liy#)
glVertex3f( 0.1 + lix#, .9, 0.1 + liy#)
glVertex3f( 0.1 + lix#, 1.0, 0.1 + liy#)
glVertex3f(-0.1 + lix#, 1.0, 0.1 + liy#)
glVertex3f(-0.1 + lix#, .9, -0.1 + liy#)
glVertex3f(-0.1 + lix#, 1.0, -0.1 + liy#)
glVertex3f( 0.1 + lix#, 1.0, -0.1 + liy#)
glVertex3f( 0.1 + lix#, .9, -0.1 + liy#)
glVertex3f(-0.1 + lix#, 1.0, -0.1 + liy#)
glVertex3f(-0.1 + lix#, 1.0, 0.1 + liy#)
glVertex3f( 0.1 + lix#, 1.0, 0.1 + liy#)
glVertex3f( 0.1 + lix#, 1.0, -0.1 + liy#)
glVertex3f(-0.1 + lix#, .9, -0.1 + liy#)
glVertex3f( 0.1 + lix#, .9, -0.1 + liy#)
glVertex3f( 0.1 + lix#, .9, 0.1 + liy#)
glVertex3f(-0.1 + lix#, .9, 0.1 + liy#)
glVertex3f( 0.1 + lix#, .9, -0.1 + liy#)
glVertex3f( 0.1 + lix#, 1.0, -0.1 + liy#)
glVertex3f( 0.1 + lix#, 1.0, 0.1 + liy#)
glVertex3f( 0.1 + lix#, .9, 0.1 + liy#)
glVertex3f(-0.1 + lix#, .9, -0.1 + liy#)
glVertex3f(-0.1 + lix#, .9, 0.1 + liy#)
glVertex3f(-0.1 + lix#, 1.0, 0.1 + liy#)
glVertex3f(-0.1 + lix#, 1.0, -0.1 + liy#)
glVertex3f((-.05 + lix#), .95, .0 + liy#)
glVertex3f((-.08 + lix#), .95 + ((wing#/9.5)/3), .5 + liy#)
glVertex3f(( .08 + lix#), .95 + ((wing#/9.5)/3), .5 + liy#)
glVertex3f(( .05 + lix#), .95, .0 + liy#)
glVertex3f((-.05 + lix#), .95, .0 + liy#)
glVertex3f(( .05 + lix#), .95, .0 + liy#)
glVertex3f(( .08 + lix#), .95 + ((wing#/9.5)/3), .5 + liy#)
glVertex3f((-.08 + lix#), .95 + ((wing#/9.5)/3), .5 + liy#)
glend ()
glbegin (gl_triangles)
glvertex3f((-1.0/wings#) + lix#, .5/wings# + .9, (1.0/wings#)+liy#)
glvertex3f((-1.0/wings#) + lix#, .5/wings# + .9,(-1.0/wings#)+liy#)
glvertex3f((-4.0/wings#)+ lix#, (wing#/wings#) + .9, (0.0/wings#)+liy#)
glvertex3f((-1.0/wings#) + lix#, .5/wings# + .9,(-1.0/wings#)+liy#)
glvertex3f((-1.0/wings#) + lix#, .5/wings# + .9, (1.0/wings#)+liy#)
glvertex3f((-4.0/wings#)+ lix#, (wing#/wings#) + .9, (0.0/wings#)+liy#)
glvertex3f((1.0/wings#) + lix#, .5/wings# + .9,(-1.0/wings#)+liy#)
glvertex3f((1.0/wings#) + lix#, .5/wings# + .9, (1.0/wings#)+liy#)
glvertex3f((4.0/wings#)+ lix#, (wing#/wings#) + .9, (0.0/wings#)+liy#)
glvertex3f((1.0/wings#) + lix#, .5/wings# + .9, (1.0/wings#)+liy#)
glvertex3f((1.0/wings#) + lix#, .5/wings# + .9,(-1.0/wings#)+liy#)
glvertex3f((4.0/wings#)+ lix#, (wing#/wings#) + .9, (0.0/wings#)+liy#)
glend ()
glBegin(gl_points)
glvertex3f (lix#, 0, liy#)
glend ()
glcalllist (dis)
swapbuffers ()
if mouse_button (0) = true then
xrot# = xrot# + mouse_yd () * 100
yrot# = yrot# + mouse_xd () * 100
endif
if ScanKeyDown (VK_UP) then lighty# = lighty# + .1 endif
if ScanKeyDown (VK_DOWN) then lighty# = lighty# - .1 endif
if ScanKeyDown (VK_RIGHT) then lightx# = lightx# + .1 endif
if ScanKeyDown (VK_LEFT) then lightx# = lightx# - .1 endif
wend /me