mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-05 16:00:06 +01:00
got shaders playing crudely and openframeworks being run from python
This commit is contained in:
23
actions.py
23
actions.py
@@ -287,6 +287,28 @@ class Actions(object):
|
||||
print('it is not in !')
|
||||
self.data.update_setting_value('other','DEV_MODE_RESET', 'off')
|
||||
|
||||
def check_if_should_start_openframeworks(self):
|
||||
if self.data.settings['other']['VIDEO_BACKEND']['value'] == 'openframeworks':
|
||||
pass
|
||||
subprocess.Popen(["make run --directory=~/openFrameworks/apps/myApps/c_o_n_j_u_r" ], shell=True)
|
||||
|
||||
def exit_openframeworks(self):
|
||||
self.video_driver.osc_client.send_message("/exit", True)
|
||||
|
||||
def toggle_of_screen_size(self, value):
|
||||
if value == 'dev':
|
||||
self.video_driver.osc_client.send_message("/dev_mode", True)
|
||||
else:
|
||||
self.video_driver.osc_client.send_message("/dev_mode", False)
|
||||
|
||||
def switch_video_backend(self, state):
|
||||
if state == 'openframeworks':
|
||||
self.check_if_should_start_openframeworks()
|
||||
elif state == 'omxplayer':
|
||||
self.exit_openframeworks()
|
||||
self.video_driver.reset_all_players()
|
||||
|
||||
|
||||
def change_composite_setting(self, setting_value):
|
||||
if setting_value == 'composite':
|
||||
mode = self.data.settings['video']['COMPOSITE_TYPE']['value']
|
||||
@@ -365,6 +387,7 @@ class Actions(object):
|
||||
|
||||
def quit_the_program(self):
|
||||
self.video_driver.exit_all_players()
|
||||
self.exit_openframeworks()
|
||||
self.exit_osc_server('','')
|
||||
self.toggle_x_autorepeat()
|
||||
self.tk.destroy()
|
||||
|
||||
@@ -123,8 +123,16 @@
|
||||
],
|
||||
"value": "off"
|
||||
},
|
||||
"OF_SCREEN_SIZE": {
|
||||
"action": "toggle_of_screen_size",
|
||||
"options": [
|
||||
"full",
|
||||
"dev"
|
||||
],
|
||||
"value": "dev"
|
||||
},
|
||||
"VIDEO_BACKEND": {
|
||||
"action": null,
|
||||
"action": "switch_video_backend",
|
||||
"options": [
|
||||
"omxplayer",
|
||||
"openframeworks"
|
||||
|
||||
@@ -58,6 +58,7 @@ analog_input = AnalogInput(tk, message_handler, display, actions, data)
|
||||
|
||||
actions.check_and_set_output_mode_on_boot()
|
||||
actions.check_dev_mode()
|
||||
actions.check_if_should_start_openframeworks()
|
||||
actions.toggle_x_autorepeat()
|
||||
|
||||
frame.pack()
|
||||
|
||||
23
shader_experiments/flowing_colours.frag
Normal file
23
shader_experiments/flowing_colours.frag
Normal file
@@ -0,0 +1,23 @@
|
||||
// copied from http://glslsandbox.com/e#47821.0
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#extension GL_OES_standard_derivatives : enable
|
||||
|
||||
uniform float u_time;
|
||||
uniform vec2 u_mouse;
|
||||
uniform vec2 u_resolution;
|
||||
|
||||
void main( void ) {
|
||||
|
||||
vec2 position = ( gl_FragCoord.xy / u_resolution.xy ) + u_mouse / 4.0;
|
||||
|
||||
float color = 0.0;
|
||||
color += sin( position.x * cos( u_time / 15.0 ) * 80.0 ) + cos( position.y * cos( u_time / 15.0 ) * 10.0 );
|
||||
color += sin( position.y * sin( u_time / 10.0 ) * 40.0 ) + cos( position.x * sin( u_time / 25.0 ) * 40.0 );
|
||||
color += sin( position.x * sin( u_time / 5.0 ) * 10.0 ) + sin( position.y * sin( u_time / 35.0 ) * 80.0 );
|
||||
color *= sin( u_time / 10.0 ) * 0.8;
|
||||
|
||||
gl_FragColor = vec4( vec3( color, color * 0.5, sin( color + u_time / 3.0 ) * 0.75 ), 1.0 );
|
||||
}
|
||||
@@ -17,14 +17,10 @@ class VideoDriver(object):
|
||||
|
||||
self.layer = self.MAX_LAYER
|
||||
|
||||
if(self.data.settings['other']['VIDEO_BACKEND']['value'] == 'openframeworks'):
|
||||
self.last_player = AltVideoPlayer(self.root, self.message_handler, self.data, self.osc_client, 'a.a')
|
||||
self.current_player = AltVideoPlayer(self.root,self.message_handler, self.data, self.osc_client, 'b.b')
|
||||
self.next_player = AltVideoPlayer(self.root, self.message_handler, self.data, self.osc_client, 'c.c')
|
||||
else:
|
||||
self.last_player = VideoPlayer(self.root, self.message_handler, self.data, 'a.a')
|
||||
self.current_player = VideoPlayer(self.root,self.message_handler, self.data, 'b.b')
|
||||
self.next_player = VideoPlayer(self.root, self.message_handler, self.data, 'c.c')
|
||||
self.last_player = None
|
||||
self.current_player = None
|
||||
self.next_player = None
|
||||
self.reset_all_players()
|
||||
|
||||
self.root.after(self.delay, self.begin_playing)
|
||||
self.print_status()
|
||||
@@ -117,8 +113,24 @@ class VideoDriver(object):
|
||||
return self.next_player.start, self.next_player.end, self.next_player.get_position()
|
||||
|
||||
def exit_all_players(self):
|
||||
if self.next_player:
|
||||
self.next_player.exit()
|
||||
if self.current_player:
|
||||
self.current_player.exit()
|
||||
if self. last_player:
|
||||
self.last_player.exit()
|
||||
|
||||
def reset_all_players(self):
|
||||
self.exit_all_players()
|
||||
|
||||
if(self.data.settings['other']['VIDEO_BACKEND']['value'] == 'openframeworks'):
|
||||
self.last_player = AltVideoPlayer(self.root, self.message_handler, self.data, self.osc_client, 'a.a')
|
||||
self.current_player = AltVideoPlayer(self.root,self.message_handler, self.data, self.osc_client, 'b.b')
|
||||
self.next_player = AltVideoPlayer(self.root, self.message_handler, self.data, self.osc_client, 'c.c')
|
||||
else:
|
||||
self.last_player = VideoPlayer(self.root, self.message_handler, self.data, 'a.a')
|
||||
self.current_player = VideoPlayer(self.root,self.message_handler, self.data, 'b.b')
|
||||
self.next_player = VideoPlayer(self.root, self.message_handler, self.data, 'c.c')
|
||||
|
||||
def reload_next_player(self):
|
||||
self.next_player.reload(self.get_next_layer_value())
|
||||
|
||||
Reference in New Issue
Block a user