# Replacements for gl::Material and gl::Light?

**URL:** <https://discourse.libcinder.org/t/replacements-for-gl-material-and-gl-light/1872>\
**Category:** Using Cinder\
**Created:** [September 21, 2021, 4:38am UTC](https://discourse.libcinder.org/t/replacements-for-gl-material-and-gl-light/1872 "2021-09-21T04:38:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![morphogencc](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@morphogencc](https://discourse.libcinder.org/u/morphogencc)\
**Post date:** [September 21, 2021, 4:38am UTC](https://discourse.libcinder.org/t/replacements-for-gl-material-and-gl-light/1872/1 "2021-09-21T04:38:49Z")

</div>

Hey all –

I needed to be able to import 3d models for a project, so I’m doing some excavation and bringing [Cinder-Assimp](https://github.com/gaborpapp/Cinder-Assimp) up to date with Assimp 5.0 and Cinder v0.9.3. The updated (mostly working) code is [here](https://github.com/sitara-systems/sitara-assimp)

It hasn’t been too complicated so far and most of the old code is still compatible with the latest versions of everything; the only tricky part for me now is figuring out how to replace the old sections that use `gl::Light` and `gl::Material` classes. I initially just ripped them out to get them working, but now my 3d models look like this:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/libcinder/original/1X/d028a0c685d6a93bdbe1a34e7522f1b978c1f3d6.png)

So it looks we’re back to the drawing board and adding lighting and materials!

I can’t find anything about these in the cinder docs, in the github, or even in this forum… so it looks like they were probably removed before the migration to discourse, and most of the old samples have been lost to time.

Is there a guide anywhere for how to port the old classes to new cinder? I’m assuming that they were deprecated and you should just use straight OpenGL now, but I’m not quite sure what functionality the old classes provided.

---

<div class="post-metadata">

**Author:** ![lithium](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/lithium/32/38_2.png) [@lithium](https://discourse.libcinder.org/u/lithium)\
**Post date:** [September 21, 2021, 8:31am UTC](https://discourse.libcinder.org/t/replacements-for-gl-material-and-gl-light/1872/2 "2021-09-21T08:31:17Z")

</div>

These map to old fixed function pipeline opengl functions that have long sinc been deprecated, e.g [glMaterial](http://docs.gl/gl3/glMaterial).

Once OpenGL and eventually cinder moved to the programmable pipeline, lighting and materials became the job of your shaders. The good news is from memory the deprecated GL materials were pretty crappy gouraud shading so they’re pretty trivial to reimplement.

The [Geometry](https://github.com/cinder/Cinder/blob/master/samples/Geometry/assets/phong.frag) sample has a simple phong shader that will get you most of the way there, or if you just need a really quick and dirty lambertian shader just to visualise your models you can always use `gl::getStockShader ( gl::ShaderDef().lambert() ) );`

\*edit Started thinking, surely someone else had come across this issue before when migrating to modern gl and sure enough, i found a shader implementation of the deprecated lighting and material model [here](https://www.ics.com/blog/fixed-function-modern-opengl-part-3-4). (all the way at the bottom)

---

<div class="post-metadata">

**Author:** ![morphogencc](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@morphogencc](https://discourse.libcinder.org/u/morphogencc)\
**Post date:** [September 28, 2021, 9:58am UTC](https://discourse.libcinder.org/t/replacements-for-gl-material-and-gl-light/1872/3 "2021-09-28T09:58:41Z")

</div>

Thanks as always – you’re a lifesaver! The pointer towards the Geometry sample helped me get everything up and running!
