fast shadows on smooth terrain

i have tryed a fast shadow on smooth terrain program in freebasic that works with transparent objects like trees too, and also opengl1.x and above.
heres how it works :
i take a glortho view of the scene from the direction of the light, centered on x,y,z player perso position
glMatrixMode GL_PROJECTION
glLoadIdentity
Var k=900
do2=45 'angle of light
ksin=kSin(do2degtorad):kcos=kCos(do2degtorad)
glortho(-k,k,-ksin,ksin,10,100000)
glmatrixmode gl_modelview
Var dbx=bmpx
glviewport(0,0,dbx,dbx)
tshadow=1
glLoadIdentity ()
If kcos<0 Then glrotatef(180,0,0,1)
glulookat(x,y-kcos10,z+ksin10, x,y,z, 0,0,1)
glcolor3f(1,1,1)
…here drawterrain with texture offset & zheight=z(player perso)
glcolor3f(0,0.3,0)
…here draw persos,trees, with zheight=z(player perso)
glReadPixels(0,0, dbx,dbx, GL_rgba, GL_UNSIGNED_BYTE, bmpbits) 'store view to bmpimage buffer
glbindtexture(gl_texture_2d,grasstexture) ’ grasstexture=texture used to draw near terrain
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_linear)
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_linear)'nomipmap (faster)
glTexSubImage2D(GL_TEXTURE_2D, 0, 0,0,bmpx,bmpy, GL_rgba, GL_UNSIGNED_BYTE, bmpbits)
’ store bmpimage buffer in terrain texture

'then i draw normal scene
glMatrixMode GL_PROJECTION
glLoadIdentity
’ anglevue xmax/ymax mxmin,mxmax
gluPerspective 48, xmax/ymax, 3.3, 100000
glmatrixmode gl_modelview
glviewport(0,0,xmax,ymax)
glcolor3f(1,1,1)
tshadow=0
… here draw normal scene with terrain texture,persos,trees, near terrain texture=texture with shadows

works with smooth terrain

you can find an example with source on freebasic forum

it’s not a question, stop spamming your site.

enhanced shadows speed :
glreadpixels + gltexsubimage2d replaced by glcopytexsubimage2D

glcopyTexSubImage2D(GL_TEXTURE_2D, 0, 0,0, 0,0,bmpx,bmpy) (direct copy from frame buffer to texture)

Dude, nobody cares. O_o

This is a forum for asking questions and discussing topics related to OpenGL directly, not some algorithm that just happens to be implemented using OpenGL that seems to work fine. If you have a specific problem with your algorithm that’s cool. Otherwise, please put your ideas somewhere else, a blog, your own website and so forth…

BTW, algorithms implemented using hardcore, immediate-mode legacy GL aren’t particularly sexy in 2013 …

enhanced shadows speed :
glreadpixels + gltexsubimage2d replaced by glcopytexsubimage2D

glcopyTexSubImage2D(GL_TEXTURE_2D, 0, 0,0, 0,0,bmpx,bmpy) (direct copy from frame buffer to texture)

You know what would “enhance” your “shadows speed” more? Rendering directly to the texture.

This is 2013; if you’re using glCopyTexSubImage for almost any reason, you’re doing it wrong.

well, his application shows 8 FPS in that scene. even on a crappiest laptop with the scene like that, it should be a 3-digit number. i would like to see real source code just for the sake of entertainment. i’m not sure if glCopyTexSubImage can cause such performance solely, unless you’re trying to do it on purpose.