# glMaterial and Print3D

**URL:** <https://forums.imgtec.com/t/glmaterial-and-print3d/149>\
**Category:** PowerVR Insider\
**Created:** [September 22, 2008, 11:17pm UTC](https://forums.imgtec.com/t/glmaterial-and-print3d/149 "2008-09-22T23:17:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dark](https://avatars.discourse-cdn.com/v4/letter/d/a88e4f/32.png) [@dark](https://forums.imgtec.com/u/dark)\
**Post date:** [September 22, 2008, 11:17pm UTC](https://forums.imgtec.com/t/glmaterial-and-print3d/149/1 "2008-09-22T23:17:58Z")

</div>

Ran into a problem and didn’t find anything on the web, so posting here for anyone who runs into it again.

&nbsp;
  

Noticed that after calling glMaterialf my calls to Print3D.Flush() would cause an error
  

&nbsp;
  

\<code\>
  

glDrawElements(GL\_TRIANGLES, (VertexCount/2)\*3, GL\_UNSIGNED\_SHORT, m\_pFacesFont); failed
  

\</code\>
  

&nbsp;
  

  

After a couple of hours the solution was the GL flag passed to glMaterialfv.
  

I was passing GL\_FRONT. The problem went away after I passed it GL\_FRONT\_AND\_BACK

  

&nbsp;
  

&nbsp;
  

&nbsp;

---

<div class="post-metadata">

**Author:** ![GordonMaclachlan](https://avatars.discourse-cdn.com/v4/letter/g/c68b51/32.png) [@GordonMaclachlan](https://forums.imgtec.com/u/GordonMaclachlan)\
**Post date:** [September 26, 2008, 4:04pm UTC](https://forums.imgtec.com/t/glmaterial-and-print3d/149/2 "2008-09-26T16:04:19Z")

</div>

Thanks for reporting this issue and the workaround. Obviously this shouldn’t be breaking Print3D so we’ll have a look at what’s going on and I’ll post here when I know more.

---

<div class="post-metadata">

**Author:** ![GordonMaclachlan](https://avatars.discourse-cdn.com/v4/letter/g/c68b51/32.png) [@GordonMaclachlan](https://forums.imgtec.com/u/GordonMaclachlan)\
**Post date:** [September 30, 2008, 9:14am UTC](https://forums.imgtec.com/t/glmaterial-and-print3d/149/3 "2008-09-30T09:14:32Z")

</div>

What is happening is this:  
  
According to the OpenGL ES spec, the only legal value to pass to the glMaterialf function is GL\_FRONT\_AND\_BACK. Anything else will cause glGetError() to return a value.  
  
Print3D calls glGetError() after its call to glDrawElements() and if it is a value it gives out the message that you've seen. But if glError is already set by the call to glMaterialf then the message will appear anyway, even if Print3D is fine and so it does.  
  
This would happen if any of the GL calls in your program fail. You're solution is correct, but the message from Print3D is misleading and I'll look at improving this.  
  
Gordon2008-09-30 11:28:28
