r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Ann-Reply] Reply to Announce group

Cyphre
27-Oct-2010
[2262]
Maxim, it works for me now, cool. Some notes:

-The usage/interface seems to me too clunky. Better would be something 
like:
append win make gob! [
	offset: ...
	size: ...
	data: context [
		renderer: 'opengl
	]
	draw: [trinagle ... sphere ... whatever] ;your 3d dialect here
]
And that's it IMO there is no need for other 'bloat' around.

-Since you are proposing the CGR philosophy:

1.is it possible to use more than one gl-gob ? I tried just a quick 
attempt but it failed for me.

2. is it possible to compose normal gobs together with the gl? I 
had no luck with this either.

Regarding the performance:

I don't think there is anything to comment at the moment because 
you are just using the raw/built-in OpenGL abilities (same stuff 
we did with Ladislav and Cal 5 years ago in R2). So talking here 
about FPS or number of polygons has the same information as saying: 
"I have older/newer gfx card" The fps is not related to the current 
code...everything is just direct HW executed calls.
Maxim
27-Oct-2010
[2263x3]
in the current stat of the host-kit and rebol architecture in general:
---------------------------

1) I cannot use data, since that is being used by r3_gui.r3 so it 
has in effect become a reserved word which we can't use.

2) if I use gob/draw, then I am in fact trying to hijack the meaning 
 of  draw gob... an AGG draw block.

3) the current gob! API is very limited because it was shrunk to 
handle a very specific use case.  I can't really play around with 
anything cause it just breaks up real quick (I tried).

4) the CGR API doesn't have a scene dialect yet, but that is just 
high-level use.  if you look at the code, its 4 lines of code to 
have an openGL high-rez model viewable in a window... I hardly consider 
that bloat.

5) using commands to manage a real life scene with several thousand 
animated, deforming objects and scene changes, is a nice dream. it 
doesn't work in practice since just managing the thousands of blocks 
this requires ends up eating a way a sizeable part of the CPU and 
ram.  

6) data marshalling is heavy, REBOL datatype access is heavy, datatypes 
use A LOT of ram, and the GC is extremely intrusive,  CGRs solve 
all of this while still making the high-level interface easy as pie.

7) primitives are more than just dead weight they allow direct access 
to/from rebol and the CGR itself.  they are the *low* level interface 
which can be used directly or directed by the use of a dialect later. 
  the difference from AGG is that these structures are persistent 
for many reasons, which will be much clearer in the future.

8) CGRs are not only for 3d graphics, but for any rendering.  primitives 
are a generic container to access/construct any rendering engine 
in the same way. ie. all CGR will use the same core cgr dialect.

9) the code does support multiple cgr gobs, but it might have bugs... 
I didn't even try it yet... I was busy getting this stable and released 
asap.

10) The opengl-cgr currently doesn't integrate into the view compositing, 
since that instantly *kills* rebol.  I mean... totally.  500x500 
a 30fps... = 100% cpu just blitting graphics (not even opengl rendering). 
 opengl-cgr uses the container mode, which actually uses up a sub-window 
(like every single construct in windows) and allows system double 
buffering in that area.

11) CGRs are compatible with all other gobs, though they must be 
built to support the internal gfx pipeline by using the compositor 
or image rendering modes.  That is how I started and it was quickly 
obvious how un feasible it was for opengl.

12) rendering performances ARE very implementation specific. using 
show instead of cgr-refresh on the display loop will show a performance 
penalty anywhere from 10-1000% (depending on nested gob depth & size). 
 If I didn't create internal data for the models, the large tree 
example would run much slower, if I used commands to call every opengl 
call in the large tree example, it would likely take several seconds 
a frame even with hw support.

in the future:
----------------------------

-there will be (hopefully) a small number of changes to the host-kit 
which will allow 1, 2, 3 to be resolved in a more natural REBOL feel... 
this current implementation actually highlights those needs and you 
where quick to point them out  :-)

-concurrency requires a bit more sophisticated structures to prevent 
locks, using the current design I solve some (though not all, yet) 
of the requirements for true concurrency, and this directly relates 
to issues and/or decisions in 5, 6, 7 & 8

-my goal is to have a high-performance rendering engine which isn't 
bound by any inherent design incompatibilities between REBOL and 
optimised native code, especially if the engine has access to hardware 
in parralel to the interpreter.  when i look at all the current games 
out there and they slow down even using only compiled code and sometimes 
not even really complex scenes, I don't want to fall into the trap 
of adding an additional layer of slowness which is to have the interpreter 
doing the renderer's job.

