Hey Raul, I think that Bill was suggesting that you convert the .ijs file to .txt before attaching. Did you attach a .txt version or the .ijs version of the file.
Cheers, bob > On Feb 28, 2020, at 09:23, Raul Miller <rauldmil...@gmail.com> wrote: > > And... I do not see the attachment at > http://jsoftware.com/pipermail/programming/2020-February/055193.html > > The other copy seems to indicate that my attachment got the mime type > "application/octet-stream", despite it being text content (I was > hoping for "text/plain".) > > That said, ... I should probably be experimenting on the chat forum. > But, also, I'm using gmail which does not seem to give me control over > the mime type of attachments (and researching this issue has lead me > into a maze of conflicting statements on the subject). > > So, anyways... while I haven't eliminated the possibility that forum > .ijs attachments might work, I am slightly sceptical at this point. > > Thanks, > > -- > Raul > > > > On Fri, Feb 28, 2020 at 12:15 PM Raul Miller <rauldmil...@gmail.com> wrote: >> >> Hmm... >> >> I am attaching an example .ijs file to this response. >> >> I am also bcc'ing a copy of this message to an alternate email >> address, so that I can see how it gets treated outside the forums. >> >> Will the attachment show up at >> http://jsoftware.com/pipermail/programming/2020-February/date.html? (I >> will see, soon...) >> >> Thanks, >> >> -- >> Raul >> >> On Fri, Feb 28, 2020 at 11:58 AM bill lam <bbill....@gmail.com> wrote: >>> >>> I think J forum actually accept text file attachments. >>> Attach .ijs file as .txt file probably work if email >>> client set mime type correctly. >>> >>> Fri, 28 Feb 2020, Raul Miller написал(а): >>>> This is getting to be long enough that it might help to use a resource >>>> like github (either a repository or a gist) or even pastebin (rather >>>> than email) to distribute it. >>>> >>>> (I'm still getting going for today, and haven't actually tried this, >>>> yet. But I'm anticipating some difficulties separating text from code >>>> and maybe chasing down implied pieces.) >>>> >>>> Thanks, >>>> >>>> -- >>>> Raul >>>> >>>> On Fri, Feb 28, 2020 at 8:52 AM Brian Schott <schott.br...@gmail.com> >>>> wrote: >>>>> >>>>> Bill, especially (Thomas, Raul, and others), >>>>> >>>>> Your comment regarding trying a simpler figure and simplifying the color >>>>> has led me to consider several alternatives. Below I show a revised script >>>>> which uses a tetrahedron (4 faces) and some color changes. I think the >>>>> tetrahedron is mostly working for me but I am really confused about the >>>>> colors. >>>>> >>>>> I apologize for the length of this email, but I have many questions. >>>>> >>>>> As an aside, I have discovered an error in the shader.ijs in the qtdemo's. >>>>> The last 0 in the following line should be a 1 because it's the alpha >>>>> value. (Coincidentally, there is another line in shader.ijs which also >>>>> addresses ClearColor, but it is ignored, I think, and it separates the >>>>> integers with ;'s .) Correcting that alpha value creates a black >>>>> background, which can be effective. >>>>> >>>>> glClearColor 0 0 0 0 >>>>> >>>>> Btw, I have left 2 glClearColor's in the script so it's easy to swap them: >>>>> white 1 1 1 1 and >>>>> black 0 0 0 1 . >>>>> >>>>> The major changes I have made to the script are the following. >>>>> >>>>> NB. changed cube to a mirrored sphenoid(?) >>>>> NB. (eg, see >>>>> https://en.wikipedia.org/wiki/Architectonic_and_catoptric_tessellation) >>>>> >>>>> rt=: (|.@:{)`[`]} NB. rotates vertices of xth face for winding order >>>>> vertexData=: 1&fc ,1 rt 3 rt 4 3 3$ %&10, 0&". ;._2 [ 0 : 0 >>>>> _3 _9 _4 >>>>> 3 _9 _4 >>>>> 0 0 2 >>>>> 0 8 _4 >>>>> ) >>>>> >>>>> I discovered that the verb `rt` (or something like it) is required to make >>>>> the tetrahedron work because of face winding issues. The original cube was >>>>> adjusted another way, apparently. >>>>> With `vertexData` defined either as above OR without `1&fc` prepended I >>>>> get >>>>> the SAME --mostly desirable-- results. The inclusion and exclusion of >>>>> `1&fc` giving the same result is confusing, by itself, and begs the >>>>> question, "Why is `1&fc` used?" >>>>> >>>>> I said "mostly desirable" above, instead of "desirable" because of the >>>>> next >>>>> 2 issues. >>>>> >>>>> v0) The 10 in the first line of the definition of vertexData is used to >>>>> simplify data entry and I have also used it to experiment with scaling the >>>>> size of the tetrahedron. This has led to another surprise, that no scaling >>>>> seems to result from increasing the 10 to 80 or so. Why? >>>>> >>>>> v1) I have been disillusioned by the face coloring of the tetrahedron, >>>>> even >>>>> in the simplest situations because when the tetrahedron is rotated in >>>>> certain directions, the black or white background seems to bleed through >>>>> one of the edges. What causes that? >>>>> >>>>> Now, moving on to coloring. I have no idea how the face COLORing works >>>>> using almost any version of `colorData` below. I can generalize though on >>>>> one thing: if I leave out the `1&fc`, no colors work on ANY version >>>>> of `colorData` . >>>>> >>>>> The first version below seems to give a complete tetrahedron except for >>>>> the >>>>> background color bleeding through one edge. And as mentioned earlier, it >>>>> only works with vertices rotated with the rt verb. >>>>> >>>>> colorData=: 1&fc ,1 rt 3 rt 4 3 3$ , 0&". ;._2 [ 0 : 0 >>>>> 0 0 1 >>>>> 1 1 1 >>>>> 1 0 0 >>>>> 0 1 0 >>>>> ) >>>>> >>>>> f0) If the 1's in the second row are changed to 0.9's, the background >>>>> color >>>>> no longer bleeds in. Why? >>>>> >>>>> f1) (This approach does not seem to work at all, and I have a replacement >>>>> for it that works a little, but will send it in a new message) I want 2 of >>>>> the faces in the tetrahedron to have the same color and each of the other >>>>> 2 >>>>> to have a different color (3 colors altogether). I devised the following >>>>> NONWORKING scheme of colors to accomplish this result. By nonworking I >>>>> mean >>>>> only the background color shows in the graphics pane, no tetrahedron. Why? >>>>> >>>>> colorData=: 1&fc ,_3]\3#"2] 0&". ;._2 [ 0 : 0 >>>>> 0 0 1 >>>>> 1 1 1 >>>>> 1 0 0 >>>>> 0 1 0 >>>>> ) >>>>> >>>>> To demonstrate the result above consider the following result which makes >>>>> each of the 4 faces, represented by the boxes' contents below, has 3 >>>>> identical rows. >>>>> ;/_3]\3#"2] 0&". ;._2 [ 0 : 0 >>>>> 0 0 1 >>>>> 1 1 1 >>>>> 1 0 0 >>>>> 0 1 0 >>>>> ) >>>>> +-----+-----+-----+-----+ >>>>> |0 0 1|1 1 1|1 0 0|0 1 0| >>>>> |0 0 1|1 1 1|1 0 0|0 1 0| >>>>> |0 0 1|1 1 1|1 0 0|0 1 0| >>>>> +-----+-----+-----+-----+ >>>>> >>>>> >>>>> >>>>> ***************my revised slider.ijs script is below************ >>>>> >>>>> cocurrent 'demoshader' >>>>> >>>>> mp=: (+/ . *)"2 >>>>> rt=: (|.@:{)`[`]}NB. rotates vertices of xth face for winding order >>>>> sprog=: 0 >>>>> GLSL=: 0 >>>>> STOP=: 0 >>>>> >>>>> A=: 0 : 0 >>>>> pc a; >>>>> minwh 300 300;cc g opengl flush; >>>>> rem form end; >>>>> ) >>>>> >>>>> a_run=: 3 : 0 >>>>> NB. if. -. checkrequire_qtdemo_ 'gles';'api/gles' do. return. end. >>>>> require 'gl2' >>>>> coinsert 'jgl2' >>>>> require 'gles' >>>>> coinsert 'jgles' >>>>> require '~addons/ide/qt/opengl.ijs' >>>>> coinsert 'qtopengl' >>>>> STEPS=: 100 >>>>> R=: 20 30 0 >>>>> EYE=: 0 0 1 >>>>> LR=: UD=: IO=: 0 >>>>> UP=: 0 1 0 >>>>> wd A >>>>> HD=: ".wd'qhwndc g' >>>>> wd 'ptimer 100' >>>>> wd 'pshow' >>>>> ) >>>>> >>>>> a_g_initialize=: 3 : 0 >>>>> if. p=. >@{. glGetString GL_VERSION do. smoutput 'GL_VERSION: ', memr 0 _1 >>>>> 2,~ p end. >>>>> if. 0=p do. smoutput 'cannot retrieve GL_VERSION' return. end. >>>>> if. p=. >@{. glGetString GL_VENDOR do. smoutput 'GL_VENDOR: ', memr 0 _1 >>>>> 2,~ p end. >>>>> if. p=. >@{. glGetString GL_RENDERER do. smoutput 'GL_RENDERER: ', memr 0 >>>>> _1 2,~ p end. >>>>> if. p=. >@{. glGetString GL_SHADING_LANGUAGE_VERSION do. smoutput >>>>> 'GL_SHADING_LANGUAGE_VERSION: ', memr 0 _1 2,~ p end. >>>>> GLSL=: wglGLSL'' >>>>> >>>>> wglPROC'' >>>>> sprog=: 0 >>>>> if. GLSL>120 do. >>>>> vsrc=. vsrc2 >>>>> fsrc=. fsrc2 >>>>> else. >>>>> vsrc=. vsrc1 >>>>> fsrc=. fsrc1 >>>>> if. 0=GLES_VERSION_jgles_ do. >>>>> vsrc=. vsrc,~ '#define lowp', LF, '#define mediump', LF, '#define >>>>> highp', LF >>>>> fsrc=. fsrc,~ '#define lowp', LF, '#define mediump', LF, '#define >>>>> highp', LF >>>>> end. >>>>> end. >>>>> vsrc=. '#version ',(":GLSL),((GLSL>:300)#(*GLES_VERSION){::' core';' >>>>> es'),LF,vsrc >>>>> fsrc=. '#version ',(":GLSL),((GLSL>:300)#(*GLES_VERSION){::' core';' >>>>> es'),LF,fsrc >>>>> if.(GLSL>:300)*.0~:GLES_VERSION_jgles_ do. >>>>> fsrc=. ('void main';'out vec4 gl_FragColor;',LF,'void main') >>>>> stringreplace fsrc >>>>> end. >>>>> smoutput vsrc >>>>> smoutput fsrc >>>>> 'err program'=. gl_makeprogram vsrc;fsrc >>>>> if. #err do. smoutput err return. end. >>>>> >>>>> vertexAttr=: >@{. glGetAttribLocation program;'vertex' >>>>> assert. _1~: vertexAttr >>>>> colorAttr=: >@{. glGetAttribLocation program;'color' >>>>> assert. _1~: colorAttr >>>>> mvpUni=: >@{. glGetUniformLocation program;'mvp' >>>>> assert. _1~: mvpUni >>>>> >>>>> glGenBuffers 2;vbo=: 2#_1 >>>>> glBindBuffer GL_ARRAY_BUFFER; {.vbo >>>>> glBufferData GL_ARRAY_BUFFER; (#vertexData); (symdat <'vertexData'); >>>>> GL_STATIC_DRAW >>>>> glBindBuffer GL_ARRAY_BUFFER; {:vbo >>>>> glBufferData GL_ARRAY_BUFFER; (#colorData); (symdat <'colorData'); >>>>> GL_STATIC_DRAW >>>>> glBindBuffer GL_ARRAY_BUFFER; 0 >>>>> >>>>> sprog=: program >>>>> >>>>> NB. glClearColor 0; 0; 1; 1 >>>>> ) >>>>> >>>>> a_g_char=: 3 : 0 >>>>> if. 0=#sysdata do. return. end. >>>>> R=: 360 | R + 2 * 'xyz' = 0 { sysdata >>>>> k=. 0{sysdata >>>>> STEPS=: 200 <. STEPS + 's' = k >>>>> STEPS=: 3 >. STEPS - 'a' = k >>>>> LR=: LR - 0.01*'l'=k >>>>> LR=: LR + 0.01*'r'=k >>>>> gl_paint '' >>>>> ) >>>>> >>>>> a_timer=: 3 : 0 >>>>> if. 0=STOP do. return. end. >>>>> R=: 360 | R + 2 * 1 1 1 >>>>> gl_sel HD >>>>> gl_paint'' >>>>> ) >>>>> >>>>> a_g_paint=: 3 : 0 >>>>> if. 0=sprog do. return. end. >>>>> >>>>> wh=. gl_qwh'' >>>>> glClearColor 1 1 1 1 >>>>> glClearColor 0 0 0 1 NB. this is new >>>>> glClear GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT >>>>> >>>>> glUseProgram sprog >>>>> glEnable GL_DEPTH_TEST >>>>> glEnable GL_CULL_FACE >>>>> >>>>> NB. matrix convention: current matrix on the left >>>>> NB. note pre-multiplication >>>>> >>>>> NB. model-view >>>>> mvp=: (gl_Rotate (0{R), 1 0 0 ) mp (gl_Rotate (1{R), 0 1 0) mp (gl_Rotate >>>>> (2{R), 0 0 1) mp (gl_Scale STEPS%100) mp (gl_Translate 0 0 _8) mp >>>>> glu_LookAt EYE,LR,UD,IO,UP >>>>> >>>>> NB. projection >>>>> mvp=: mvp mp gl_Perspective 30, (%/wh),1 10 >>>>> >>>>> NB. note GL_FALSE, no transpose >>>>> glUniformMatrix4fv mvpUni; 1; GL_FALSE; mvp >>>>> >>>>> glBindBuffer GL_ARRAY_BUFFER; {.vbo >>>>> glEnableVertexAttribArray vertexAttr >>>>> glVertexAttribPointer vertexAttr; 3; GL_FLOAT; 0; 0; 0 >>>>> >>>>> glBindBuffer GL_ARRAY_BUFFER; {:vbo >>>>> glEnableVertexAttribArray colorAttr >>>>> glVertexAttribPointer colorAttr; 3; GL_FLOAT; 0; 0; 0 >>>>> >>>>> glDrawArrays GL_TRIANGLES; 0; 12 NB. 36 was for cubes ******* >>>>> >>>>> glBindBuffer GL_ARRAY_BUFFER; 0 >>>>> glDisableVertexAttribArray colorAttr >>>>> glDisableVertexAttribArray vertexAttr >>>>> >>>>> glDisable GL_DEPTH_TEST >>>>> glDisable GL_CULL_FACE >>>>> >>>>> glUseProgram 0 >>>>> >>>>> gl_clear '' >>>>> gl_rgb 255 255 255 >>>>> gl_textcolor '' >>>>> gl_textxy 10 30 >>>>> gl_text 'keys: x y z a s l r F4' >>>>> gl_textxy 10 50 >>>>> gl_text 'scale: ',":STEPS%100 >>>>> gl_textxy 10 70 >>>>> gl_text 'angle: ',":R >>>>> gl_textxy 10 90 >>>>> if. 0=sprog do. return. end. >>>>> gl_text 'matrix:' >>>>> for_i. i.4 do. >>>>> gl_textxy 10, 105+i*15 >>>>> gl_text 6j2": i{mvp >>>>> end. >>>>> ) >>>>> >>>>> a_f4_fkey=: 3 : 0 >>>>> STOP=: -.STOP >>>>> NB. gl_paint '' >>>>> ) >>>>> >>>>> a_cancel=: a_close >>>>> >>>>> a_close=: 3 : 0 >>>>> STOP=: 0 >>>>> wd 'ptimer 0' >>>>> glDeleteBuffers ::0: 2; vbo >>>>> glDeleteProgram ::0: sprog >>>>> wd 'pclose' >>>>> ) >>>>> >>>>> NB. Mirrored sphenoid? >>>>> vertexData=: 1&fc ,1 rt 3 rt 4 3 3$ %&80, 0&". ;._2 [ 0 : 0 >>>>> _3 _9 _4 >>>>> 3 _9 _4 >>>>> 0 0 2 >>>>> 0 8 _4 >>>>> ) >>>>> >>>>> colorData=: 1&fc ,1 rt 3 rt 4 3 3$ , 0&". ;._2 [ 0 : 0 >>>>> 0 0 1 >>>>> 1 1 1 >>>>> 1 0 0 >>>>> 0 1 0 >>>>> ) >>>>> >>>>> >>>>> NB. ========================================================= >>>>> vsrc1=: 0 : 0 >>>>> attribute highp vec3 vertex; >>>>> attribute lowp vec3 color; >>>>> varying lowp vec4 v_color; >>>>> uniform mat4 mvp; >>>>> void main(void) >>>>> { >>>>> gl_Position = mvp * vec4(vertex,1.0); >>>>> v_color = vec4(color,1.0); >>>>> } >>>>> ) >>>>> >>>>> fsrc1=: 0 : 0 >>>>> varying lowp vec4 v_color; >>>>> void main(void) >>>>> { >>>>> gl_FragColor = v_color; >>>>> } >>>>> ) >>>>> >>>>> NB. ========================================================= >>>>> vsrc2=: 0 : 0 >>>>> in vec3 vertex; >>>>> in vec3 color; >>>>> out vec4 v_color; >>>>> uniform mat4 mvp; >>>>> void main(void) >>>>> { >>>>> gl_Position = mvp * vec4(vertex,1.0); >>>>> v_color = vec4(color,1.0); >>>>> } >>>>> ) >>>>> >>>>> fsrc2=: 0 : 0 >>>>> in vec4 v_color; >>>>> void main(void) >>>>> { >>>>> gl_FragColor = v_color; >>>>> } >>>>> ) >>>>> >>>>> NB. ========================================================= >>>>> a_run'' >>>>> >>>>> On Fri, Feb 14, 2020 at 7:19 PM bill lam <bbill....@gmail.com> wrote: >>>>> >>>>>> If you intended to run turtle graphics only, then drawing cube is over >>>>>> skilled. Drawing triangles is much simpler. eg a triangle with vertices >>>>>> 0 1 0, 1 _1 0, _1 _1 0 >>>>>> then use different scale, translate and rotate to place them into >>>>>> different >>>>>> positions and orientations. >>>>>> >>>>>> Also only a constant solid color from fragment shader is sufficient. >>>>>> >>>>>> On Sat, Feb 15, 2020, 7:19 AM Brian Schott <schott.br...@gmail.com> >>>>>> wrote: >>>>>> >>>>>> -- >>>>> (B=) >>>>> ---------------------------------------------------------------------- >>>>> For information about J forums see http://www.jsoftware.com/forums.htm >>>> ---------------------------------------------------------------------- >>>> For information about J forums see http://www.jsoftware.com/forums.htm >>> >>> -- >>> regards, >>> ==================================================== >>> GPG key 1024D/4434BAB3 2008-08-24 >>> gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3 >>> ---------------------------------------------------------------------- >>> For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm