World: r3wp
[Core] Discuss core issues
older newer | first last |
Volker 19-May-2006 [4501] | You need a lot performance? |
Geomol 19-May-2006 [4502x2] | I'm using this feature in the OpenGL API, I'm working at. Maybe I could do a late reduce, when accessing the inner blocks. |
Volker, yes I need all the performance, I can get for this. | |
james_nak 19-May-2006 [4504] | Is there a time when one doesn't want inner blocks to be reduced? |
Volker 19-May-2006 [4505x2] | I don't wanna have REDUCE inside the block. Is that only inconveniert, or would it really make problems? Maybe some kind of automatic rewriting could help? |
James, parse-rules inside a block? | |
james_nak 19-May-2006 [4507x3] | Yep. You're right. |
I was just thinking how this particular behavior has caused me some trouble in the past but I see why they did it that way. | |
You would think there would be a "complete" reduce parameter though that just works the way one would think it would. | |
Volker 19-May-2006 [4510] | Would rebcode be an option? Or a dll for some datastructures? |
Geomol 19-May-2006 [4511] | Volker, a rebcode version will probably make sense later, but I'm under OSX right now, where the rebcode is an old version. |
Volker 19-May-2006 [4512] | I doubt i find a good idea, so if i am boring just say stop. Would it work to flatten the datastructure? /skip instead of nested blocks? Tehn 'reduce would work. |
Geomol 19-May-2006 [4513] | Well, that could work. But the situation is, that the datastructure is made by the user, so it should be as straight-forward as possible. Example of a structure: vdata: [ [- X 0.0 Z] [X 0.0 Z] [- X 0.0 - Z] [X 0.0 - Z] [0.0 Z X] [0.0 Z - X] [0.0 - Z X] [0.0 - Z - X] [Z X 0.0] [- Z X 0.0] [Z - X 0.0] [- Z - X 0.0] ] I think, I'll do a late REDUCE of the inner blocks, when I access them. But thanks for your ideas! :-) |
Volker 19-May-2006 [4514x2] | You could also "compile" the users data into something else one time, and have a better format in the loops? |
But if it works for now go on with the funnier stuff :) | |
Geomol 19-May-2006 [4516] | You see, the C version of that structure is this: static GLfloat vdata[12][3] = { {-X, 0.0, Z}, {X, 0.0, Z}, {-X, 0.0, -Z}, {X, 0.0, -Z}, {0.0, Z, X}, {0.0, Z, -X}, {0.0, -Z, X}, {0.0, -Z, -X}, {Z, X, 0.0}, {-Z, X, 0.0}, {Z, -X, 0.0}, {-Z, -X, 0.0} }; And I want something similar, so users don't confused too much. |
Volker 19-May-2006 [4517] | Makessense. |
james_nak 19-May-2006 [4518] | Are the users going to enter such an array as above? |
Geomol 19-May-2006 [4519x2] | I already have some OpenGL examples from the red book of OpenGL running in REBOL syntax. It's funny to see those examples in REBOL with the minor syntax. :-) I have no real idea of performance yet, I need heavier examples for that. |
james, no C syntax. I'm making a REBOL version of the OpenGL API with REBOL syntax. Users will be able to use normal REBOL and call OpenGL functions (with REBOL syntax). | |
james_nak 19-May-2006 [4521] | Thanks. And right now, it's the variables (x,y,z) reduction that is the problem? |
Geomol 19-May-2006 [4522x3] | yes |
To give you an idea. Instead of doing this in C: glClear (GL_COLOR_BUFFER_BIT); glColor3f (1.0, 1.0, 1.0); glBegin (GL_POLYGON); glVertex3f (0.25, 0.25, 0.0); glVertex3f (0.75, 0.25, 0.0); glVertex3f (0.75, 0.75, 0.0); glVertex3f (0.25, 0.75, 0.0); glEnd (); glFlush (); You can do this in REBOL: glClear GL_COLOR_BUFFER_BIT glColor3f 1.0 1.0 1.0 glBegin GL_POLYGON glVertex3f 0.25 0.25 0.0 glVertex3f 0.75 0.25 0.0 glVertex3f 0.75 0.75 0.0 glVertex3f 0.25 0.75 0.0 glEnd glFlush | |
Those are functions, so you can mix it with other REBOL words, like loops or whatever. | |
james_nak 19-May-2006 [4525x2] | so something like glBegin GL_POLYGON glVertex3f 0.25 0.25 0.0 glVertex3f 0.75 0.25 0.0 glVertex3f 0.75 0.75 0.0 glVertex3f 0.25 0.75 0.0 glEnd Gets turned into vdata: [ [- X 0.0 Z] [X 0.0 Z] [- X 0.0 - Z] [X 0.0 - Z] [0.0 Z X] [0.0 Z - X] [0.0 - Z X] [0.0 - Z - X] [Z X 0.0] [- Z X 0.0] [Z - X 0.0] [- Z - X 0.0] ] |
Without the vars of course. | |
JaimeVargas 19-May-2006 [4527] | John, Is your opengl api rendering in a rebol window or face? |
Geomol 19-May-2006 [4528x2] | The commands are sent to a C program (task), that'll execute the OpenGL code. So the C program owns the window, not REBOL. |
Jaime, the answer to your question is: no. | |
Geomol 20-May-2006 [4530x3] | james, no. It's from 2 different programs. The datastructure is just used in one example. Some OpenGL commands take pointers to datastructures as a parameter. |
You can see the full example here: http://home.tiscali.dk/john.niclasen/OpenGL/GLClient.html First you have the C source, and below that the REBOL source, that'll do the same thing. I first thought about putting a REDUCE in, where vdata is defined, but I've changed my mind. The glVertex3fv function has to reduce it's argument. | |
And that of course doesn't work. The datastructure has to be like this in REBOL: vdata: [ [- X 0.0 Z] [X 0.0 Z] [- X 0.0 (- Z)] [X 0.0 (- Z)] [0.0 Z X] [0.0 Z (- X)] [0.0 (- Z) X] [0.0 (- Z) (- X)] [Z X 0.0] [(- Z) X 0.0] [Z (- X) 0.0] [(- Z) (- X) 0.0] ] Maybe it's time to make a new group about this. I'm not home the rest of the day (beer festival going on), but I should have something for others to try out tomorrow (those who's interested). | |
Volker 20-May-2006 [4533] | enblock (reduce deblock data) 3 Some meazzines i use sometimes. But they are meazzines, if speed reeally is an issue.. |
Geomol 20-May-2006 [4534x2] | I could use NEGATE in stead of unary minus though. hmm |
Volker, I've solved the reduce problem, and it makes sense now. The C function glVertex3fv takes a pointer to it's data as a parameter. I do the same thing in REBOL (using a block), and I then reduce it inside the REBOL function glVertex3fv itself. | |
Volker 20-May-2006 [4536] | Good idea. Also lazy, if you have lots of unused data its only reduced if needed. |
Geomol 20-May-2006 [4537] | That way the block can hold variables, that'll change, and only when the function is called, the block is reduced to values. |
Volker 20-May-2006 [4538] | But make sure the datadoes not change in the meantime. The 'x etc. |
Geomol 20-May-2006 [4539] | Well, if the programmer wants it to change, that'll work too. :-) |
Volker 20-May-2006 [4540] | Or that way around :) |
Geomol 20-May-2006 [4541] | heh, it works now. I get a icosahedron drawn. :-) |
Volker 20-May-2006 [4542x3] | Congrats :) |
Is there a way to mix it with the 3d-engine from the contests? So plain rebol could be used as 3d-editor? | |
YOu would get a robot for free :) | |
Geomol 20-May-2006 [4545x2] | Thanks! Actually I map from the pointer function glVertex3fv to glVertex3f, which takes it parameters as values, but that should be no problem. (I can't send a pointer to another task over tcp.) |
What contests? What 3d-engine? :) | |
Volker 20-May-2006 [4547x3] | with /viewtop: rebol/contest/i-rebot.r |
(I suddenly have name-blackouts) That great tutotial-writer has a little demo how to use the engine IIRC. | |
http://musiclessonz.com/rebol_tutorial.html#section-21.9 | |
Geomol 20-May-2006 [4550] | Yes, it should be possible to call my OpenGL functions from an engine like that. That's the sort of things, I'm going to use this for. Only thing is, that the OpenGL window is inside a C execute, so you can't put REBOL controls (view stuff) in there. But you can then just have 2 windows. |
older newer | first last |