Skip to content

Commit

Permalink
Investigate offscreen cameras.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gamenot committed Oct 25, 2023
1 parent d4a1453 commit fb43695
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions smarts/sstudio/graphics/perlin_bytemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,17 @@ def generate_red(
from smarts.core import glsl
from smarts.p3d.renderer import DEBUG_MODE, Renderer

renderer = Renderer("noise renderer", debug_mode=DEBUG_MODE.ERROR)
renderer = Renderer("noise renderer", debug_mode=DEBUG_MODE.ERROR, rendering_backend="p3headlessgl")
renderer._ensure_root()
offscreen_camera = renderer.build_offscreen_camera("simplex",
0,
width,
height,
1,
)

toNoiseTex = Texture("noise-texture")
toNoiseTex.setup_2d_texture(512, 512, Texture.T_unsigned_byte, Texture.F_rgb8)
toNoiseTex.setup_2d_texture(width, height, Texture.T_unsigned_byte, Texture.F_rgb8)
toNoiseTex.set_clear_color((0, 0, 0, 0))

with pkg_resources.path(
Expand All @@ -159,7 +165,7 @@ def generate_red(
interquad = manager.renderQuadInto(colortex=toNoiseTex)
interquad.setShader(Shader.load(Shader.SL_GLSL, vertex=vshader_path, fragment=simplex_shader))
interquad.setShaderInput("toNoiseTex", toNoiseTex)
interquad.setShaderInput("iResolution", n1=512, n2=512)
interquad.setShaderInput("iResolution", n1=width, n2=height)

renderer._showbase_instance.render_node(renderer._showbase_instance.cam)
# import time
Expand Down

0 comments on commit fb43695

Please sign in to comment.