From: Srimal Jayawardena on
Hi

This one finally worked out
(I love replying to my own postings ;)

It turns out that when using MEX you need to explicitly specify the libraries GL, GLU and glut

ie:

mex -v -lGL -lglut -lGLU mexRender.c

although compiling in gcc seperately would require only the '-lglut' option.
(mex -v -lglut mexRender.c will complain of unresolved stuf...)

hope this saves someone the time I wasted away :)

Best regs

Srimal.


Rune Allnor <allnor(a)tele.ntnu.no> wrote in message <95e5ac9c-f288-486c-8417-daf71747a1ec(a)j21g2000yqe.googlegroups.com>...
> On 15 Aug, 06:36, "Srimal Jayawardena" <srim...(a)gmail.com> wrote:
>
> > 2) If so, how do I compile the C file (which has OpenGL, calls - glut.h etc) using MEX without complaining about the OpenGL functions. Looks to me like MEX )and the resulting gcc calls) can't locate the OpenGL libraries. but I use the -lglut option when invoking mex.
>
> Have you specified the location of the glut libraries?
> Don't know how the details are set up internally to matlab,
> but there might be problems if you link in some general
> OpenGL libraries that conflict with the libraries that
> come with matlab.
>
> Rune
From: Oliver Woodford on
"Srimal Jayawardena" wrote:
> It turns out that when using MEX you need to explicitly specify the libraries GL, GLU and glut, i.e.:
> mex -v -lGL -lglut -lGLU mexRender.c

Thanks for posting that, Srimal. It will most certainly come in handy.
Oliver
From: Andrea Tagliasacchi on
"Oliver Woodford" <o.j.woodford.98(a)cantab.net> wrote in message <h7o71d$r17$1(a)fred.mathworks.com>...
> "Srimal Jayawardena" wrote:
> > It turns out that when using MEX you need to explicitly specify the libraries GL, GLU and glut, i.e.:
> > mex -v -lGL -lglut -lGLU mexRender.c
>
> Thanks for posting that, Srimal. It will most certainly come in handy.
> Oliver

Were you successful in creating the graphic window Srimal?
I have another thread that described a crash in a R2008 of Matlab as
soon as you tried to create a GLUT context.

--
Andrea