Skip to content

Commit 7eb602b

Browse files
committed
Remove legacy glShadeModel and glNormalize calls
1 parent 3207faf commit 7eb602b

1 file changed

Lines changed: 4 additions & 17 deletions

File tree

src/Processing.cpp

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,7 @@ void PApplet::size(int w,int h,int renderer){
583583
glDepthFunc(GL_LESS);
584584
glDisable(GL_CULL_FACE);
585585
glFrontFace(GL_CW);
586-
glEnable(GL_NORMALIZE);
587-
glClearColor(0.8f,0.8f,0.8f,1); // Java Processing default grey (204,204,204)
586+
glClearColor(0.8f,0.8f,0.8f,1); // Java Processing default grey (204,204,204)
588587
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
589588
applyDefaultCamera();
590589
}
@@ -1792,7 +1791,6 @@ void PApplet::lights() {
17921791
// directionalLight(128, 128, 128, 0, 0, -1)
17931792
// Result: shadow faces = 50% brightness, front face = 100%, sides interpolated.
17941793
glEnable(GL_LIGHTING);
1795-
glEnable(GL_NORMALIZE);
17961794
glEnable(GL_COLOR_MATERIAL);
17971795
// GL_COLOR_MATERIAL drives AMBIENT_AND_DIFFUSE from fill color
17981796
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
@@ -1870,7 +1868,6 @@ void PApplet::ambientLight(float r, float g, float b, float x, float y, float z)
18701868
GLfloat zero[]= { 0.0f, 0.0f, 0.0f, 1.0f };
18711869

18721870
glEnable(GL_LIGHTING);
1873-
glEnable(GL_NORMALIZE);
18741871
glEnable(GL_COLOR_MATERIAL);
18751872
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
18761873
glEnable(lt);
@@ -1894,7 +1891,6 @@ void PApplet::directionalLight(float r, float g, float b, float nx, float ny, fl
18941891
GLfloat zero[] = { 0.0f, 0.0f, 0.0f, 1.0f };
18951892

18961893
glEnable(GL_LIGHTING);
1897-
glEnable(GL_NORMALIZE);
18981894
glDisable(GL_COLOR_MATERIAL);
18991895
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
19001896
glEnable(GL_COLOR_MATERIAL);
@@ -1928,7 +1924,6 @@ void PApplet::pointLight(float r, float g, float b, float x, float y, float z) {
19281924
GLfloat zero[] = { 0.0f, 0.0f, 0.0f, 1.0f };
19291925

19301926
glEnable(GL_LIGHTING);
1931-
glEnable(GL_NORMALIZE);
19321927
glEnable(GL_COLOR_MATERIAL);
19331928
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
19341929
glEnable(lt);
@@ -1959,7 +1954,6 @@ void PApplet::spotLight(float r, float g, float b,
19591954
GLfloat zero[] = { 0.0f, 0.0f, 0.0f, 1.0f };
19601955

19611956
glEnable(GL_LIGHTING);
1962-
glEnable(GL_NORMALIZE);
19631957
glDisable(GL_COLOR_MATERIAL);
19641958
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
19651959
glEnable(GL_COLOR_MATERIAL);
@@ -3426,10 +3420,6 @@ void PApplet::run(){
34263420
if(phongProg){glDeleteProgram(phongProg);phongProg=0;}
34273421
glEnable(GL_BLEND);glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
34283422
glEnable(GL_DEPTH_TEST);
3429-
#if !defined(__EMSCRIPTEN__) && defined(GL_SHADE_MODEL)
3430-
if (glShadeModel) glShadeModel(GL_SMOOTH);
3431-
#endif
3432-
glEnable(GL_NORMALIZE);
34333423
smooth();
34343424
// Don't call setProjection here -- let size() in this->setup() do it
34353425
// with the correct dimensions. Calling it now with winWidth=640,winHeight=480
@@ -3570,8 +3560,7 @@ void PApplet::run(){
35703560
glDepthFunc(GL_LESS);
35713561
glDisable(GL_CULL_FACE);
35723562
glFrontFace(GL_CW);
3573-
glEnable(GL_NORMALIZE);
3574-
// Do NOT clear -- this->setup() already drew to the back buffer.
3563+
// Do NOT clear -- this->setup() already drew to the back buffer.
35753564
// Only clear if this->draw() will redraw everything (i.e. calls background()).
35763565
applyDefaultCamera();
35773566
} else {
@@ -3628,8 +3617,7 @@ void PApplet::run(){
36283617
glDepthFunc(GL_LESS);
36293618
glDisable(GL_CULL_FACE);
36303619
glFrontFace(GL_CW);
3631-
glEnable(GL_NORMALIZE);
3632-
// Do NOT clear color here -- the sketch calls background() itself.
3620+
// Do NOT clear color here -- the sketch calls background() itself.
36333621
// Clearing color would erase anything drawn in this->setup().
36343622
flushPoints(); // flush any pending points from previous frame
36353623
glClear(GL_DEPTH_BUFFER_BIT);
@@ -3802,8 +3790,7 @@ void PApplet::run(){
38023790
glDepthFunc(GL_LESS);
38033791
glDisable(GL_CULL_FACE);
38043792
glFrontFace(GL_CW);
3805-
glEnable(GL_NORMALIZE);
3806-
glClear(GL_DEPTH_BUFFER_BIT);
3793+
glClear(GL_DEPTH_BUFFER_BIT);
38073794
p->applyDefaultCamera();
38083795
} else {
38093796
glViewport(0, 0, p->winWidth, p->winHeight);

0 commit comments

Comments
 (0)