Here is my final pattern for a color cube. I finally corrected all the problems. I moved the faces to make it more obvious that the black corner is diagonally opposite from the white corner. Also the black tabs can be bent to allow the cube to be glued together. It will be the final project for JTECH Grade 4. First, grade 4 is all about decimals, fractions and percent. Here's the code:
load 'viewmat' N=:<.63.75*i.5 W=:5 5$150 R=:5 5$(4#150),0 L=:|:|.|:R f=:(0=#:i.8)+2*#:i.8 g=:((4#0),N),.N,4#255 h=:,#:i.8 BIGBOX=:<"2 |:"2 >"0(<"2) 8 3 9$,|:h{"1 g 'BLACK BLUE RED MAGENTA GREEN CYAN YELLOW WHITE'=:>BIGBOX WHITE=:5 5$150 LMAGENTA=:8 7 6 5 4{"2 MAGENTA LCYAN=:8 7 6 5 4{"2 CYAN LYELLOW=:8 7 6 5 4{"2 YELLOW A=:i.5 5 BACK=:25 3$,><"1 (0 1 2 3 4{GREEN)+"1/(0 1 2 3 4){BLUE LEFT=:25 3$,(0 1 2 3 4{GREEN)+"1/(0 1 2 3 4){RED TOP=:25 3$,(0 1 2 3 4{RED)+"1/(0 1 2 3 4){BLUE FRONT=:(25 3$,LYELLOW +"1/LMAGENTA)-255 RIGHT=:25 3$,LCYAN +"1/LMAGENTA BASE=:(25 3$,LYELLOW+"1/LCYAN)-255 WOW1=:(R,.(|.A),.L),((|:|.25+A),.(50+A),.W) WOW2=:WOW1,((|.R),.(|.|:|.75+A),.|.|:100+A) WOW3=:WOW2,(W,.(|:|.125+A),.L),"2,5(#"0) 150 0 150 ALL=:BACK,LEFT,TOP,FRONT,RIGHT,BASE(,"2) 510 510 510 ALL viewmat WOW3 Linda -----Original Message----- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Mike Day Sent: Sunday, June 28, 2015 7:26 AM To: programm...@jsoftware.com Subject: Re: [Jprogramming] Trouble making patter for a color cube Thanks again. Yes, I wondered why you were taking sextuples with 0 1 2 2 1 3 { coords . So are you or some other genius in interfacing data, displays and o/s developing some neat cover-functions? I can't imagine I'd ever discover how to do what looks like pretty low-level coding and high-level awareness of all the tools available. Brilliant stuff, Bill Mike On 28/06/2015 11:58, bill lam wrote: > the vertexData code was originally adapted from some C program. > > ColorData can be calculated for arbitrary colors by some pseudo code > such as > > (ABCDEFGH i. vertexData) { (8 colors for AB...GH) > > Codes are much longer than that in J602 partly because users now are > responsible of feeding data into pipeline. > > Also the shader demo is intended to also run on android, so that each > face (square) is represented as 2 triangles. > > Вс, 28 июн 2015, Mike Day написал(а): >> Marvellous! >> >> I went back to J803 to compare, but the shader doesn't seem to work >> there. However, the opengl/basic/colors demo in J602 is very similar, >> requiring, apparently, very little code. >> >> What a lot of code for the J804 version, but I suppose it's doing a >> lot more than we mere mortals with viewmat - which in its turn >> appears to do a whole lot more than what I'd realised hitherto... >> >> I don't see why the definition of vertexData needs be quite so >> long-winded. I'd define (perhaps) 'G H F E' =: - 'A B C D' =: _1 1 >> _1, 1 1 _1, 1 _1 _1,: _1 _1 _1 (not sure about the back-side - this >> labelling "sees" >> a face EFGH behind the face ABCD) >> and then define the 6 faces in terms of these labels. >> >> Raul points out that the colours in the all-8-colours cube are >> essentially the same as their vertices, so you could just define >> >> colorData =: 1 fc _1 1 i. _1 fc vertexData >> >> However, this assumes a fixed choice of colour for each vertex. >> As it is, I don't see how one can easily modify the corner colours >> to a user's arbitrary selection; this would be more manageable if >> colorData were defined in terms of the 8 (arbitrary) colours >> for A B .. G H. fc appears to support reals, so such colours >> may be defined in [0.0, 1.0] if the user wishes. >> >> Thanks, >> >> Mike >> >> On 28/06/2015 02:52, bill lam wrote: >>> I made an attemp to implement color scheme proposed by Raul and Mike >>> in the opengl shader demo of j804 beta. Please update qt addon to >>> check if the result agrees with viewmat, and fix shader if >>> necessary. F10 is used to start/stop timer. >>> >> >> --- >> This email has been checked for viruses by Avast antivirus software. >> https://www.avast.com/antivirus >> >> --------------------------------------------------------------------- >> - For information about J forums see >> http://www.jsoftware.com/forums.htm --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm