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; ERROR << "No symbol 'wglSwapIntervalEXT' found - cannot use WGL vsync" << std::endl;
#endif #endif
} }
/*
GLfloat LightAmbient[] = { 0.1f, 0.1f, 0.1f, 1.0f }; GLfloat LightAmbient[] = { 1.0f, 1.0f, 1.0f, 1.0f };
GLfloat LightDiffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f }; GLfloat LightDiffuse[] = { 0.0f, 0.0f, 0.0f, 1.0f };
GLfloat LightPosition[] = { 1.0f, 1.0f, 0.0f, 0.0f }; GLfloat LightPosition[] = { 1.0f, 1.0f, 1.0f, 1.0f };
*/
//glShadeModel( GL_SMOOTH ); //glShadeModel( GL_SMOOTH );
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
glEnable( GL_DEPTH_TEST ); glEnable( GL_DEPTH_TEST );
/*
glEnable( GL_LIGHTING ); glEnable( GL_LIGHTING );
glEnable(GL_LIGHT0);
//glDisable(GL_LIGHT0);
glEnable(GL_LIGHT1);
//glDisable(GL_LIGHT1);
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST ); glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
glLightfv( GL_LIGHT0, GL_AMBIENT, LightAmbient ); glLightfv( GL_LIGHT0, GL_AMBIENT, LightAmbient );
glLightfv( GL_LIGHT0, GL_DIFFUSE, LightDiffuse ); glLightfv( GL_LIGHT0, GL_DIFFUSE, LightDiffuse );
glLightfv( GL_LIGHT0, GL_POSITION, LightPosition ); glLightfv( GL_LIGHT0, GL_POSITION, LightPosition );
glEnable( GL_LIGHT0 );
*/ GLfloat LightAmbient2[] = { 1.0f, 1.0f, 1.0f, 1.0f };
glEnable( GL_COLOR_MATERIAL);
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); glCullFace(GL_BACK);
//glPolygonMode(GL_FRONT, GL_FILL); //glPolygonMode(GL_FRONT, GL_FILL);
//glPolygonMode(GL_BACK, GL_LINE); //glPolygonMode(GL_BACK, GL_LINE);
glEnable(GL_TEXTURE_2D); 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")) { if (queryExtension("GL_EXT_texture_filter_anisotropic")) {
GLfloat maxAniso = 1.0f; GLfloat maxAniso = 1.0f;
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAniso); glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAniso);

View File

@ -1001,7 +1001,7 @@ void drawScene(Uint32 ticks) {
glPopMatrix();*/ glPopMatrix();*/
GUI::ManagerHolder::Instance().draw(); GUI::ManagerHolder::Instance().draw();
num_frames_drawn += 1; num_frames_drawn += 1;
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);