Prepare to set up shaders

This commit is contained in:
Vladislav Khorev 2018-09-22 23:56:31 +05:00
parent 5f4fe5e624
commit 70cf2b9543
4 changed files with 41 additions and 10 deletions

0
gl_base.cpp Normal file → Executable file
View File

0
gl_cityview.cpp Normal file → Executable file
View File

View File

@ -243,28 +243,59 @@ namespace OpenGL {
ERROR << "No symbol 'wglSwapIntervalEXT' found - cannot use WGL vsync" << std::endl;
#endif
}
/*
GLfloat LightAmbient[] = { 0.1f, 0.1f, 0.1f, 1.0f };
GLfloat LightDiffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f };
GLfloat LightPosition[] = { 1.0f, 1.0f, 0.0f, 0.0f };
*/
GLfloat LightAmbient[] = { 1.0f, 1.0f, 1.0f, 1.0f };
GLfloat LightDiffuse[] = { 0.0f, 0.0f, 0.0f, 1.0f };
GLfloat LightPosition[] = { 1.0f, 1.0f, 1.0f, 1.0f };
//glShadeModel( GL_SMOOTH );
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
glEnable( GL_DEPTH_TEST );
/*
glEnable( GL_LIGHTING );
glEnable(GL_LIGHT0);
//glDisable(GL_LIGHT0);
glEnable(GL_LIGHT1);
//glDisable(GL_LIGHT1);
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
glLightfv( GL_LIGHT0, GL_AMBIENT, LightAmbient );
glLightfv( GL_LIGHT0, GL_DIFFUSE, LightDiffuse );
glLightfv( GL_LIGHT0, GL_POSITION, LightPosition );
glEnable( GL_LIGHT0 );
*/
glEnable( GL_COLOR_MATERIAL);
GLfloat LightAmbient2[] = { 1.0f, 1.0f, 1.0f, 1.0f };
glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient2);
glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse);
glLightfv(GL_LIGHT1, GL_POSITION, LightPosition);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_ADD);
//glColorMaterial(GL_BACK, GL_AMBIENT_AND_DIFFUSE);
glCullFace(GL_BACK);
//glPolygonMode(GL_FRONT, GL_FILL);
//glPolygonMode(GL_BACK, GL_LINE);
glEnable(GL_TEXTURE_2D);
GLfloat MaterialAmbient[] = { 0.0f, 0.0f, 1.0f, 1.0f };
glEnable(GL_COLOR_MATERIAL);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, MaterialAmbient);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, MaterialAmbient);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialAmbient);
glColorMaterial(GL_FRONT_AND_BACK, GL_EMISSION);
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, MaterialAmbient);
//glEnable(GL_COLOR_MATERIAL);
if (queryExtension("GL_EXT_texture_filter_anisotropic")) {
GLfloat maxAniso = 1.0f;
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAniso);