Note that there are some explanatory texts on larger screens.

plurals
  1. POGL_COLOR_MATERIAL with lighting on Android
    text
    copied!<p>It appears that <a href="http://pyopengl.sourceforge.net/documentation/manual/glColorMaterial.3G.html" rel="nofollow noreferrer"><code>glColorMaterial()</code></a> is absent from <a href="http://www.khronos.org/opengles/sdk/1.1/docs/man/" rel="nofollow noreferrer">OpenGL ES</a>. According to <a href="http://www.idevgames.com/forum/showthread.php?t=18189" rel="nofollow noreferrer">this post</a> (for iPhone), you may still enable <code>GL_COLOR_MATERIAL</code> in OpenGL ES 1.x, but you're stuck with the default settings of <code>GL_FRONT_AND_BACK</code> and <code>GL_AMBIENT_AND_DIFFUSE</code> that you would otherwise set with <code>glColorMaterial()</code>. I would be OK with this, but the diffuse lighting is not working correctly.</p> <p>I set up my scene and tested it with one light, setting <code>glMaterialfv()</code> for <code>GL_AMBIENT</code> and <code>GL_DIFFUSE</code> once in the initialization. The normals have been set correctly, and lighting works the way it's supposed to. I see the Gouraud shading.</p> <p>With <code>GL_LIGHTING</code> disabled, the flat colors I have set with <code>glColor4f()</code> appear on the various objects in the scene. This also functions as expected. However, when <code>glEnable(GL_COLOR_MATERIAL)</code> is called, the flat colors remain. I would expect to see the lighting effects.</p> <p>glColorMaterial() is also <a href="http://www.anddev.org/viewtopic.php?p=33992" rel="nofollow noreferrer">mentioned on anddev.org</a>, but I'm not sure if the information there is accurate.</p> <p>I'm testing this on an Android 2.1 handset (Motorola Droid).</p> <p><strong>Edit</strong>: It works properly on my 1.6 handset (ADP1). I've filed <a href="http://code.google.com/p/android/issues/detail?id=8015" rel="nofollow noreferrer">Issue 8015</a>. It does <strong>not</strong> work with the emulator for Android 1.6 or 2.1.</p> <p>Here is a <a href="http://sites.google.com/site/droidful/bugs/color_material_testcase.zip" rel="nofollow noreferrer">minimal testcase</a> to reproduce the problem.</p> <p><strong>Screenshot on Android 1.6 (ADP1):</strong></p> <p><img src="https://sites.google.com/site/droidful/bugs/GL_COLOR_MATERIAL-1.6.png" alt="alt text"></p> <p><strong>Screenshot of same code running on Android 2.1 (Motorola Droid):</strong></p> <p><img src="https://sites.google.com/site/droidful/bugs/GL_COLOR_MATERIAL-2.1.png" alt="alt text"></p> <p><strong>Screenshot on Android 1.6 (Emulator):</strong></p> <p><img src="https://sites.google.com/site/droidful/bugs/GL_COLOR_MATERIAL-1.6-emulator.png" alt="alt text"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload