This repository was archived by the owner on Aug 27, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Osc shader #223
Open
avilleret
wants to merge
17
commits into
raspberrypi:master
Choose a base branch
from
avilleret:osc-shader
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Osc shader #223
Changes from 11 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
ac0be97
add a structure to hold shader parameters state
avilleret 04225cf
add method to create array of shader parameters and automatically fil…
avilleret eed9739
add an OpenGL scene
avilleret a859fd3
include the new scene in build system
avilleret b2331ed
new scene files
avilleret 529f4cf
add OSC support
avilleret 8e4a0fd
try to detect liblo automatically
avilleret 8809f9f
do not redefined VCOS_LOG_CATEGORY
avilleret 0f78260
fix typo
avilleret 635d169
add some tips to cross-compile with liblo
avilleret e52509a
add a OFF parameter for exposure setting
avilleret 8cf597e
Merge branch 'master' into osc-shader
avilleret fe627e0
some changes according to @timgover review
avilleret 150cb61
Merge branch 'master' into osc-shader
avilleret ddd6a66
fix build
avilleret 1a7c19b
Merge branch 'master' into osc-shader
avilleret 3bbf273
Merge remote-tracking branch 'avilleret/osc-shader' into osc-shader
avilleret File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -582,7 +582,25 @@ int raspitexutil_build_shader_program(RASPITEXUTIL_SHADER_PROGRAM_T *p) | |
| } | ||
| } | ||
|
|
||
| return 0; | ||
| /// Automatically find uniform variables | ||
| glGetProgramiv( p->program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &p->max_length); | ||
| glGetProgramiv( p->program, GL_ACTIVE_UNIFORMS, &p->uniform_count); | ||
| printf("found %d uniform variable(s) : \n",p->uniform_count); | ||
|
|
||
| raspitexutil_create_param_array(p); | ||
|
|
||
| GLchar *name= (GLchar*) malloc(sizeof(GLchar)*p->max_length); | ||
| GLsizei length=0; | ||
| RASPITEXUTIL_SHADER_PARAMETER_T *array = p->uniform_array; | ||
| for(i=0;i<p->uniform_count;i++){ | ||
| glGetActiveUniform(p->program, i, p->max_length, &length, &array[i].size, &array[i].type, name); | ||
| array[i].loc = glGetUniformLocation( p->program, name ); | ||
| strncpy(array[i].name,name,length+1); | ||
| printf("\t%s\n",name); | ||
| } | ||
| free(name); | ||
|
|
||
| return 0; | ||
|
|
||
| fail: | ||
| vcos_log_error("%s: Failed to build shader program", VCOS_FUNCTION); | ||
|
|
@@ -595,3 +613,38 @@ int raspitexutil_build_shader_program(RASPITEXUTIL_SHADER_PROGRAM_T *p) | |
| return -1; | ||
| } | ||
|
|
||
| void raspitexutil_create_param_array(RASPITEXUTIL_SHADER_PROGRAM_T *p) | ||
| { | ||
|
|
||
| int i; | ||
|
|
||
| p->uniform_array = (RASPITEXUTIL_SHADER_PARAMETER_T*) malloc(sizeof (RASPITEXUTIL_SHADER_PARAMETER_T) * p->uniform_count); | ||
| p->attribute_array = (RASPITEXUTIL_SHADER_PARAMETER_T*) malloc(sizeof (RASPITEXUTIL_SHADER_PARAMETER_T) * p->attribute_count); | ||
|
|
||
| RASPITEXUTIL_SHADER_PARAMETER_T* array = p->uniform_array; | ||
| // allocate maximum size for a param, which is a 4x4 matrix of floats | ||
| // in the future, only allocate for specific type | ||
| // also, technically we should handle arrays of matrices, too...sheesh! | ||
| for (i = 0; i < p->uniform_count; i++) { | ||
| int j=0; | ||
| array[i].size = 0; | ||
| array[i].type = 0; | ||
| array[i].loc = 0; | ||
| // uniform_array[i].param = (float*) malloc(sizeof(float)*16); | ||
| array[i].name = (GLchar*) malloc(sizeof(GLchar)* p->max_length+1);; | ||
| array[i].flag = 0; | ||
| for(j=0; j<16; j++)array[i].param[j]=0; | ||
| } | ||
|
|
||
| array = p->attribute_array; | ||
| for (i = 0; i < p->attribute_count; i++) { | ||
| int j=0; | ||
| array[i].size = 0; | ||
| array[i].type = 0; | ||
| array[i].loc = 0; | ||
| // attribute_array[i].param = (float*) malloc(sizeof(float)*16); | ||
|
||
| array[i].name = (GLchar*) malloc(sizeof(GLchar)* p->max_length+1); | ||
| array[i].flag = 0; | ||
| for(j=0; j<16; j++)array[i].param[j]=0; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented out code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done