Code covered by the BSD License  

Highlights from
Matlab Offscreen Rendering Toolbox

image thumbnail
from Matlab Offscreen Rendering Toolbox by Tianli Yu
Project 3D mesh onto image using off screen OpenGL rendering, determine face color, visibilty, etc.

CompileOffscreen.m
%%
% This is a matlab compilation script that will compile the Offscreen
% library
% Author: Tianli Yu, tianli@ieee.org, Mar 30, 2009

%%
% Please Modify these two path strings to point to the GLUT and GLEW library
% -I is the header file include path, -L is the binary lib path
% Here is a typical path for mac/linux
GlewPath = '-I/opt/local/include -L/opt/local/lib -lGLEW';
GlutPath = '-I/opt/local/include -L/opt/local/lib -lglut';

%% For Windows you could download the GLEW and GLUT binary and put them under
%% the root of this toolbox, then use the following 
%GlewPath = '-I./glew/include -L./glew/lib -lGLEW';
%GlutPath = '-I./glut -L./glut lglut';

%% For Ubuntu Linux, just install libglew1.5 and libglew1.5-dev, freeglut
%% is usually pre-installed
%GlewPath = '';
%GlutPath = '';

%% Compiling the source code
%disp(['mex ' GlewPath ' ' GlutPath ' MexGlutInit.cpp']);
%eval(['mex ' GlewPath ' ' GlutPath ' MexGlutInit.cpp']);

disp(['mex ' GlewPath ' ' GlutPath ' BatchFaceColorGradImpl.cpp']);
eval(['mex ' GlewPath ' ' GlutPath ' BatchFaceColorGradImpl.cpp']);

disp(['mex ' GlewPath ' ' GlutPath ' ProjectMesh2ImageImpl.cpp']);
eval(['mex ' GlewPath ' ' GlutPath ' ProjectMesh2ImageImpl.cpp']);

disp(['mex ' GlewPath ' ' GlutPath ' RenderColorMeshImpl.cpp']);
eval(['mex ' GlewPath ' ' GlutPath ' RenderColorMeshImpl.cpp']);

disp(['mex ' GlewPath ' ' GlutPath ' ShadowProj2Impl.cpp']);
eval(['mex ' GlewPath ' ' GlutPath ' ShadowProj2Impl.cpp']);

Contact us at files@mathworks.com