I am in the process of trying to add a bloom or glow effect to a laser. Could someone comment on the following if they see something obviously wrong? I am an SDK 2.3 owner by the way. Thanks
Here is my simple test program:
Framework leadwerks.engine
'Create an OpenGL graphics window
Graphics 800, 600
'Allows the engine to find files and load files from zip packages
RegisterAbstractPath AppDir
'Create a world
If Not CreateWorld() RuntimeError "Failed to create world."
'Create a camera
cam:TCamera = CreateCamera()
CameraClearColor(cam, Vec4(0, 0, 0, 1))
RotateEntity(cam, Vec3(35, 0, 0))
MoveEntity cam, Vec3(0, 0, - 2)
'add a light
light:TLight = CreateDirectionalLight()
RotateEntity light, Vec3(45, 45, 0)
buffer:TBuffer = CreateBuffer(800, 600, BUFFER_COLOR | BUFFER_DEPTH | BUFFER_NORMAL | BUFFER_COLOR1)
'Create a render buffer For post - processing effects
postbuffer:TBuffer = CreateBuffer(800, 600, BUFFER_COLOR)
TextureFilter(GetColorBuffer(postbuffer), TEXFILTER_SMOOTH)
postfilter:TShader = LoadShader("abstract::postfilter.vert", "abstract::postfilter_bloom.frag")
DebugLights(True)
mesh1:TMesh = LoadMesh("laser_laser.gmf")
If Not mesh1 RuntimeError "Failed to laser mesh"
PositionEntity mesh1, Vec3(0, 0, 0)
'Main loop
While Not KeyHit(KEY_ESCAPE)
TurnEntity mesh1, Vec3(0, 0.5, 0)
'Update timing, physics, and other miscellaneous updates
UpdateWorld
'Draw the world
SetBuffer(buffer)
RenderWorld
SetBuffer(postbuffer)
RenderLights(buffer)
SetBuffer(BackBuffer())
SetShader(postfilter)
BindTexture(GetDepthBuffer(buffer), 1)
BindTexture(GetColorBuffer(postbuffer, 1), 0)
DrawImage(GetColorBuffer(postbuffer), 0, GraphicsHeight(), GraphicsWidth(), - GraphicsHeight())
Flip
Wend
And my mat file for the laser appears as follows:
texture0="abstract::laserred.dds"
clamp0=0,0,0
blend=0
depthmask=1
depthtest=1
overlay=0
zsort=0
cullface=1
castshadows=1
specular=0.000000000
bumpscale=0.300000012
gloss=0.250000000
shader="abstract::mesh_diffuse.vert","abstract::postfilter_bloom.frag"
shadowshader="abstract::mesh_diffuse.vert",""