Hi there I have modified the code so that the back wall and floor are textured. You could do exactly the same to texture the left and right walls.
Heres the new code:-
dim camx#
camx#=2.7
'declares an array of texztures from 0 to 4
dim texture(4)
'load 2 textures into the array texture
texture(0)=loadtexture("textures\ceil01.jpg") 'The back wall
texture(1)=loadtexture("textures\00001.jpg") 'The Floor
'This tells Basic4gl that the textures will be presented as 2d
glenable(gl_texture_2d)
while true
'Clear the Colour and the depth buffer'
glclear(gl_color_buffer_bit or gl_depth_buffer_bit)
glloadidentity()
gltranslatef(camx#,0.0,-4.0)
'the back wall'
'The Line Below sets which texture we shall use
'In this case Its the back wall texture
glbindtexture(gl_texture_2d,texture(0))
'Notice now that we have the new command gltexcoord2f
'This says that gltexcoord2f will use 2 floating point numbers
'as co-ordinates. These co-ordinates are used to attach the texture
'to the quad,try experimenting with different values to achieve better
'results
glbegin (gl_quads)
gltexcoord2f(0.0,0.0):glvertex3f(-5.0,-1.0,-1.0)
gltexcoord2f(0.0,1.0):glvertex3f(-5.0,1.4,-1.0)
gltexcoord2f(5.0,1.0):glvertex3f(5.0,1.4,-1.0)
gltexcoord2f(5.0,0.0):glvertex3f(5.0,-1.0,-1.0)
glend()
'You could set a bind texture as here to texture the left wall
'the left wall
glbegin(gl_quads)
glvertex3f(-5.0,-1.0,-1.0)
glvertex3f(-5.0,-1.0,1.0)
glvertex3f(-5.0,1.4,1.0)
glvertex3f(-5.0,1.4,-1.0)
glend()
'thr right wall
glbegin(gl_quads)
glvertex3f(5.0,1.4,1.0)
glvertex3f(5.0,1.4,-1.0)
glvertex3f(5.0,-1.0,-1.0)
glvertex3f(5.0,-1.0,1.0)
glend()
'the floor
'The Line Below sets which texture we shall use
'In this case Its the floor texture
glbindtexture(gl_texture_2d,texture(1))
glbegin(gl_quads)
gltexcoord2f(0.0,0.0):glvertex3f(-5.0,-1.0,-1.0)
gltexcoord2f(0.0,7.0):glvertex3f(5.0,-1.0,-1.0)
gltexcoord2f(7.0,7.0):glvertex3f(5.0,-1.0,1.0)
gltexcoord2f(7.0,0.0):glvertex3f(-5.0,-1.0,1.0)
glend()
'the ceiling
glbegin(gl_quads)
glvertex3f(-5.0,1.4,-1.0)
glvertex3f(-5.0,1.4,1.0)
glvertex3f(5.0,1.4,1.0)
glvertex3f(5.0,1.4,-1.0)
glend()
'use the cursor keys to move the quad'
if scankeydown(vk_left) then camx#=camx#+0.040:endif
if scankeydown(vk_right) then camx#=camx#-0.040:endif
if camx#<-2.7 then camx#=-2.7:endif
if camx#>2.7 then camx#=2.7:endif
swapbuffers()
wend
Hope this helps
mattyp1977