-I'm not trying to make a "cool" rebol plugin... I am trying to make 
an engine which is optimisized to run within REBOL.  the idea being 
not to help out rebolers per say, but to attract people with rendering 
needs TO REBOL because it has a high-perfomance engine *built-in* 
to which you can graph any actual renderer (DX, OpenGL, video frame 
buffers, etc).
-did I mention I want to make an AGG CGR ?  ;-)
note that a lot of this is covered in more details in the various 
ReadMe files I took the time to write prior to release.
btw it is working with multiple CGR gobs, the issue is just that 
I'm having a bit of trouble determining exactly what coordinates 
to use  and they are currently always at 0x0 offset.

I'm working on this right now.
AdrianS
27-Oct-2010
[2266]
FYI, your latest release works for me, Win 7 64 bit, Radeon 5770 
with 10.10 drivers, in the sense of not crashing, but the actual 
3D shape being drawn is not really visible. It is vaguely visible 
as the drawing surface is rendered and you see flickering bits of 
the surface, here and there
Maxim
27-Oct-2010
[2267x3]
did you try with the torus scene?
I would love to get a screengrab... I might have ideas of the cause 
but without a pic its going to be tough to fix it if its indeed a 
bug.
if you press on the window edge (which stops animation) does the 
model appear completely?
AdrianS
27-Oct-2010
[2270x3]
the animation doesn't seem to stop when clicking the window edge, 
for me
as for a screen grab, I think I'd probably capture a black window 
- the actual shape is seen very intermittently, just a flicker now 
and then
yeah, tried to capture and all I get is black
Maxim
27-Oct-2010
[2273x3]
very strange, since I'm calling the most basic open gl stuff.
ati always had less than optimal opengl support
but I would have thought that its getting better with all those ati 
cards in macs... anyhow  it could even be an issue specific to win 
7 in 64 bits.
Cyphre
28-Oct-2010
[2276]
Hey Maxim, just a quick reply...


re 1) IMO that is not good argument. You can use GOB/DATA. It is 
really easy to change R3GUI rather to change GOB datatype.


re 2) Nope. There is no problem to have the current GOB/DRAW dialect 
for 3D commands. The current DRAW is completelz flexible and can 
be enhanced. Also if you are proposing abstracted way for 'renderers' 
then it shouldn't matter if you are rendering 2D or 3D objects so 
no need to have different dialects just because of 2D or 3D behaviour 
(see the OpenGL api, it is also mixed)


re 3) not sure what you are missing on the GOB! datatype..Can you 
clarify?


re 5) I disagree here: the 3D dialect is way to go. It should be 
possible to do a direct commands calls for simple things and use 
vertex arrays and other advanced features for bigger things. I don't 
see any problem why this couldn't be done by command dialect.

re 6) to 12) and the rest:
I'm not trying to make a 

cool" rebol plugin..." - so I hope you won't propose this Carl to 
put into the official HostKit distro :-P

The more you talk about your design the more it looks you are missing 
the point of Rebol need for HW acceleration in more generic sense. 
Don't take it personally, but your approach looks like just yet-another-opengl 
binding extension that every other language have. Until that I thought 
you are planning to do it in a more 'rebolish' way but nevermind, 
at least it is clear now. In any way I wish you good luck with your 
extension! ;)


BTW I think It's time to dust off my OpenGL accelerated R3 prototype 
soon... http://cyphre.mysteria.cz/tests/agg-hw.png(And it will work 
on *all* gfx cards made in the last 5 years ;))
Pekr
28-Oct-2010
[2277]
go cyphre, go :-) The more general way is always better. OTOH why 
not add field here or there - but - not for the purpose of one user, 
but once again, upon the well defined purpose ...
AdrianS
28-Oct-2010
[2278]
I've used this card with a bunch of other 3D demos and with Processing 
(processing.org) and the OpenGL support seemed to be very good - 
must be something specific to the way you set things up, I would 
think
Maxim
28-Oct-2010
[2279]
Adrian you are having a very strange problem.  the actual OS and 
opengl code being called is textbox 1.1 OpenGL  I will try to look 
into it, though with the little I've seen the 5xxx series ATI cards 
do come up often has being  "troublemakers" in OpenGL dev, though 
by all accounts the 10.10 drivers seem to cure problems for most 
users.


now I'm not downplaying that its something in my code, its possible 
there is a little something to add explicitely to make your card 
work which is done implicitely on other setups...

