World: r3wp
[Core] Discuss core issues
older newer | first last |
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 [4550x2] | 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. |
One window with OpenGL output and another window with REBOL buttons etc. to control the thing. | |
Volker 20-May-2006 [4552x2] | I thought to use it for rendering too. Two modes rebol only with controls, or without 3d-card. and textures etc with real gl. |
I think of a world ingl, with lots of models. and for editing a model can be picket into the rebol-window. (much smaller, rebol can handle that.) But maybe overkill and better concentrate on gl-integration? | |
Geomol 20-May-2006 [4554x2] | We'll see, how fast this thing I'm building will be. I hope to be able to use it like you think of - having a world with lots of 3D stuff and be able to walk around and change things. |
... all controlled from REBOL. | |
Henrik 20-May-2006 [4556] | like in Jurassic Park! |
Anton 21-May-2006 [4557x2] | I have just managed to patch FTP handler so it creates subdirectories recursively as needed. So code like this, which would fail before if the directory didn't exist, now works: write ftp://user:[pass-:-server-:-dom]/my-dir/test "hello" |
I'm announcing this because it took me a bloody long time. You could fairly easily do your own recursive make-dir at the usual rebol level, but since the recursive mkdir is done inside the handler, the overhead of opening/closing/initializing ports is avoided. Phew! I'll publish that after some more cleaning and testing. | |
Geomol 21-May-2006 [4559] | Isn't this a bit funny? >> "x" = "X" == true >> #"x" = #"X" == false But luckily it works in e.g. SWITCH: >> switch #"x" [#"X" [print "x found"]] x found Maybe #"x" = #"X" should be true in REBOL3? |
Anton 21-May-2006 [4560x2] | SWITCH is implemented using SELECT without the /case refinement, therefore it's case insensitive. |
It's possible to add a /case refinement to the SWITCH.... | |
Geomol 21-May-2006 [4562] | Makes sense, but should #"x" = #"X" be true? Comparing strings like "abc" = "AbC" is true. |
older newer | first last |