Conversation
…l it work only with uniform for now TODO : support varying
this doesn't seem to work for cross-compiling yet
don't fully understand all the consequences of this...
don't know if it is a good idea since the image is black with this setting
|
@6by9 does this PR have any chance to be merged (look aside from the conflicts)? If not, it should be closed |
6by9
left a comment
There was a problem hiding this comment.
Already done. Needs to be dropped. It's not relevant to the PR either.
|
I know next to nothing about OpenGL so can't comment on that side. I don't know if @timgover has a few minutes and would be prepared to review the GL side of this. There are several other bits mixed in to the PR as well (eg liblo, and extra exposure mode) - if this is for a new OpenGL scene then it should ideally be just that bit. Raise separate PRs for the other things. I will find 10 mins to go through and review this, but comments like "don't fully understand all the consequences of this.." instill a deep sense of foreboding. |
# Conflicts: # host_applications/linux/apps/raspicam/CMakeLists.txt # host_applications/linux/apps/raspicam/RaspiStill.c
|
Hi, I just merge master into osc-shader branch to fix merging conflict. Fell free to ask me some modification before merging. |
timg236
left a comment
There was a problem hiding this comment.
I've only scanned the GL code, it looks ok, a few minor comments. It would be useful to have something in a comment that explains how people can use this.
It would be better if the GL scenes were plugins that were dynamically loaded with a slightly better defined GL interface. However, that's my fault for not designing it that way in the first place!
| array[i].size = 0; | ||
| array[i].type = 0; | ||
| array[i].loc = 0; | ||
| // uniform_array[i].param = (float*) malloc(sizeof(float)*16); |
| array[i].size = 0; | ||
| array[i].type = 0; | ||
| array[i].loc = 0; | ||
| // attribute_array[i].param = (float*) malloc(sizeof(float)*16); |
|
|
||
| static const GLfloat vertices[] = | ||
| { | ||
| #define V0 -0.8, 0.8, 0.8, |
There was a problem hiding this comment.
Any reason for the choice of 0.8 ?
There was a problem hiding this comment.
can't remember, maybe just aesthetic
|
|
||
| // allocate memory to contain the whole file: | ||
| shader.fragment_source = (GLchar*) malloc (sizeof(GLchar)*lSize); | ||
| if (shader.fragment_source == NULL) {fputs ("Memory error",stderr); exit (2);} |
There was a problem hiding this comment.
If these files are huge then it might be better to use mmap instead of malloc. If they are small then it's simpler to assume that malloc will succeed in userspace linux applications
There was a problem hiding this comment.
then I'll assume that malloc succeed
| if (result != lSize) {fputs ("Reading error",stderr); exit (3);} | ||
|
|
||
| printf("vertex shader file : %s\n", state->vertex_shader_filename); | ||
|
|
There was a problem hiding this comment.
It would be cleaner to return an erorr from this function instead of just exiting. RaspiStill might want to do explicit cleanup
There was a problem hiding this comment.
then shader_open() will return -1 on fread error, 0 on success and nothing if malloc fails
|
|
||
| pfFile = fopen (state->fragment_shader_filename,"rb"); | ||
| if (pfFile==NULL) { | ||
| printf("No or invalid fragment file provided, used the default one\n"); |
There was a problem hiding this comment.
It might be nicer to use stderr
|
Do I need to make more changes to see this PR merged ? |
|
@avilleret @6by9 Another one that has slipped through the cracks - what should we do here? |
|
@avilleret Sorry about the delay, would it be possible to rebase against the latest tree then we can try and get this merged. |
|
@avilleret ping |
|
I'll try to rebase this against master in the next few weeks and let you know |
|
Thanks. Quite a few changes in the camera code, so good luck! |
# Conflicts: # host_applications/linux/apps/raspicam/CMakeLists.txt # host_applications/linux/apps/raspicam/RaspiTex.c # host_applications/linux/apps/raspicam/RaspiTex.h
|
@JamesH65 could you give it a try ? I don't have a camera to check until January 6th |
|
@avilleret what do you say? |
|
@Ruffio, sorry, what is the question ? |
|
@avilleret did you check with camera? |
|
Sorry, this has just completely slipped past. I have no idea whether this would work on a Pi4, I suspect not. @timg236 Unfortunately needs to be rebased again. |
The Broadcom specific extensions are never going to work on Pi4, although if someone was sufficiently enthusiastic they could implement equivalent functionality using GLES 3.0 / MESA on Pi4. |
|
If this specific PR is never going to work, and therefor never goint to be accepted, then it should be rejected IMHO. |
|
It will work on Pi3 or older so long as the legacy GL driver is selected which I believe is the default |
this patch add a new OpenGL scene to Raspistill application.
It's called shader and let the user load vertex and fragment shader via command line.
Also, if compiled with liblo, it automatically exposed each uniform via OSC.
Thus any shader parameter can be controlled by another OSC capable application locally on the Pi or remotely.