Create shadows

Hello all…
I was doing a trial small game and liked to put shadow for each model in the game…but after I saw the tutorial called shadow, I get shocked because it is so hard to do using Cg or GLSL, and I didn’t understand anything from these scripts

-Is there an easy way to make shadows without the use of Cg or GLSL language?

-could I find a good site that explain this language in details?

Thanks in advance

As of Panda3D 1.7.0, you can use shadows via the Shader Generator, so you won’t have to write shaders yourself.

I read about doing shadows in 1.7.0 version, but no shadow appears when I tried it
here is the code:

import direct.directbase.DirectStart
from pandac.PandaModules import DirectionalLight,VBase4
from panda3d.core import Shader

cube=loader.loadModel("cube.egg")
cube.reparentTo(render)
cube.setPos(0,8,-0.8)

sphere=loader.loadModel("sphere.egg")
sphere.reparentTo(render)
sphere.setPos(0,8,0)

plight=DirectionalLight('plight')
plight.setColor(VBase4(0.5,0.5,0.5,1))
plnp=render.attachNewNode(plight)
plnp.setHpr(0,270,0)
render.setLight(plnp)

base.camLens.setFov(30)
plight.setShadowCaster(True, 512, 512)
sphere.setShaderAuto()
run()

and it also gives me this message:

:display:gsg:glgsg(error): c:\panda3d-1.7.0\panda\src\glstuff\glGraphicsBuffer_src.cxx, line 989: GL error 1282

I don’t know what is the problem

DirectionalLights are a bit tricky to setup for shadowing. You have to adjust the frustum of the lens (film size, near/far, etc) in order to get it to cast shadows properly.

use plight.showFrustum() to see the fustrum so you can set it up right.

plight.getLens().setFilmSize(1000,1000)
plight.getLens().setFar(1000)

is how ive set it up, a cube of length 1000 in every axis.

i also had another bug (which ive yet to investigate) but if you still cant see shadows after that, try creating a spotlight, for whatever reason that made my directional light magically start casting shadows (my spotlight was coded exactly as the one in the manual).