Forum > OpenGL

Simple OpenGL Lighting

<< < (2/2)

ChrisR:
It sounds like you need to address the Winding Order for your triangles. OpenGL allows you to specify glFrontFace as GL_CW or GL_CCW (clockwise or counter clockwise). GL_CCW is the default for OpenGL and most triangular mesh formats. I would suggest you ensure all faces of models use a consistent winding order. This will allow you to differentiate the Front and Back face.

The image below is from the free Surfice software, which you can compile with Lazarus or download as compiled for macOS, Linux or Windows. If you select the "Phong" shader, you will see a slider named "LightBackfaces". Notice in the attached cutaway image, the default behavior is to treat backfires differently, to give a visual cue that this is inside the object: the backfires are de-saturated, slightly darker and less glossy than the front faces.

ranny:
Hi,

Pretty sure I have all the polgons in the right winding order although I think it may be CW rather than CCW ehich I will look at and see what difference it makes if I change it.

I tried downloading the Surfice software but havent managed to install it, I will need to see what I am doing wrong (error says Unable to load OpenGL Core 3.3).

Attached images show progress so far and its better than it was a coupled of weeks ago!

Cheers and thanks.

Navigation

[0] Message Index

[*] Previous page

Go to full version