[PD-dev] gem ortho
I am trying to convert an opengl app to a gem object but I am still a bit confused as to the ortho thing. I have it pretty much converted but I can only see it using ortho and it looks very small. This app is made to be viewed using gluOrtho2D ( 0.0, 1.0, 0.0, 1.0 ); but I cant figure out how to see it right in gem. I have tried using perspect in conbination with view but I dont think I quite get what to do with it. Any help? Thanks, Alain ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Re: [PD-dev] smoke object help
Thanks for your responce. perspec -1 640 -1 480 1 1001 did the trick. What I dont get is why I cant do perspec -1 640 -1 480 999 1001 and view 0 0 1000. The image disapears I have to have perspec at 1 1001 to see an image. Even if I do 2 1001 I get nothing. With other geos it works but not with this one I am writing. Could it be that my z depth is set at -1. I dont think that is it but maybe some one can explain that to me. Thanks, Alain From: marius schebella [EMAIL PROTECTED] Date: 2007/08/04 Sat PM 04:16:20 EDT To: [EMAIL PROTECTED] CC: pd-dev@iem.at Subject: Re: [PD-dev] smoke object help hi, I did not follow the whole thread of this discussion, so maybe you are talking about something different, but to change the cameraposition and viewing point of the gem window send the message view (and maybe also perspec) to the gemwin object (see help patch of gemwin 'pd viewing') marius. [EMAIL PROTECTED] wrote: The reason I was not seeing anything was that the code was using glVertex2f and it seems that anything above -1 z depth desapears in gem. So I ended up using glVertex3f( number,number, -1.1) and now I can see stuff happening. Now my problem is that the action is all limited to the positive side of the grid. Also coordinate 500,500 is 0,0 in the gem grid and 0,0 is 2.5,2.5 on the gem grid. If anyone knows a simple way to fix this let me know. Thanks, Alain From: [EMAIL PROTECTED] Date: 2007/08/03 Fri AM 08:47:08 EDT To: pd-dev@iem.at CC: [EMAIL PROTECTED] Subject: [PD-dev] smoke object help Hi all, I posted this in the gem-dev list but maybe someone here can give a some advise or a different solution for my problem. The reason I am trying to use gem is because they have already figured out the glLoop problem between openGL and Pd. Also because I then would have access to the other gem objects. I am trying to transcribe this glut application here: http://www.nada.kth.se/~gustavt/fluids/ into a gem object. At first at thought it would be easy seeing as the code was pretty much working but I am having a tough time of it. I compiled the original application and it works perfect but it seems like when I convert it to a gem object I get nothing. Here are some things I am assuming, please correct me... 1. glut and openGL/Gem use the same measurements like when I use glVertex2f(px, py); it is the same in both. 2. Instead of using the glut mouse controls I can use a list inlet to get x and y coordinates. Other than that I pretty much copied the app and used render(GemState *state) to put all of the rendering stuff into. But I still cant get it to work. I get a black screen. I think it is probably drawing somewhere of screen but I really cant seem to figure out how to fix the problem. If anyone can give me a clue I would appreciate it. Thanks, Alain ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Re: [PD-dev] smoke object help
The reason I was not seeing anything was that the code was using glVertex2f and it seems that anything above -1 z depth desapears in gem. So I ended up using glVertex3f( number,number, -1.1) and now I can see stuff happening. Now my problem is that the action is all limited to the positive side of the grid. Also coordinate 500,500 is 0,0 in the gem grid and 0,0 is 2.5,2.5 on the gem grid. If anyone knows a simple way to fix this let me know. Thanks, Alain From: [EMAIL PROTECTED] Date: 2007/08/03 Fri AM 08:47:08 EDT To: pd-dev@iem.at CC: [EMAIL PROTECTED] Subject: [PD-dev] smoke object help Hi all, I posted this in the gem-dev list but maybe someone here can give a some advise or a different solution for my problem. The reason I am trying to use gem is because they have already figured out the glLoop problem between openGL and Pd. Also because I then would have access to the other gem objects. I am trying to transcribe this glut application here: http://www.nada.kth.se/~gustavt/fluids/ into a gem object. At first at thought it would be easy seeing as the code was pretty much working but I am having a tough time of it. I compiled the original application and it works perfect but it seems like when I convert it to a gem object I get nothing. Here are some things I am assuming, please correct me... 1. glut and openGL/Gem use the same measurements like when I use glVertex2f(px, py); it is the same in both. 2. Instead of using the glut mouse controls I can use a list inlet to get x and y coordinates. Other than that I pretty much copied the app and used render(GemState *state) to put all of the rendering stuff into. But I still cant get it to work. I get a black screen. I think it is probably drawing somewhere of screen but I really cant seem to figure out how to fix the problem. If anyone can give me a clue I would appreciate it. Thanks, Alain ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Re: [PD-dev] help-array crashing outlet_anything
Ok I tried with a static array like Class array[amount] and it did not crash, it worked perfect. Now I have to figure out what I am doing to cause a crash (with heavy cpu load I persume, still a bit confused?) using a dynamic array? It would be nice to have a dynamic array so as not to eat up so much ram. Alain From: [EMAIL PROTECTED] Date: 2007/07/25 Wed PM 03:35:33 EDT To: chris clepper [EMAIL PROTECTED] CC: pd-dev@iem.at Subject: Re: [PD-dev] help-array crashing outlet_anything It doesn't thats whats confusing me. Pixel data is the same on both exept it takes more cpu to process. I think it has to do with cpu load but I am not sure. I think I am going to just try a simple Class array[amount] intead of Class *pointer = new Class[amount] see if that would be easier on the cpu or the coding gods. Alain From: chris clepper [EMAIL PROTECTED] Date: 2007/07/25 Wed PM 01:04:52 EDT To: [EMAIL PROTECTED] [EMAIL PROTECTED] CC: pd-dev@iem.at Subject: Re: [PD-dev] help-array crashing outlet_anything On 7/25/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: BTW its a blobtracking external. It is working perfect tracking quicktime movies but the camera tracking only works if I exclude the addToArray function. This really has me scratching my head! Why would your processing code know or even care if the input is from a camera or a file? Both should be pixel arrays with no differences in their format. ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Re: [PD-dev] help-array crashing outlet_anything
It doesn't thats whats confusing me. Pixel data is the same on both exept it takes more cpu to process. I think it has to do with cpu load but I am not sure. I think I am going to just try a simple Class array[amount] intead of Class *pointer = new Class[amount] see if that would be easier on the cpu or the coding gods. Alain From: chris clepper [EMAIL PROTECTED] Date: 2007/07/25 Wed PM 01:04:52 EDT To: [EMAIL PROTECTED] [EMAIL PROTECTED] CC: pd-dev@iem.at Subject: Re: [PD-dev] help-array crashing outlet_anything On 7/25/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: BTW its a blobtracking external. It is working perfect tracking quicktime movies but the camera tracking only works if I exclude the addToArray function. This really has me scratching my head! Why would your processing code know or even care if the input is from a camera or a file? Both should be pixel arrays with no differences in their format. ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Re: [PD-dev] Pd external-window crash
Jamie, I am running thru your 2004 apple developer posts. http://lists.apple.com/archives/carbon-development/2004/Jan/msg00318.html I am trying to figure out how you solved the carbon windowing issue you had with Gem for my external but you never posted a solution. What did you finaly do to get it working? I am looking at the GemWinCreateMac.cpp but cant find the solution. Thanks, Alain From: [EMAIL PROTECTED] Date: 2007/06/25 Mon AM 09:18:44 EDT To: pd-dev@iem.at Subject: Re: [PD-dev] Pd external-window crash Well it looks like if I get a Gemwin opened first, then I can open an opencv window without a crash... It seems like the window is made using Carbon. Is there any special way Pd handles Carbon windows that would cause this stall? This is my last hurdle. I have my externals working but in order to use the carbon window I have to open a gemwin first(not very profecional). I am using an opencv function for windowing that looks like this: CV_IMPL int cvNamedWindow( const char* name, int flags ) { int result = 0; CV_FUNCNAME( cvNamedWindow ); if (!wasInitialized) cvInitSystem(0, NULL); // to be able to display a window, we need to be a 'faceful' application // http://lists.apple.com/archives/carbon-dev/2005/Jun/msg01414.html static bool switched_to_faceful = false; if (! switched_to_faceful) { ProcessSerialNumber psn = { 0, kCurrentProcess }; OSStatus ret = TransformProcessType (psn, kProcessTransformToForegroundApplication ); if (ret == noErr) { SetFrontProcess( psn ); switched_to_faceful = true; } else { fprintf(stderr, Failed to tranform process type: %d\n, (int) ret); fflush (stderr); } } __BEGIN__; WindowRef outWindow = NULL; OSStatus err = noErr; RectcontentBounds = {100,100,320,440}; CvWindow* window; UInt wAttributes = 0; int len; const EventTypeSpec genericWindowEventHandler[] = { { kEventClassMouse, kEventMouseMoved}, { kEventClassMouse, kEventMouseUp}, { kEventClassMouse, kEventMouseDown}, { kEventClassWindow, kEventWindowClose }, { kEventClassWindow, kEventWindowBoundsChanged }//FD }; if( !name ) CV_ERROR( CV_StsNullPtr, NULL name string ); if( icvFindWindowByName( name ) != 0 ){ result = 1; EXIT; } len = strlen(name); CV_CALL( window = (CvWindow*)cvAlloc(sizeof(CvWindow) + len + 1)); memset( window, 0, sizeof(*window)); window-name = (char*)(window + 1); memcpy( window-name, name, len + 1 ); window-flags = flags; window-signature = CV_WINDOW_MAGIC_VAL; window-image = 0; window-last_key = 0; window-on_mouse = 0; window-on_mouse_param = 0; window-next = hg_windows; window-prev = 0; if( hg_windows ) hg_windows-prev = window; hg_windows = window; wAttributes = kWindowStandardDocumentAttributes | kWindowStandardHandlerAttribute | kWindowLiveResizeAttribute; err = CreateNewWindow ( kDocumentWindowClass,wAttributes,contentBounds,outWindow); if (err != noErr) fprintf(stderr,Error while creating the window\n); SetWindowTitleWithCFString(outWindow,CFStringCreateWithCString (NULL,name,kCFStringEncodingASCII)); if (err != noErr) fprintf(stdout,Error SetWindowTitleWithCFString\n); window-window = outWindow; err = InstallWindowEventHandler(outWindow, NewEventHandlerUPP(windowEventHandler), GetEventTypeCount(genericWindowEventHandler), genericWindowEventHandler, outWindow, NULL); ShowWindow( outWindow ); result = 1; __END__; return result; } It seems to me that if this works outside of Pd then there must be something Pd needs in order to display a carbon window properly. It seems that the faceful stuff was written in to prevent this from happening but it doesnt work in Pd. I have been digging thru the Gem code to find out how it does it but it is so intertwined with the openGL code that I cant seem to figure out how it displays a carbon window corectly. Anyway if anyone has any ideas let me know. Until I figure this out I will be opening up a gemwin along with my external:(. Alain ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
[PD-dev] sending data out using sprintf
I am trying to send some data out of an outlet using a symbol pointer. I have tried using sprintf like martin suggested with little succes. I am sure I am the one doing something wrong. I am getting a pointer symbol but I am not able to convert the pointer back. In external#1 I have: The out IplImage *frame; char symstr[10]; t_symbol *sym; sprintf(symstr, %p, frame); sym = gensym(symstr); outlet_symbol(x-m_outFrames, sym); With this I get an address like: symbol 0x1159da0 ...but on the conversion in external#2 I get the problem. The conversion looks like: The in--- IplImage *in_frame; x-in_frame = (IplImage *)atol(s-s_name); post(frame %s, x-in_frame); post(symbol %s,s-s_name); ...with this I get this: frame (null) symbol 0x1159da0 So I'm getting the symbol in, but its not converting into in_fame. Does anyone know what I am doing wrong or a way to use Pd's A_POINTER. I have looked at Gem and pdp but I cant figure it out. Thanks, Alain ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
[PD-dev] Pd external-window crash
I am trying to write an external library that uses opencv. I am using os x 10.4.9 and Pd extended 0.3.9. To display images and movies opencv uses a call to a window. I have a standalone terminal program that call the window and displays the image correctly. When I try to call a window from within Pd I get a window followed by a long stall and eventually a crash. On my dock I get a second Pd app with no icon like when I open a Gemwin in Gem. The original app seems responsive but the second app seems to be in a I want to crash state untill it does. Does anyone how I can figure out what is happening here? Is it a lib that Pd is lacking? What is the best way to bugtrack this? I know that Pd knows where the opencv libs are at because other opencv functions work flawlessly. Thanks for any input. Alain ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Re: [PD-dev] sending data out using sprintf
Well for never passing pointers around you have some great insight. That did it. Thanks.. The final outcode for any interested parties: x-in_frame = (IplImage *)strtol(s-s_name, NULL, 0); Now I have another snag, but thats in another email. Alain From: Bryan Jurish [EMAIL PROTECTED] Date: 2007/06/22 Fri AM 05:52:47 EDT To: [EMAIL PROTECTED] CC: pd-dev@iem.at Subject: Re: [PD-dev] sending data out using sprintf moin Alain, I've never passed pointers around between externals myself, but... On 2007-06-22 04:57:35, [EMAIL PROTECTED] appears to have written: I am trying to send some data out of an outlet using a symbol pointer. I have tried using sprintf like martin suggested with little succes. I am sure I am the one doing something wrong. I am getting a pointer symbol but I am not able to convert the pointer back. In external#1 I have: The out IplImage *frame; char symstr[10]; t_symbol *sym; sprintf(symstr, %p, frame); sym = gensym(symstr); outlet_symbol(x-m_outFrames, sym); With this I get an address like: symbol 0x1159da0 ... looks kosher to me ... ...but on the conversion in external#2 I get the problem. The conversion looks like: The in--- IplImage *in_frame; x-in_frame = (IplImage *)atol(s-s_name); post(frame %s, x-in_frame); post(symbol %s,s-s_name); ...with this I get this: frame (null) symbol 0x1159da0 first of all, you probably want to post(frame %p, x-in_frame), rather than %s. Second, in the docs for my atol (here under linux|glibc), I see: -- Function: long int atol (const char *STRING) This function is similar to the `strtol' function with a BASE argument of `10', except that it need not detect overflow errors. The `atol' function is provided mostly for compatibility with existing code; using `strtol' is more robust. ... so if your atol() is similar, then trying to convert a hex string to a pointer with atol() is an exercise in futility (since in general, 10!=16). strtol() ought to work better, auto-detetcting the hex-iness of the string by its '0x' prefix. You might also just want to roll out the big guns and use the %x format to scanf(), but strtol() is likely to be the better way to go. marmosets, Bryan -- Bryan Jurish There is *always* one more bug. [EMAIL PROTECTED] -Lubarsky's Law of Cybernetic Entomology ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Re: [PD-dev] Pd external-window crash
It seems like the window is made using Carbon. Is there any special way Pd handles Carbon windows that would cause this stall? I can also compile opencv to use X11 windowing thru finks gdk. Would Pd handle that better? Alain From: [EMAIL PROTECTED] Date: 2007/06/22 Fri AM 10:53:54 EDT To: pd-dev@iem.at Subject: [PD-dev] Pd external-window crash I am trying to write an external library that uses opencv. I am using os x 10.4.9 and Pd extended 0.3.9. To display images and movies opencv uses a call to a window. I have a standalone terminal program that call the window and displays the image correctly. When I try to call a window from within Pd I get a window followed by a long stall and eventually a crash. On my dock I get a second Pd app with no icon like when I open a Gemwin in Gem. The original app seems responsive but the second app seems to be in a I want to crash state untill it does. Does anyone how I can figure out what is happening here? Is it a lib that Pd is lacking? What is the best way to bugtrack this? I know that Pd knows where the opencv libs are at because other opencv functions work flawlessly. Thanks for any input. Alain ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Re: [PD-dev] Pd external-window crash
Well it looks like if I get a Gemwin opened first, then I can open an opencv window without a crash. Does anyone know what specifically does Gem do to get Pd to open a carbon window without a crash? Alain From: [EMAIL PROTECTED] Date: 2007/06/22 Fri PM 02:37:30 EDT To: pd-dev@iem.at Subject: Re: [PD-dev] Pd external-window crash It seems like the window is made using Carbon. Is there any special way Pd handles Carbon windows that would cause this stall? I can also compile opencv to use X11 windowing thru finks gdk. Would Pd handle that better? Alain From: [EMAIL PROTECTED] Date: 2007/06/22 Fri AM 10:53:54 EDT To: pd-dev@iem.at Subject: [PD-dev] Pd external-window crash I am trying to write an external library that uses opencv. I am using os x 10.4.9 and Pd extended 0.3.9. To display images and movies opencv uses a call to a window. I have a standalone terminal program that call the window and displays the image correctly. When I try to call a window from within Pd I get a window followed by a long stall and eventually a crash. On my dock I get a second Pd app with no icon like when I open a Gemwin in Gem. The original app seems responsive but the second app seems to be in a I want to crash state untill it does. Does anyone how I can figure out what is happening here? Is it a lib that Pd is lacking? What is the best way to bugtrack this? I know that Pd knows where the opencv libs are at because other opencv functions work flawlessly. Thanks for any input. Alain ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
[PD-dev] Symbol not found: ?
I am trying to get a external written using functions outside of Pd. I have my header files included and the external is compiling but when I try to load it into Pd I get this error: 10): Symbol not found: _whatever-external-function Expected in: dynamic lookup [import]: ERROR: can't load library in FTIR_CXX What can I do to fix this? Alain ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
[PD-dev] compiling external in Xcode
I am trying to get a test compile of the counter example from the how to guide built in Xcode but I dont know which target type to choose. When I choose any of the dynamic lib options I get linker errors like this: ld: Undefined symbols: _class_addbang _class_new _gensym _outlet_float _outlet_new _pd_new _s_float Does anyone know the answer to this? Alain ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
[PD-dev] opencv externals data type conversion
I am trying to write a set of externals based on the opencv library. My main interest is in the motion tracking aspect of opencv. I am new to programing and I am having a tough time converting the opencv IplImage data type to the Pd symbol data type in order to send it out of outlets and in to inlets. Martin suggested I try something like this: char symstr[10]; t_symbol sym; sprintf(symstr, %p, frame); sym = gensym(symstr); and then send sym through the outlet and convert it back at the receiving end by extracting the sting from the s_name field and passing it to atol(). But I get this error when I use sym = gensym(symstr); no match for 'operator=' in 'sym = gensym(((char*)( symstr)))'. Does anyone know how to get around this? Thanks, Alain ___ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev