Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #33005 > unrolled thread
| Started by | jonas.thornvall@gmail.com |
|---|---|
| First post | 2017-04-14 11:49 -0700 |
| Last post | 2017-04-24 13:27 -0700 |
| Articles | 20 on this page of 68 — 11 participants |
Back to article view | Back to comp.lang.javascript
Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-14 11:49 -0700
Re: Javascripts and highlevel computer language programming of graphics John G Harris <niam@jghnorth.org.uk.invalid> - 2017-04-15 11:07 +0100
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-15 11:52 -0700
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-15 12:04 -0700
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-15 14:52 -0700
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-15 15:04 -0700
Re: Javascripts and highlevel computer language programming of graphics "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-04-16 00:09 +0200
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-15 15:18 -0700
Re: Javascripts and highlevel computer language programming of graphics "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-04-16 11:27 +0200
Re: Javascripts and highlevel computer language programming of graphics <cyber@2trom.com> - 2017-04-16 15:08 +0000
Re: Javascripts and highlevel computer language programming of graphics "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-04-16 20:47 +0200
Re: Javascripts and highlevel computer language programming of graphics Gene Wirchenko <genew@telus.net> - 2017-04-17 10:02 -0700
Re: Javascripts and highlevel computer language programming of graphics "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-04-17 23:46 +0200
Re: Javascripts and highlevel computer language programming of graphics Gene Wirchenko <genew@telus.net> - 2017-04-18 17:39 -0700
Re: Javascripts and highlevel computer language programming of graphics Andrew Poulos <ap_prog@hotmail.com> - 2017-04-19 11:25 +1000
Re: Javascripts and highlevel computer language programming of graphics Bob Martin <bob.martin@excite.com> - 2017-04-19 07:30 +0100
Re: Javascripts and highlevel computer language programming of graphics "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-04-19 12:13 +0200
Re: Javascripts and highlevel computer language programming of graphics Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-04-19 13:58 +0200
Re: Javascripts and highlevel computer language programming of graphics "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-04-19 17:20 +0200
Re: Javascripts and highlevel computer language programming of graphics Gene Wirchenko <genew@telus.net> - 2017-04-19 10:00 -0700
Re: Javascripts and highlevel computer language programming of graphics <cyber@2trom.com> - 2017-04-20 12:33 +0000
Re: Javascripts and highlevel computer language programming of graphics Gene Wirchenko <genew@telus.net> - 2017-04-20 11:39 -0700
Re: Javascripts and highlevel computer language programming of graphics "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-04-20 21:24 +0200
Re: Javascripts and highlevel computer language programming of graphics Gene Wirchenko <genew@telus.net> - 2017-04-21 11:57 -0700
Re: Javascripts and highlevel computer language programming of graphics Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-04-21 18:37 +0200
Re: Javascripts and highlevel computer language programming of graphics "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-04-19 12:00 +0200
Re: Javascripts and highlevel computer language programming of graphics Gene Wirchenko <genew@telus.net> - 2017-04-19 10:03 -0700
Re: Javascripts and highlevel computer language programming of graphics "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-04-20 00:07 +0200
Re: Javascripts and highlevel computer language programming of graphics Gene Wirchenko <genew@telus.net> - 2017-04-19 17:21 -0700
Re: Javascripts and highlevel computer language programming of graphics Andrew Poulos <ap_prog@hotmail.com> - 2017-04-20 15:54 +1000
Re: Javascripts and highlevel computer language programming of graphics "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-04-20 08:46 +0200
Re: Javascripts and highlevel computer language programming of graphics "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-04-20 08:43 +0200
Re: Javascripts and highlevel computer language programming of graphics Gene Wirchenko <genew@telus.net> - 2017-04-20 11:42 -0700
Re: Javascripts and highlevel computer language programming of graphics "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-04-20 21:37 +0200
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-21 03:23 -0700
Re: Javascripts and highlevel computer language programming of graphics Andrew Poulos <ap_prog@hotmail.com> - 2017-04-22 16:21 +1000
Re: Javascripts and highlevel computer language programming of graphics "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-04-22 12:15 +0200
Re: Javascripts and highlevel computer language programming of graphics Gene Wirchenko <genew@telus.net> - 2017-04-21 11:58 -0700
Re: Javascripts and highlevel computer language programming of graphics <cyber@2trom.com> - 2017-04-17 13:01 +0000
Re: Javascripts and highlevel computer language programming of graphics Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-04-17 20:28 +0200
Re: Javascripts and highlevel computer language programming of graphics bit-naughty@hotmail.com - 2017-04-19 23:50 -0700
Re: Javascripts and highlevel computer language programming of graphics Andrew Poulos <ap_prog@hotmail.com> - 2017-04-20 19:02 +1000
Re: Javascripts and highlevel computer language programming of graphics "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-04-20 11:24 +0200
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-15 15:14 -0700
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-15 15:24 -0700
Re: Javascripts and highlevel computer language programming of graphics John G Harris <niam@jghnorth.org.uk.invalid> - 2017-04-17 10:49 +0100
Re: Javascripts and highlevel computer language programming of graphics RobG <rgqld@iinet.net.au> - 2017-04-23 08:39 +1000
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-22 15:46 -0700
Re: Javascripts and highlevel computer language programming of graphics John G Harris <niam@jghnorth.org.uk.invalid> - 2017-04-23 15:29 +0100
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-23 09:47 -0700
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-23 09:57 -0700
Re: Javascripts and highlevel computer language programming of graphics John G Harris <niam@jghnorth.org.uk.invalid> - 2017-04-24 11:09 +0100
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-24 05:26 -0700
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-24 05:32 -0700
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-24 05:36 -0700
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-24 05:44 -0700
Re: Javascripts and highlevel computer language programming of graphics John G Harris <niam@jghnorth.org.uk.invalid> - 2017-04-24 15:12 +0100
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-24 10:12 -0700
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-23 09:49 -0700
Re: Javascripts and highlevel computer language programming of graphics John G Harris <niam@jghnorth.org.uk.invalid> - 2017-04-24 11:10 +0100
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-24 12:07 -0700
Re: Javascripts and highlevel computer language programming of graphics Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-04-24 21:24 +0100
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-24 13:32 -0700
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-24 13:41 -0700
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-24 13:56 -0700
Re: Javascripts and highlevel computer language programming of graphics John G Harris <niam@jghnorth.org.uk.invalid> - 2017-04-25 10:41 +0100
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-26 12:15 -0700
Re: Javascripts and highlevel computer language programming of graphics jonas.thornvall@gmail.com - 2017-04-24 13:27 -0700
Page 1 of 4 [1] 2 3 4 Next page →
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-04-14 11:49 -0700 |
| Subject | Javascripts and highlevel computer language programming of graphics |
| Message-ID | <9fcf7c9e-a38d-4b45-bcfb-347c5d15d930@googlegroups.com> |
High level computer programming of graphics seem to suffer from the fact that you can not tell what should be executed in the actual rendering algorithm. It is so wrong to have to check what should be written out within the actual render algorithm again and again. Why can't you send what algorithms to render to the pain function? Example, instead of checking what to render in the render algo again and agin why not use the individual function names to render as paramters to the render function. As far as i understand today you must check what to render within the render with in redraw where you render to canvas, and this happen as often you draw to the canvas. WHY can't one tell the redraw what functions/procedures to reder before it start? Is there a way to tell the rendering "redraw" from outside what functions that should be executed, i really would like an example. Right now i use booleans within the rendering "redraw" to tell what code should be executed and not. But it seem fucking weird to me, so possibly i have not understood the principle, because these are checked every time when you redraw and that must be a waste of cpu cycles. So is there a way to avoid this in highlevel programming languages? My idea would be to tell the rendering what functions should be executed, so they become a parameter to the rendering, but maybe i totally missunderstood rendering? JT
[toc] | [next] | [standalone]
| From | John G Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2017-04-15 11:07 +0100 |
| Message-ID | <mtr3fchnoeko3qn95hq9iup9ljcjmksb16@4ax.com> |
| In reply to | #33005 |
On Fri, 14 Apr 2017 11:49:16 -0700 (PDT), jonas.thornvall@gmail.com wrote: >High level computer programming of graphics seem to suffer from the fact that you can not tell what should be executed in the actual rendering algorithm. > >It is so wrong to have to check what should be written out within the actual render algorithm again and again. > >Why can't you send what algorithms to render to the pain function? > >Example, instead of checking what to render in the render algo again and agin why not use the individual function names to render as paramters to the render function. > >As far as i understand today you must check what to render within the render with in redraw where you render to canvas, and this happen as often you draw to the canvas. > >WHY can't one tell the redraw what functions/procedures to reder before it start? > >Is there a way to tell the rendering "redraw" from outside what functions that should be executed, i really would like an example. Right now i use booleans within the rendering "redraw" to tell what code should be executed and not. > >But it seem fucking weird to me, so possibly i have not understood the principle, because these are checked every time when you redraw and that must be a waste of cpu cycles. So is there a way to avoid this in highlevel programming languages? >My idea would be to tell the rendering what functions should be executed, so they become a parameter to the rendering, but maybe i totally missunderstood rendering? This is where Object Oriented design can be so useful. You have an object with a Draw method. Draw draws the entire picture. It does this by using a sequence of objects with Draw methods. In each of these objects Draw draws part of the picture by using a sequence of objects with Draw methods, etc. Eventually you reach objects whose Draw method draw a line, circle, rectangle, etc, using values remembered by the objects.
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-04-15 11:52 -0700 |
| Message-ID | <03b9843f-a669-4e7b-b18d-bd2bd7240e16@googlegroups.com> |
| In reply to | #33009 |
Den lördag 15 april 2017 kl. 12:07:38 UTC+2 skrev John G Harris: > On Fri, 14 Apr 2017 11:49:16 -0700 (PDT), jonas.thornvall@gmail.com > wrote: > > >High level computer programming of graphics seem to suffer from the fact that you can not tell what should be executed in the actual rendering algorithm. > > > >It is so wrong to have to check what should be written out within the actual render algorithm again and again. > > > >Why can't you send what algorithms to render to the pain function? > > > >Example, instead of checking what to render in the render algo again and agin why not use the individual function names to render as paramters to the render function. > > > >As far as i understand today you must check what to render within the render with in redraw where you render to canvas, and this happen as often you draw to the canvas. > > > >WHY can't one tell the redraw what functions/procedures to reder before it start? > > > >Is there a way to tell the rendering "redraw" from outside what functions that should be executed, i really would like an example. Right now i use booleans within the rendering "redraw" to tell what code should be executed and not. > > > >But it seem fucking weird to me, so possibly i have not understood the principle, because these are checked every time when you redraw and that must be a waste of cpu cycles. So is there a way to avoid this in highlevel programming languages? > >My idea would be to tell the rendering what functions should be executed, so they become a parameter to the rendering, but maybe i totally missunderstood rendering? > > This is where Object Oriented design can be so useful. You have an > object with a Draw method. Draw draws the entire picture. It does this > by using a sequence of objects with Draw methods. In each of these > objects Draw draws part of the picture by using a sequence of objects > with Draw methods, etc. Eventually you reach objects whose Draw method > draw a line, circle, rectangle, etc, using values remembered by the > objects. You seem to say the objects know themself if they should be drawn or not? I mean the method itself just draw objects you tell it to draw. Now the user interface is what steer the logic of the drawouts. You seem to say it somehow can tell a group of objects if they should be drawn or not. And i am totally lost here, because as you see i have to poll what should be drawn within the drawmethod and that gives alot of overhead. Could you direct me to "a short" "simple" example how it really should be done? Also my script do rendering using mouse inputs, so then the graphic objects must take/listen input parameters from mouse, would not that cause even more overhead? Of couse i must also poll what to be drawn out every redraw, and that is the main thing i want to get rid off. Say i have 15 function that do different parts of things to draw, that you can steer from the user interface. Now that would be 15! cases to handle within programming, so that is not an option. I think i have 3 right now or so but it still 6 cases. My code is probably not suited to transform into objectoriented programming, but i still want a look how it could work. What i really would like advice on is howto move the polling out of the redraw, now i decide what to draw within redraw ***every time*** method is called. I wanted to find a strategy/method where you set booleans for drawmethods, and check them once and somehow pass a bulk of what should be redrawn. I understand i could create cases with redraws, but that really does not seem to fit drawing.
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-04-15 12:04 -0700 |
| Message-ID | <013aedad-faa3-4207-92bf-6c18ef764969@googlegroups.com> |
| In reply to | #33010 |
Den lördag 15 april 2017 kl. 20:52:19 UTC+2 skrev jonas.t...@gmail.com:
> Den lördag 15 april 2017 kl. 12:07:38 UTC+2 skrev John G Harris:
> > On Fri, 14 Apr 2017 11:49:16 -0700 (PDT), jonas.thornvall@gmail.com
> > wrote:
> >
> > >High level computer programming of graphics seem to suffer from the fact that you can not tell what should be executed in the actual rendering algorithm.
> > >
> > >It is so wrong to have to check what should be written out within the actual render algorithm again and again.
> > >
> > >Why can't you send what algorithms to render to the pain function?
> > >
> > >Example, instead of checking what to render in the render algo again and agin why not use the individual function names to render as paramters to the render function.
> > >
> > >As far as i understand today you must check what to render within the render with in redraw where you render to canvas, and this happen as often you draw to the canvas.
> > >
> > >WHY can't one tell the redraw what functions/procedures to reder before it start?
> > >
> > >Is there a way to tell the rendering "redraw" from outside what functions that should be executed, i really would like an example. Right now i use booleans within the rendering "redraw" to tell what code should be executed and not.
> > >
> > >But it seem fucking weird to me, so possibly i have not understood the principle, because these are checked every time when you redraw and that must be a waste of cpu cycles. So is there a way to avoid this in highlevel programming languages?
> > >My idea would be to tell the rendering what functions should be executed, so they become a parameter to the rendering, but maybe i totally missunderstood rendering?
> >
> > This is where Object Oriented design can be so useful. You have an
> > object with a Draw method. Draw draws the entire picture. It does this
> > by using a sequence of objects with Draw methods. In each of these
> > objects Draw draws part of the picture by using a sequence of objects
> > with Draw methods, etc. Eventually you reach objects whose Draw method
> > draw a line, circle, rectangle, etc, using values remembered by the
> > objects.
>
> You seem to say the objects know themself if they should be drawn or not?
> I mean the method itself just draw objects you tell it to draw.
>
> Now the user interface is what steer the logic of the drawouts.
>
> You seem to say it somehow can tell a group of objects if they should be drawn or not. And i am totally lost here, because as you see i have to poll what should be drawn within the drawmethod and that gives alot of overhead.
>
> Could you direct me to "a short" "simple" example how it really should be done?
>
> Also my script do rendering using mouse inputs, so then the graphic objects must take/listen input parameters from mouse, would not that cause even more overhead?
>
> Of couse i must also poll what to be drawn out every redraw, and that is the main thing i want to get rid off. Say i have 15 function that do different parts of things to draw, that you can steer from the user interface.
>
> Now that would be 15! cases to handle within programming, so that is not an option. I think i have 3 right now or so but it still 6 cases.
>
> My code is probably not suited to transform into objectoriented programming, but i still want a look how it could work.
>
> What i really would like advice on is howto move the polling out of the redraw, now i decide what to draw within redraw ***every time*** method is called.
>
> I wanted to find a strategy/method where you set booleans for drawmethods, and check them once and somehow pass a bulk of what should be redrawn.
>
> I understand i could create cases with redraws, but that really does not seem to fit drawing.
Here is an example of my style of graphic rendering, and i understand it is wrong. As you can see the logic is within the draw method "animation" to offer live update of drag and drop, that all these booleans called every "x-th" millisec. While drawing. Some is always drawn and some other just drawn depending on settings of the UI. I probably can not change all the code into OO-programming i do not think i have the skill, nor knowledge. Right now i let the animation run all time and that ain't necessary i can fix that from UI, start and stop it on UI mouse and animation redraws. But howto move the booleans out of redraw i just do not get. But if you show me an example of how it is done with OO code i may be able to grasp it.
// Paint logic
function redraw() {
// Clear canvas
ctx.clearRect(0, 0, canvas.width, canvas.height);
// // Redraw canvas
ctx.fillStyle = mybgcolor;
ctx.fillRect(0, 0, canvas.width, canvas.height);
if (grid==true) {graphBackground();}
// Redraw graph
paint_graph(arr);
paint_message();
}
function paint_graph(arr) {
ctx.lineWidth = 1;
if (markarea == true) {
markDraw();
} else if (moveit == true) {
moveDraw();
} else if (reshape == true) {
boundariesDraw();
} else if (doreshape == true) {
reshapeDraw();
}
graphDraw();
if (handles==true){
nodeDraw();
}
}
function graphDraw() {
for (var t = 0; t < arr.length; t++) {
if (arr[t].print == true) {
ctx.strokeStyle = arr[t].bcolor;
var tempcolor=arr[t].bcolor;
for (s = 0; s < arr[t].nodelinks.length; s++) {
var myvar = arr[t].nodelinks[s];
if (arr[t].BcurveX1[myvar] == undefined) {
ctx.beginPath();
ctx.moveTo(arr[t].rposX, arr[t].rposY);
ctx.lineTo(arr[myvar].rposX, arr[myvar].rposY);
ctx.stroke();
} else {
if (bhandles==true) { bezcontrol(t,myvar,tempcolor);ctx.strokeStyle=tempcolor;}
ctx.beginPath();
ctx.moveTo(arr[t].rposX, arr[t].rposY);
ctx.bezierCurveTo(arr[t].BcurveX1[myvar], arr[t].BcurveY1[myvar], arr[t].BcurveX2[myvar], arr[t].BcurveY2[myvar], arr[myvar].rposX, arr[myvar].rposY);
ctx.stroke();
if (holdbezier1==true){ moveBezierDraw1(); }
else if (holdbezier2==true){ moveBezierDraw2(); }
}
}
}
}
}
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-04-15 14:52 -0700 |
| Message-ID | <0c29f9a4-2747-4e81-9847-516875a893a8@googlegroups.com> |
| In reply to | #33011 |
Den lördag 15 april 2017 kl. 21:04:37 UTC+2 skrev jonas.t...@gmail.com:
> Den lördag 15 april 2017 kl. 20:52:19 UTC+2 skrev jonas.t...@gmail.com:
> > Den lördag 15 april 2017 kl. 12:07:38 UTC+2 skrev John G Harris:
> > > On Fri, 14 Apr 2017 11:49:16 -0700 (PDT), jonas.thornvall@gmail.com
> > > wrote:
> > >
> > > >High level computer programming of graphics seem to suffer from the fact that you can not tell what should be executed in the actual rendering algorithm.
> > > >
> > > >It is so wrong to have to check what should be written out within the actual render algorithm again and again.
> > > >
> > > >Why can't you send what algorithms to render to the pain function?
> > > >
> > > >Example, instead of checking what to render in the render algo again and agin why not use the individual function names to render as paramters to the render function.
> > > >
> > > >As far as i understand today you must check what to render within the render with in redraw where you render to canvas, and this happen as often you draw to the canvas.
> > > >
> > > >WHY can't one tell the redraw what functions/procedures to reder before it start?
> > > >
> > > >Is there a way to tell the rendering "redraw" from outside what functions that should be executed, i really would like an example. Right now i use booleans within the rendering "redraw" to tell what code should be executed and not.
> > > >
> > > >But it seem fucking weird to me, so possibly i have not understood the principle, because these are checked every time when you redraw and that must be a waste of cpu cycles. So is there a way to avoid this in highlevel programming languages?
> > > >My idea would be to tell the rendering what functions should be executed, so they become a parameter to the rendering, but maybe i totally missunderstood rendering?
> > >
> > > This is where Object Oriented design can be so useful. You have an
> > > object with a Draw method. Draw draws the entire picture. It does this
> > > by using a sequence of objects with Draw methods. In each of these
> > > objects Draw draws part of the picture by using a sequence of objects
> > > with Draw methods, etc. Eventually you reach objects whose Draw method
> > > draw a line, circle, rectangle, etc, using values remembered by the
> > > objects.
> >
> > You seem to say the objects know themself if they should be drawn or not?
> > I mean the method itself just draw objects you tell it to draw.
> >
> > Now the user interface is what steer the logic of the drawouts.
> >
> > You seem to say it somehow can tell a group of objects if they should be drawn or not. And i am totally lost here, because as you see i have to poll what should be drawn within the drawmethod and that gives alot of overhead.
> >
> > Could you direct me to "a short" "simple" example how it really should be done?
> >
> > Also my script do rendering using mouse inputs, so then the graphic objects must take/listen input parameters from mouse, would not that cause even more overhead?
> >
> > Of couse i must also poll what to be drawn out every redraw, and that is the main thing i want to get rid off. Say i have 15 function that do different parts of things to draw, that you can steer from the user interface.
> >
> > Now that would be 15! cases to handle within programming, so that is not an option. I think i have 3 right now or so but it still 6 cases.
> >
> > My code is probably not suited to transform into objectoriented programming, but i still want a look how it could work.
> >
> > What i really would like advice on is howto move the polling out of the redraw, now i decide what to draw within redraw ***every time*** method is called.
> >
> > I wanted to find a strategy/method where you set booleans for drawmethods, and check them once and somehow pass a bulk of what should be redrawn.
> >
> > I understand i could create cases with redraws, but that really does not seem to fit drawing.
>
> Here is an example of my style of graphic rendering, and i understand it is wrong. As you can see the logic is within the draw method "animation" to offer live update of drag and drop, that all these booleans called every "x-th" millisec. While drawing. Some is always drawn and some other just drawn depending on settings of the UI. I probably can not change all the code into OO-programming i do not think i have the skill, nor knowledge. Right now i let the animation run all time and that ain't necessary i can fix that from UI, start and stop it on UI mouse and animation redraws. But howto move the booleans out of redraw i just do not get. But if you show me an example of how it is done with OO code i may be able to grasp it.
>
> // Paint logic
> function redraw() {
> // Clear canvas
> ctx.clearRect(0, 0, canvas.width, canvas.height);
> // // Redraw canvas
> ctx.fillStyle = mybgcolor;
> ctx.fillRect(0, 0, canvas.width, canvas.height);
> if (grid==true) {graphBackground();}
> // Redraw graph
> paint_graph(arr);
> paint_message();
> }
>
> function paint_graph(arr) {
> ctx.lineWidth = 1;
> if (markarea == true) {
> markDraw();
> } else if (moveit == true) {
> moveDraw();
> } else if (reshape == true) {
> boundariesDraw();
> } else if (doreshape == true) {
> reshapeDraw();
> }
> graphDraw();
> if (handles==true){
> nodeDraw();
> }
> }
>
>
> function graphDraw() {
> for (var t = 0; t < arr.length; t++) {
> if (arr[t].print == true) {
> ctx.strokeStyle = arr[t].bcolor;
> var tempcolor=arr[t].bcolor;
> for (s = 0; s < arr[t].nodelinks.length; s++) {
> var myvar = arr[t].nodelinks[s];
> if (arr[t].BcurveX1[myvar] == undefined) {
> ctx.beginPath();
> ctx.moveTo(arr[t].rposX, arr[t].rposY);
> ctx.lineTo(arr[myvar].rposX, arr[myvar].rposY);
> ctx.stroke();
> } else {
> if (bhandles==true) { bezcontrol(t,myvar,tempcolor);ctx.strokeStyle=tempcolor;}
> ctx.beginPath();
> ctx.moveTo(arr[t].rposX, arr[t].rposY);
> ctx.bezierCurveTo(arr[t].BcurveX1[myvar], arr[t].BcurveY1[myvar], arr[t].BcurveX2[myvar], arr[t].BcurveY2[myvar], arr[myvar].rposX, arr[myvar].rposY);
> ctx.stroke();
> if (holdbezier1==true){ moveBezierDraw1(); }
> else if (holdbezier2==true){ moveBezierDraw2(); }
> }
> }
> }
> }
> }
Should i put the start animation redraw within each of these functions?
Or maybe even even on block level of things i draw, it seem the code lose structure?
That is why i wanted the functions as parameters passed to draw rather then start and stop redraw everywhere in the code?
But that is what you suggest, well with objects rather then my functions?
function paint_graph(arr) {
ctx.lineWidth = 1;
if (markarea == true) {
markDraw();
} else if (moveit == true) {
moveDraw();
} else if (reshape == true) {
boundariesDraw();
} else if (doreshape == true) {
reshapeDraw();
}
graphDraw();
if (handles==true){
nodeDraw();
}
}
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-04-15 15:04 -0700 |
| Message-ID | <55b2edf6-31de-43fa-bb07-ec0da6835f7d@googlegroups.com> |
| In reply to | #33012 |
Den lördag 15 april 2017 kl. 23:52:49 UTC+2 skrev jonas.t...@gmail.com:
> Den lördag 15 april 2017 kl. 21:04:37 UTC+2 skrev jonas.t...@gmail.com:
> > Den lördag 15 april 2017 kl. 20:52:19 UTC+2 skrev jonas.t...@gmail.com:
> > > Den lördag 15 april 2017 kl. 12:07:38 UTC+2 skrev John G Harris:
> > > > On Fri, 14 Apr 2017 11:49:16 -0700 (PDT), jonas.thornvall@gmail.com
> > > > wrote:
> > > >
> > > > >High level computer programming of graphics seem to suffer from the fact that you can not tell what should be executed in the actual rendering algorithm.
> > > > >
> > > > >It is so wrong to have to check what should be written out within the actual render algorithm again and again.
> > > > >
> > > > >Why can't you send what algorithms to render to the pain function?
> > > > >
> > > > >Example, instead of checking what to render in the render algo again and agin why not use the individual function names to render as paramters to the render function.
> > > > >
> > > > >As far as i understand today you must check what to render within the render with in redraw where you render to canvas, and this happen as often you draw to the canvas.
> > > > >
> > > > >WHY can't one tell the redraw what functions/procedures to reder before it start?
> > > > >
> > > > >Is there a way to tell the rendering "redraw" from outside what functions that should be executed, i really would like an example. Right now i use booleans within the rendering "redraw" to tell what code should be executed and not.
> > > > >
> > > > >But it seem fucking weird to me, so possibly i have not understood the principle, because these are checked every time when you redraw and that must be a waste of cpu cycles. So is there a way to avoid this in highlevel programming languages?
> > > > >My idea would be to tell the rendering what functions should be executed, so they become a parameter to the rendering, but maybe i totally missunderstood rendering?
> > > >
> > > > This is where Object Oriented design can be so useful. You have an
> > > > object with a Draw method. Draw draws the entire picture. It does this
> > > > by using a sequence of objects with Draw methods. In each of these
> > > > objects Draw draws part of the picture by using a sequence of objects
> > > > with Draw methods, etc. Eventually you reach objects whose Draw method
> > > > draw a line, circle, rectangle, etc, using values remembered by the
> > > > objects.
> > >
> > > You seem to say the objects know themself if they should be drawn or not?
> > > I mean the method itself just draw objects you tell it to draw.
> > >
> > > Now the user interface is what steer the logic of the drawouts.
> > >
> > > You seem to say it somehow can tell a group of objects if they should be drawn or not. And i am totally lost here, because as you see i have to poll what should be drawn within the drawmethod and that gives alot of overhead.
> > >
> > > Could you direct me to "a short" "simple" example how it really should be done?
> > >
> > > Also my script do rendering using mouse inputs, so then the graphic objects must take/listen input parameters from mouse, would not that cause even more overhead?
> > >
> > > Of couse i must also poll what to be drawn out every redraw, and that is the main thing i want to get rid off. Say i have 15 function that do different parts of things to draw, that you can steer from the user interface.
> > >
> > > Now that would be 15! cases to handle within programming, so that is not an option. I think i have 3 right now or so but it still 6 cases.
> > >
> > > My code is probably not suited to transform into objectoriented programming, but i still want a look how it could work.
> > >
> > > What i really would like advice on is howto move the polling out of the redraw, now i decide what to draw within redraw ***every time*** method is called.
> > >
> > > I wanted to find a strategy/method where you set booleans for drawmethods, and check them once and somehow pass a bulk of what should be redrawn.
> > >
> > > I understand i could create cases with redraws, but that really does not seem to fit drawing.
> >
> > Here is an example of my style of graphic rendering, and i understand it is wrong. As you can see the logic is within the draw method "animation" to offer live update of drag and drop, that all these booleans called every "x-th" millisec. While drawing. Some is always drawn and some other just drawn depending on settings of the UI. I probably can not change all the code into OO-programming i do not think i have the skill, nor knowledge. Right now i let the animation run all time and that ain't necessary i can fix that from UI, start and stop it on UI mouse and animation redraws. But howto move the booleans out of redraw i just do not get. But if you show me an example of how it is done with OO code i may be able to grasp it.
> >
> > // Paint logic
> > function redraw() {
> > // Clear canvas
> > ctx.clearRect(0, 0, canvas.width, canvas.height);
> > // // Redraw canvas
> > ctx.fillStyle = mybgcolor;
> > ctx.fillRect(0, 0, canvas.width, canvas.height);
> > if (grid==true) {graphBackground();}
> > // Redraw graph
> > paint_graph(arr);
> > paint_message();
> > }
> >
> > function paint_graph(arr) {
> > ctx.lineWidth = 1;
> > if (markarea == true) {
> > markDraw();
> > } else if (moveit == true) {
> > moveDraw();
> > } else if (reshape == true) {
> > boundariesDraw();
> > } else if (doreshape == true) {
> > reshapeDraw();
> > }
> > graphDraw();
> > if (handles==true){
> > nodeDraw();
> > }
> > }
> >
> >
> > function graphDraw() {
> > for (var t = 0; t < arr.length; t++) {
> > if (arr[t].print == true) {
> > ctx.strokeStyle = arr[t].bcolor;
> > var tempcolor=arr[t].bcolor;
> > for (s = 0; s < arr[t].nodelinks.length; s++) {
> > var myvar = arr[t].nodelinks[s];
> > if (arr[t].BcurveX1[myvar] == undefined) {
> > ctx.beginPath();
> > ctx.moveTo(arr[t].rposX, arr[t].rposY);
> > ctx.lineTo(arr[myvar].rposX, arr[myvar].rposY);
> > ctx.stroke();
> > } else {
> > if (bhandles==true) { bezcontrol(t,myvar,tempcolor);ctx.strokeStyle=tempcolor;}
> > ctx.beginPath();
> > ctx.moveTo(arr[t].rposX, arr[t].rposY);
> > ctx.bezierCurveTo(arr[t].BcurveX1[myvar], arr[t].BcurveY1[myvar], arr[t].BcurveX2[myvar], arr[t].BcurveY2[myvar], arr[myvar].rposX, arr[myvar].rposY);
> > ctx.stroke();
> > if (holdbezier1==true){ moveBezierDraw1(); }
> > else if (holdbezier2==true){ moveBezierDraw2(); }
> > }
> > }
> > }
> > }
> > }
>
> Should i put the start animation redraw within each of these functions?
>
> Or maybe even even on block level of things i draw, it seem the code lose structure?
>
> That is why i wanted the functions as parameters passed to draw rather then start and stop redraw everywhere in the code?
>
> But that is what you suggest, well with objects rather then my functions?
>
> function paint_graph(arr) {
> ctx.lineWidth = 1;
> if (markarea == true) {
> markDraw();
> } else if (moveit == true) {
> moveDraw();
> } else if (reshape == true) {
> boundariesDraw();
> } else if (doreshape == true) {
> reshapeDraw();
> }
> graphDraw();
> if (handles==true){
> nodeDraw();
> }
> }
It probably is a good idea to start animation within the functions that handle the graphics output, but it seem a bit unorganised.
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2017-04-16 00:09 +0200 |
| Message-ID | <XnsA7591ADF6463eejj99@194.109.6.166> |
| In reply to | #33013 |
jonas.thornvall@gmail.com wrote on 16 Apr 2017 in comp.lang.javascript: > Re: Javascripts and highlevel computer language programming of graphics "Javascripts" are scripts of the language "Java", which seem not to exist as Java is AFAIK not an interpreted language. "Javascript scripts" is what this NG is about. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2017-04-15 15:18 -0700 |
| Message-ID | <ebd3f80e-725a-49db-a067-c56b9060122f@googlegroups.com> |
| In reply to | #33014 |
Den söndag 16 april 2017 kl. 00:09:58 UTC+2 skrev Evertjan.: > jonas.thornvall@gmail.com wrote on 16 Apr 2017 in comp.lang.javascript: > > > Re: Javascripts and highlevel computer language programming of graphics > > "Javascripts" are scripts of the language "Java", > which seem not to exist as Java is AFAIK not an interpreted language. > > "Javascript scripts" is what this NG is about. > > -- > Evertjan. > The Netherlands. > (Please change the x'es to dots in my emailaddress) Well the NG's name is comp.lang.javascript one would think that after 20 years you should be used to people refering to Javascript i never ever seen ECMASCRIPT refered to unless reading your posts.
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2017-04-16 11:27 +0200 |
| Message-ID | <XnsA75974926D927eejj99@194.109.6.166> |
| In reply to | #33016 |
jonas.thornvall@gmail.com wrote on 16 Apr 2017 in comp.lang.javascript: > Den sБndag 16 april 2017 kl. 00:09:58 UTC+2 skrev Evertjan.: >> jonas.thornvall@gmail.com wrote on 16 Apr 2017 in comp.lang.javascript: >> >> > Re: Javascripts and highlevel computer language programming of >> > graphics >> >> "Javascripts" are scripts of the language "Java", >> which seem not to exist as Java is AFAIK not an interpreted language. >> >> "Javascript scripts" is what this NG is about. > > Well the NG's name is comp.lang.javascript one would think that after 20 > years you should be used to people refering to Javascript i never ever > seen ECMASCRIPT refered to unless reading your posts. Are you capable of reading what I wrote? You refered to "JavascriptS" which are non-existing scripts of "Java". -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | <cyber@2trom.com> |
|---|---|
| Date | 2017-04-16 15:08 +0000 |
| Message-ID | <pNLIA.354176$2K7.190141@fx18.am4> |
| In reply to | #33019 |
Evertjan. <exxjxw.hannivoort@inter.nl.net> wrote: > Newsgroups: comp.lang.javascript > > You refered to "JavascriptS" which are non-existing scripts of "Java". > Actually those would be "Java scripts" in English. Even though in Dutch one is not supposed to put a space between 2 words that are supposed to form 1 word in English one is.
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2017-04-16 20:47 +0200 |
| Message-ID | <XnsA759D373CA541eejj99@194.109.6.166> |
| In reply to | #33021 |
<cyber@2trom.com> wrote on 16 Apr 2017 in comp.lang.javascript: > Evertjan. <exxjxw.hannivoort@inter.nl.net> wrote: >> Newsgroups: comp.lang.javascript >> >> You refered to "JavascriptS" which are non-existing scripts of "Java". >> > > Actually those would be "Java scripts" in English. Even though in Dutch one > is not supposed to put a space between 2 words that are supposed to form 1 > word in English one is. Actually, while you are right, that still means "Javascripts" don't exist. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Gene Wirchenko <genew@telus.net> |
|---|---|
| Date | 2017-04-17 10:02 -0700 |
| Message-ID | <o5t9fc95ivibisb757ut7kd5db4nj9l3gv@4ax.com> |
| In reply to | #33023 |
On Sun, 16 Apr 2017 20:47:11 +0200, "Evertjan."
<exxjxw.hannivoort@inter.nl.net> wrote:
><cyber@2trom.com> wrote on 16 Apr 2017 in comp.lang.javascript:
>
>> Evertjan. <exxjxw.hannivoort@inter.nl.net> wrote:
>>> Newsgroups: comp.lang.javascript
>>>
>>> You refered to "JavascriptS" which are non-existing scripts of "Java".
>> Actually those would be "Java scripts" in English. Even though in Dutch one
>> is not supposed to put a space between 2 words that are supposed to form 1
>> word in English one is.
>
>Actually, while you are right, that still means "Javascripts" don't exist.
"Javascripts" could mean more than one version or implementation
of Javascript. I have never seen the usage, but it is possible.
Sincerely,
Gene Wirchenko
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2017-04-17 23:46 +0200 |
| Message-ID | <XnsA75AF1C846D36eejj99@194.109.6.166> |
| In reply to | #33028 |
Gene Wirchenko <genew@telus.net> wrote on 17 Apr 2017 in comp.lang.javascript: > "Javascripts" could mean more than one version or implementation > of Javascript. I have never seen the usage, but it is possible. It is not. Javascript is the language, not the/an implementation. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Gene Wirchenko <genew@telus.net> |
|---|---|
| Date | 2017-04-18 17:39 -0700 |
| Message-ID | <v9cdfcd2ckbfle1b4g3qe4ennno3q1tosn@4ax.com> |
| In reply to | #33031 |
On Mon, 17 Apr 2017 23:46:05 +0200, "Evertjan."
<exxjxw.hannivoort@inter.nl.net> wrote:
>Gene Wirchenko <genew@telus.net> wrote on 17 Apr 2017 in
>comp.lang.javascript:
>
>> "Javascripts" could mean more than one version or implementation
>> of Javascript. I have never seen the usage, but it is possible.
>
>It is not.
>
>Javascript is the language, not the/an implementation.
It can be either.
"The JavaScript in browser XYZ is based on version x.y.z of the
standard." would be an example of a reference to the implementation.
I do not presume to instruct you in Dutch; please do not presume
to instruct me in English.
Sincerely,
Gene Wirchenko
[toc] | [prev] | [next] | [standalone]
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Date | 2017-04-19 11:25 +1000 |
| Message-ID | <R9-dnbNoie_rIWvFnZ2dnUU7-QnNnZ2d@westnet.com.au> |
| In reply to | #33049 |
On 19/04/2017 10:39 AM, Gene Wirchenko wrote: > I do not presume to instruct you in Dutch; please do not presume > to instruct me in English. You're implying that English is so inscrutable that only one born speaking it is the only one whose interpretation can be "correct". Andrew Poulos
[toc] | [prev] | [next] | [standalone]
| From | Bob Martin <bob.martin@excite.com> |
|---|---|
| Date | 2017-04-19 07:30 +0100 |
| Message-ID | <eloeftFpgeU1@mid.individual.net> |
| In reply to | #33050 |
in 636376 20170419 022509 Andrew Poulos <ap_prog@hotmail.com> wrote: >On 19/04/2017 10:39 AM, Gene Wirchenko wrote: > >> I do not presume to instruct you in Dutch; please do not presume >> to instruct me in English. > >You're implying that English is so inscrutable that only one born >speaking it is the only one whose interpretation can be "correct". I agree with that but Evertjan's statement that "Javascript is a language and not an implementation" is incorrect.
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2017-04-19 12:13 +0200 |
| Message-ID | <XnsA75C7C70B1716eejj99@194.109.6.166> |
| In reply to | #33053 |
Bob Martin <bob.martin@excite.com> wrote on 19 Apr 2017 in comp.lang.javascript: > in 636376 20170419 022509 Andrew Poulos <ap_prog@hotmail.com> wrote: >>On 19/04/2017 10:39 AM, Gene Wirchenko wrote: >> >>> I do not presume to instruct you in Dutch; please do not presume >>> to instruct me in English. >> >>You're implying that English is so inscrutable that only one born >>speaking it is the only one whose interpretation can be "correct". > > I agree with that but Evertjan's statement that "Javascript is a language > and not an implementation" is incorrect. Well Bob, then you should not misquote me, I wrote: "Javascript is THE language, ..." I maintain that "Javascript is the language", and an implementation of such language does not make that language the implementation by itself, unless you use "the implementation" just as an action [substantized verb] and not as a result. "The English spoken in India is different from that spoken on the Isle of Man" is about differences in dialect. To call that "The implementation of English is different" well, that seems to me a stretch too far. And even, because this is a computer-language not a live one [though I dobt that seen the different and emerging dialects], "The implementation of Javascript is different" would only be about the difference in dialect. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2017-04-19 13:58 +0200 |
| Message-ID | <1625401.1su1EIGWjt@PointedEars.de> |
| In reply to | #33053 |
Bob Martin wrote: > in 636376 20170419 022509 Andrew Poulos <ap_prog@hotmail.com> wrote: >>On 19/04/2017 10:39 AM, Gene Wirchenko wrote: >>> I do not presume to instruct you in Dutch; please do not presume >>> to instruct me in English. >> You're implying that English is so inscrutable that only one born >> speaking it is the only one whose interpretation can be "correct". > > I agree with that but Evertjan's statement that "Javascript is a language > and not an implementation" is incorrect. ACK; it is neither: There is no “Javascript”. -- PointedEars FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix> <https://github.com/PointedEars> | <http://PointedEars.de/wsvn/> Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2017-04-19 17:20 +0200 |
| Message-ID | <XnsA75CB063F66D9eejj99@194.109.6.166> |
| In reply to | #33057 |
Thomas 'PointedEars' Lahn <PointedEars@web.de> wrote on 19 Apr 2017 in comp.lang.javascript: >> I agree with that but Evertjan's statement that "Javascript is a language >> and not an implementation" is incorrect. > > ACK; it is neither: There is no "Javascript". I agree for 50%. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Gene Wirchenko <genew@telus.net> |
|---|---|
| Date | 2017-04-19 10:00 -0700 |
| Message-ID | <km5ffcpqb7ib96bfu19ps5mbv7p24sv00p@4ax.com> |
| In reply to | #33050 |
On Wed, 19 Apr 2017 11:25:09 +1000, Andrew Poulos
<ap_prog@hotmail.com> wrote:
>On 19/04/2017 10:39 AM, Gene Wirchenko wrote:
>
>> I do not presume to instruct you in Dutch; please do not presume
>> to instruct me in English.
>
>You're implying that English is so inscrutable that only one born
>speaking it is the only one whose interpretation can be "correct".
No. However, evertjan has made sweeping statements before about
English. Said statements have been wrong.
As a native speaker of English, I know how the language can be
and has been twisted. So for a usage that is somewhat off the main
road, I likely do know better.
There is nothing special in this regard about me and English. I
expect that the same is true about evertjan and Dutch. The difference
is that I would not make sweeping statements to evertjan about how
Dutch works.
Sincerely,
Gene Wirchenko
[toc] | [prev] | [next] | [standalone]
Page 1 of 4 [1] 2 3 4 Next page →
Back to top | Article view | comp.lang.javascript
csiph-web