Prev: The discrete BMS model for spiking neurons
Next: writing a function to return the index of the element with greatest absolute value
From: Miguel on 1 Feb 2010 18:17 Hi guys, I'm new to mex functions and am in need of some assistance. I have a program written in c++ using glut (opengl). I want to create a mex function that will: pass a set of parameters. render an image. keep running pass the image information back to matlab when ever I ask matlab to update close the whole program when I tell matlab to end. Any suggestions?
From: Rune Allnor on 2 Feb 2010 01:34
On 2 Feb, 00:17, "Miguel " <mserra...(a)gatech.edu> wrote: > Hi guys, I'm new to mex functions and am in need of some assistance. I have a program written in c++ using glut (opengl). > > I want to create a mex function that will: > pass a set of parameters. > render an image. > keep running > pass the image information back to matlab when ever I ask matlab to update > close the whole program when I tell matlab to end. > > Any suggestions? You might be in for a lot more trouble than you realize: 1) Glut is a GUI toolkit on top of the OpenGL library 2) Matlab provides its own GUI toolkit 3) The Matlab GUI is, in turn, built on top of Java So you are, in effect asking how to use MEX to bypass not one, but two, GUI layers in order to do what the Glut toolkit already provides, and that you have access to through whatever compiler you have to use anyway. Of course, you might proceed along such lines, and enjoy what misery and mayhem would naturally ensue - there *are* people who get their kicks from thise sorts of things - but a more useful approach would be to find out what you *really* want to do, and select the approach accordingly: - If the main issue is to make some plots from a matlab program, check out matlab's plotting capabilities. Nowhere near as flexible as 'raw; OpenGL, but nonetheless both useful and powerful. - If you really need the access to 'raw' OpenGL that Glut provides, you might want to have a dedicated plotting package that loads data e.g. from matlab files. - If you need more direct access, you might want to call the matlab engine from your plotting package. Rune |