1

My code works for everything except specular component.

glEnable(GL_COLOR_SUM);
...
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, color);
glEnableClientState(GL_SECONDARY_COLOR_ARRAY);
glSecondaryColorPointer(3, GL_UNSIGNED_BYTE, 0, specular);
...
glDrawArrays(D3DPT_TRIANGLELIST, 0, 2);

It seems to ignore specular, but color, texture co-ordinates, positions, and so on are all completely fine.

This is NOT using lights and materials. Fixed-vertex pipeline. Shaders are not an option at this point, unfortunately.

glGetError() reports no errors at any point either.

Mike Weir
  • 3,094
  • 1
  • 30
  • 46
  • "This is NOT using lights and materials." If you're not using lights and materials, then the secondary color will only be used as part of your texture environment functions. So... what are they. What `glTexEnv` functions do you call? – Nicol Bolas Nov 25 '11 at 06:58
  • I'm using the defaults... If I must change glTexEnv appropriately, what would they be changed to? And then what is the use of GL_COLOR_SUM mentioned in documentation? – Mike Weir Nov 25 '11 at 07:11

1 Answers1

1

you said:

This is NOT using lights and materials.

specular can only be calculated when there is a light to get it from. (if you want I can go into the math behind it...)

from http://en.wikipedia.org/wiki/Specular_highlight:

A specular highlight is the bright spot of light that appears on shiny objects when illuminated.

on a side note what is D3DPT_TRIANGLELIST doing in OpenGL code? is that just a mistake in the question or does it actually work like that?

chipgw
  • 86
  • 4
  • I've since figured out the solution - it's enabled the secondary color and using it. Specular and diffuse can be used if you're doing your own lighting calculations and not using the OpenGL material/light system. – Mike Weir Aug 11 '12 at 23:24
  • @PhoenixX_2 wait... how are you doing your own lighting calculations without shaders? are you putting a pre/manually calculated specular value into the secondary color? if so sorry, I misunderstood your question. – chipgw Aug 22 '12 at 18:14
  • yep... it's for a 2D game really, and the specular is altered to produce a flash effect without the use of shaders on lower end hardware. – Mike Weir Sep 02 '12 at 18:13