Hello folks!
Currently I rewrite all shaders used in the Insel Simulator 2014 and noticed that the second texture layer of an object, given by the detail map shader has no mipmaps on it. I use AGK1 with glsl 1.20. (BTW what glsl version has AGK2?) I searched the web and found solutions for glsl 2.0 and above, but not for v120.
I have attached a demonstration of the detail map shader with lighting. (Use it for free, no credits needed xD)
To activate or deactivate the shader, press the space key. If you turn on the shader, you will notice a flickering on the box.
(Or is this a AGK1 problem?)
I searched the forums but there was no answer to this question. Is there any solution for that? I would really like to use the mipmaps.
Code to look at:
rem
rem AGK Application
rem
rem A Wizard Did It!
SetVirtualResolution ( 1280, 720 )
SetOrientationAllowed(0,0,1,1)
img=loadimage("bench.png")
box=createobjectbox(50,50,50)
rem setobjectscale(box,2,2,2)
setobjectimage(box,img,0)
setobjectrotation(box,0,45,0)
DetailMapShader=LoadShader("oa_detail.vs","oa_detail.ps")
DetailMap=loadimage("detail.png")
SetImageWrapU(DetailMap,1)
SetImageWrapV(DetailMap,1)
SetObjectImage(box,DetailMap,1)
detailSX#=1.0
detailSY#=1.0
SetShaderConstantByName( DetailMapShader, "ScaleDetailMap",detailSX# ,detailSY#,0, 0 ) // passed by the main function paramaters to control the appearance
SetObjectShader(box,DetailMapShader)
// create a directional light (at the moment, the point light only works if there is also a directional light)
CreateLightDirectional(1,0,-1,0,255,0,0)
// create a position light (make sure that is close enough to the sphere to illuminate it)
CreateLightPoint(1,50,50,50,1000,0,255,0)
SetCameraPosition(1,100,100,-100)
SetCameraLookAt(1,0,0,0,0)
setprintsize(20)
do
SetLightPointPosition( 1, sin(-getobjectangley(box))*100, 5, cos(-getobjectangley(box))*100 )
if getrawkeystate(32)=1 and tt=0
inc shader
if shader>1 then shader=0
tt=1
endif
if getrawkeystate(32)=0 then tt=0
if shader=0
SetObjectShader(box,0)
print("Detail shader off")
endif
if shader=1
SetObjectShader(box,DetailMapShader)
print("Detail shader on")
endif
rem turn object
setobjectrotation(box,0,getobjectangley(box)+0.1,0)
print("Online Arts detail map shader with 1 directional light(movies.online-arts.de)")
print("Press Space to add/remove the detailmap shader")
Sync()
loop