if you don't mind I'll use you to test anything I can find.  you 
are at the opposite end of my setup,  mobile nvidia card running 
on 32 bit xp.
AdrianS
28-Oct-2010
[2280]
I'll try whatever you want me to. As a point of note, it kind of 
looks like the animation is showing 1 in 10 to 30 frames or so. Also, 
I'm not sure that the colour rendering is OK - there seem to be too 
few colours used. Can you take a screen cap showing the torus on 
your end?
Maxim
28-Oct-2010
[2281]
its a brown torus:   http://www.pointillistic.com/open-REBOL/moa/files/opengl-torus.png
AdrianS
28-Oct-2010
[2282]
The colours look OK, comparing to your output. Is there anything 
in your offscreen buffering that could be an issue?
Maxim
28-Oct-2010
[2283x2]
I'm using double buffering, and use swapbuffers at each refresh.
one thing I've been wondering... do you have AA hard-coded in your 
preferences?
Gregg
28-Oct-2010
[2285]
%opengl-test.r3 ran fine.

%opengl-simple-test.r3 crashed after a few seconds:

@** Script error: cannot access window in path event/window/data

** Where: all -apply- wake-up loop -apply- wait forever catch either 
either -apply- do
** Near: all [
    obj: event/window/data
    obj: select obj 'handle...

Same error for complex tree.


Happened on torus too, then I figured it out. The error occurs if 
I move the mouse over the animated area. Other than that, it looks 
very cool Max.
Maxim
28-Oct-2010
[2286]
gregg, that looks like an older version of the distro... the new 
files are:
opengl-torus.r3
opengl-simple-tree.r3
opengl-complex-tree.r3


also the error looks like something I patched in r3-gui.r3 not handling 
data-less gobs... did you update/change your r3-gui.r3 in the distro?
Gregg
28-Oct-2010
[2287x2]
Just downloaded the release from yesterday and unzipped over the 
old one.
If it's known to be fixed, that good.
Maxim
28-Oct-2010
[2289x2]
could it have been cached in your browser?
(its happened to me before)
Gregg
28-Oct-2010
[2291]
The zip is a different size, so I don't think so. Complex and Torus 
are dated yesterday, the others for the 25th and 26th.
AdrianS
28-Oct-2010
[2292]
Max, the AA settings seem to be the cause of the problem. The card 
was set to "Use application settings" and this resulted in the problem 
- guessing that you're not doing everything you should be to set 
AA up. When I uncheck the option (basically have AA globally set), 
your demo works.
ChristianE
28-Oct-2010
[2293]
Max, I'm expierencing the same flickering as Adrian does, I'm running 
on a 3/4 year old Sony VAIO with Win7. I can't supply any further 
detail, I'm don't have access to the machine right now. I see a flickering 
torus , a flickering  simple tree and no complex tree at all. When 
I'm back at the machine, I'll try with the AA settings which Adrian 
seems to have identfied as the source of the confusion in just this 
moment.
Maxim
28-Oct-2010
[2294]
I was expecting something else to occur, so funny that my guess was 
related.   I'm actually not touching the AA settings.
AdrianS
28-Oct-2010
[2295]
looks like not doing anything is not always the right thing - is 
it complicated to set the AA level?
Maxim
28-Oct-2010
[2296x5]
I'll look into it, all cards have peculiarities like this.
I actually don't know I haven't played with AA setup yet.
its probably just a simple glCall to do when we settup the viewport.
(simple when we don't want AA... requiring AA probably needs a bit 
more work, since we usually have to chose between what is available)
just tought I'd post this little code snippet for fun....


here is the smallest running opengl application I've ever seen  :-)

rebol []

import %opengl-cgr.dll 

win: make gob! [text: "GL_API TEST" offset: 500x50 size: 300x300 
]
append win box: OpenGL-Gob [size: 300x300]

make-primitive box 'polygon [shape: [vertices [0 1 0  -1 0 0  1 0 
0] faces [ 2 1 0] ] changed: [shape]]
view/as-is win
Gregg
1-Nov-2010
[2301]
Good stuff Kaj. Have you posted how you implement server limits when 
serving REBOL up this way? That could be useful information, based 
on first-hand experience.
Kaj
1-Nov-2010
[2302x3]
Thanks. I'm just executing user scripts through a shell script:
ulimit -t 30 -m 20000 -v 10000 -u 10 -n 100 -f 200

/users/try-REBOL/program/r3 -q /users/try-REBOL/program/do-rebol.r 
$1
The ulimit sets standard Linux resource limits for the process and 
its REBOL child process that gets started afterwards
Gregg
1-Nov-2010
[2305]
Thanks Kaj.
Kaj
1-Nov-2010
[2306]
There should be a more efficient way, for example if you have a REBOL 
binding to the ulimit function, but the detour through the shell 
script is a quick solution
GrahamC
4-Nov-2010
[2307]
Doc, I don't even know what ldap is, but perhaps we should be using 
github for releasing all unfinished work?
Dockimbel
4-Nov-2010
[2308]
Just for one file of 17Kb? Sounds overkill...
GrahamC
4-Nov-2010
[2309x3]
far from it
17,000 bytes ....
If you haven't finished it I presume it is not a trivial task