Has anyone an idea how to use a cube map (skybox) with tier 1?
I tried it that way.
AGK Tier 1
// Project: Shader Test
// Created: 2015-01-12
// set window properties
SetWindowTitle( "Shader Test" )
SetWindowSize( 1024, 768, 0 )
// set display properties
SetVirtualResolution( 1024, 768 )
SetOrientationAllowed( 1, 1, 1, 1 )
//LoadObject( 1, "teapot.obj" )
CreateObjectBox(1, 2, 2, 2)
SetObjectCullMode( 1, 2)
SetObjectScale(1, 100, 100, 100)
LoadImage( 1, "ft.jpg" )
LoadImage( 2, "bk.jpg" )
LoadImage( 3, "lf.jpg" )
LoadImage( 4, "rt.jpg" )
LoadImage( 5, "up.jpg" )
LoadImage( 6, "dn.jpg" )
for i = 1 to 6
SetImageMinFilter( i, 1 )
SetImageMagFilter( i, 1 )
SetImageWrapU( i, 0 )
SetImageWrapV( i, 0 )
next i
SetObjectImage( 1, 1, 0 )
SetObjectImage( 1, 2, 1 )
SetObjectImage( 1, 3, 2 )
SetObjectImage( 1, 4, 3 )
SetObjectImage( 1, 5, 4 )
SetObjectImage( 1, 6, 5 )
SetCameraPosition( 1, 0, 0, 0)
LoadShader( 1, "vertex.vs", "pixel.ps" )
SetObjectShader( 1, 1 )
do
SetObjectRotation( 1, GetPointerY(), GetPointerX(), 0 )
Print( ScreenFPS() )
Sync()
loop
end
Shader
uniform sampler2D texture0;
uniform sampler2D texture1;
uniform sampler2D texture2;
uniform sampler2D texture3;
uniform sampler2D texture4;
uniform sampler2D texture5;
varying vec2 uvVarying;
varying vec4 posVarying;
void main()
{
vec4 color;
if (posVarying.x >= 1.0) color = texture2D(texture0, uvVarying);
else if (posVarying.x <= -1.0) color = texture2D(texture1, uvVarying);
if (posVarying.y >= 1.0) color = texture2D(texture4, uvVarying);
else if (posVarying.y <= -1.0) color = texture2D(texture5, uvVarying);
if (posVarying.z >= 1.0) color = texture2D(texture2, uvVarying);
else if (posVarying.z <= -1.0) color = texture2D(texture3, uvVarying);
gl_FragColor = color;
}
The result is not good. See the picture below.
Have anyone a solution for the clipping problem or a other way to do this.