update examples
This commit is contained in:
parent
ea29d96ff9
commit
1799c58ca5
9 changed files with 51 additions and 44 deletions
|
@ -77,8 +77,8 @@ while not window_should_close(): # Detect window close button or ESC key
|
|||
draw_texture_pro(target.texture, sourceRec, destRec, origin, 0.0, WHITE)
|
||||
end_mode_2d()
|
||||
|
||||
draw_text(text_format("Screen resolution: %ix%i", screenWidth, screenHeight), 10, 10, 20, DARKBLUE)
|
||||
draw_text(text_format("World resolution: %ix%i", virtualScreenWidth, virtualScreenHeight), 10, 40, 20, DARKGREEN)
|
||||
draw_text(f"Screen resolution: {screenWidth}, {screenHeight}", 10, 10, 20, DARKBLUE)
|
||||
draw_text(f"World resolution: {virtualScreenWidth}, {virtualScreenHeight}", 10, 40, 20, DARKGREEN)
|
||||
draw_fps(get_screen_width() - 95, 10)
|
||||
end_drawing()
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import pyray
|
||||
import raylib
|
||||
|
||||
GLSL_VERSION = 330
|
||||
|
||||
# Initialization
|
||||
|
@ -30,18 +32,18 @@ device = pyray.VrDeviceInfo(
|
|||
config = pyray.load_vr_stereo_config(device)
|
||||
|
||||
# Distortion shader (uses device lens distortion and chroma)
|
||||
distortion = pyray.load_shader(0, f"resources/distortion{GLSL_VERSION}.fs")
|
||||
distortion = pyray.load_shader(pyray.ffi.NULL, f"resources/distortion{GLSL_VERSION}.fs")
|
||||
|
||||
# Update distortion shader with lens and distortion-scale parameters
|
||||
pyray.set_shader_value(distortion, 2,"leftLensCenter", pyray.SHADER_UNIFORM_VEC2)
|
||||
pyray.set_shader_value(distortion, 2,"rightLensCenter", pyray.SHADER_UNIFORM_VEC2)
|
||||
pyray.set_shader_value(distortion, 2,"leftScreenCenter", pyray.SHADER_UNIFORM_VEC2)
|
||||
pyray.set_shader_value(distortion, 2,"rightScreenCenter", pyray.SHADER_UNIFORM_VEC2)
|
||||
pyray.set_shader_value(distortion, 2, pyray.ffi.new('char []', b"leftLensCenter"), pyray.SHADER_UNIFORM_VEC2)
|
||||
pyray.set_shader_value(distortion, 2,pyray.ffi.new('char []', b"rightLensCenter"), pyray.SHADER_UNIFORM_VEC2)
|
||||
pyray.set_shader_value(distortion, 2,pyray.ffi.new('char []', b"leftScreenCenter"), pyray.SHADER_UNIFORM_VEC2)
|
||||
pyray.set_shader_value(distortion, 2,pyray.ffi.new('char []', b"rightScreenCenter"), pyray.SHADER_UNIFORM_VEC2)
|
||||
|
||||
pyray.set_shader_value(distortion, 2,"scale", pyray.SHADER_UNIFORM_VEC2)
|
||||
pyray.set_shader_value(distortion, 2,"scaleIn", pyray.SHADER_UNIFORM_VEC2)
|
||||
pyray.set_shader_value(distortion, 4,"deviceWarpParam", pyray.SHADER_UNIFORM_VEC4)
|
||||
pyray.set_shader_value(distortion, 4,"chromaAbParam", pyray.SHADER_UNIFORM_VEC4)
|
||||
pyray.set_shader_value(distortion, 2,pyray.ffi.new('char []', b"scale"), pyray.SHADER_UNIFORM_VEC2)
|
||||
pyray.set_shader_value(distortion, 2,pyray.ffi.new('char []', b"scaleIn"), pyray.SHADER_UNIFORM_VEC2)
|
||||
pyray.set_shader_value(distortion, 4,pyray.ffi.new('char []', b"deviceWarpParam"), pyray.SHADER_UNIFORM_VEC4)
|
||||
pyray.set_shader_value(distortion, 4,pyray.ffi.new('char []', b"chromaAbParam"), pyray.SHADER_UNIFORM_VEC4)
|
||||
|
||||
# Initialize framebuffer for stereo rendering
|
||||
# NOTE: Screen size should match HMD aspect ratio
|
||||
|
|
Reference in a new issue