C00PER
12-08-2004, 01:49 PM
Hi. I have some questions regarding those GW. functions described in Viewport Drawing Methods. First - I can't figure out, why example showed in that chapter doesn’t work correctly. Here's the code:
-- Draw some primitives
gw.hPolyline #([300,50,16], [300,200,8], [450,250,4]) true
--
gw.hPolygon #([200,100,16], [280,100,8], [250,200,4]) \
#(red, blue, green) \
#([1.0,.5,0], [0.5,0.5,0], [0,0,0.5])
--
gw.hTriStrip #([50,50,0], [175,100,0], [25,100,0], [150,250,0]) \
#(red, blue, green, white) \
#([1.0,.5,0], [0.5,0.5,0], [0,0,0.5], [0.5,1,0])
--
-- Update the viewports
gw.enlargeUpdateRect #whole
gw.updateScreen()
This should draw 3 figures – Polyline, Polygon and TriStrip (not actually sure what TriStrip is). However it draws only hPolyline. After hour of experiments I found out that after switching video driver to Software mode hPolygon figure is finally drawn, but hTriStrip is not. So where's the catch?
Second question – How can I clear all previously drawn fiures during drawing of another figure? I am trying to make something similar to Render Region frame, not so complicated of course, it will be a simple rectangle without fill, with top left corner in the point of first click and bottom right corner in the point of mouse cursor. This rectangle should redraw when mouse moves, however all I can do is either leave previously drawn rectangle and add new ones and create a mess, or complecely clear specified region using gw.clearScreen <Box2>, so there will be only flat color. But I need to see objects below frame! Of course I can include completeredraw() command but it is so slow that it makes no sence to use those fast GW functions.. There should be a way to erase drawn figure but leave underlying viewport image
Here is the simple loop that draws a line with moving second point. How to erase old line without using completeredraw() and at the same time not loose viewport cotents?
mypoint1 = [50,80,0]
mypoint2 = [200,200,0]
for i = 1 to 200 do
(
gw.wPolyline #([mypoint1.x,mypoint1.y,10], [mypoint2.x,mypoint2.y+i,10]) true
gw.enlargeUpdateRect #whole
gw.updateScreen()
)
Thanks in advance.
-- Draw some primitives
gw.hPolyline #([300,50,16], [300,200,8], [450,250,4]) true
--
gw.hPolygon #([200,100,16], [280,100,8], [250,200,4]) \
#(red, blue, green) \
#([1.0,.5,0], [0.5,0.5,0], [0,0,0.5])
--
gw.hTriStrip #([50,50,0], [175,100,0], [25,100,0], [150,250,0]) \
#(red, blue, green, white) \
#([1.0,.5,0], [0.5,0.5,0], [0,0,0.5], [0.5,1,0])
--
-- Update the viewports
gw.enlargeUpdateRect #whole
gw.updateScreen()
This should draw 3 figures – Polyline, Polygon and TriStrip (not actually sure what TriStrip is). However it draws only hPolyline. After hour of experiments I found out that after switching video driver to Software mode hPolygon figure is finally drawn, but hTriStrip is not. So where's the catch?
Second question – How can I clear all previously drawn fiures during drawing of another figure? I am trying to make something similar to Render Region frame, not so complicated of course, it will be a simple rectangle without fill, with top left corner in the point of first click and bottom right corner in the point of mouse cursor. This rectangle should redraw when mouse moves, however all I can do is either leave previously drawn rectangle and add new ones and create a mess, or complecely clear specified region using gw.clearScreen <Box2>, so there will be only flat color. But I need to see objects below frame! Of course I can include completeredraw() command but it is so slow that it makes no sence to use those fast GW functions.. There should be a way to erase drawn figure but leave underlying viewport image
Here is the simple loop that draws a line with moving second point. How to erase old line without using completeredraw() and at the same time not loose viewport cotents?
mypoint1 = [50,80,0]
mypoint2 = [200,200,0]
for i = 1 to 200 do
(
gw.wPolyline #([mypoint1.x,mypoint1.y,10], [mypoint2.x,mypoint2.y+i,10]) true
gw.enlargeUpdateRect #whole
gw.updateScreen()
)
Thanks in advance.
