text:
using namespace SPH;

float MiniGL::fovy = 45;
float MiniGL::znear = 0.5f;
float MiniGL::zfar = 1000;
MiniGL::SceneFct MiniGL::scenefunc = nullptr;
MiniGL::IdleFct MiniGL::idlefunc = nullptr;
MiniGL::DestroyFct MiniGL::destroyfunc = nullptr;
void (*MiniGL::exitfunc)(void) = NULL;
int MiniGL::m_width = 0;
int MiniGL::m_height = 0;
Quaternionr MiniGL::m_rotation;
Real MiniGL::m_zoom = 1.0;
Vector3r MiniGL::m_translation;
Real MiniGL::movespeed = 1.0;
Real MiniGL::turnspeed = 0.01;
int MiniGL::mouse_button = -1;
double MiniGL::mouse_wheel_pos = 0;
int MiniGL::modifier_key = 0;
double MiniGL::mouse_pos_x_old = 0;
double MiniGL::mouse_pos_y_old = 0;
std::vector<MiniGL::KeyFunction> MiniGL::keyfunc;
int MiniGL::drawMode = GL_FILL;
Real MiniGL::m_quat[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
unsigned char MiniGL::texData[IMAGE_ROWS][IMAGE_COLS][3];
unsigned int MiniGL::m_texId = 0;
void(*MiniGL::selectionfunc)(const Vector2i&, const Vector2i&, void*) = NULL;
void *MiniGL::selectionfuncClientData = NULL;
void(*MiniGL::mousefunc)(int, int, void*) = NULL;
int MiniGL::mouseFuncButton;
Vector2i MiniGL::m_selectionStart;
GLint MiniGL::m_context_major_version = 0;
GLint MiniGL::m_context_minor_version = 0;
GLint MiniGL::m_context_profile = 0;
bool MiniGL::m_breakPointActive = true;
bool MiniGL::m_breakPointLoop = false;
GLUquadricObj* MiniGL::m_sphereQuadric = nullptr;
std::vector<MiniGL::ReshapeFct> MiniGL::m_reshapeFct;
std::vector<MiniGL::KeyboardFct> MiniGL::m_keyboardFct;
std::vector<MiniGL::CharFct> MiniGL::m_charFct;
std::vector<MiniGL::MousePressFct> MiniGL::m_mousePressFct;
std::vector<MiniGL::MouseMoveFct> MiniGL::m_mouseMoveFct;
std::vector<MiniGL::MouseWheelFct> MiniGL::m_mouseWheelFct;
GLFWwindow* MiniGL::m_glfw_window = nullptr;

void MiniGL::bindTexture()
{
	glBindTexture(GL_TEXTURE_2D, MiniGL::m_texId);
}

void MiniGL::unbindTexture()
{
	glBindTexture(GL_TEXTURE_2D, 0);
}

void MiniGL::getOpenGLVersion(int &major_version, int &minor_version)
{
	sscanf((const char*)glGetString(GL_VERSION), "%d.%d", &major_version, &minor_version);
}

void MiniGL::coordinateSystem()
{
	Vector3f a(0,0,0);
	Vector3f b(2,0,0);
	Vector3f c(0,2,0);
	Vector3f d(0,0,2);

	float diffcolor [4] = {1,0,0,1};
	float speccolor [4] = {1,1,1,1};
	glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, diffcolor);
	glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, diffcolor);
	glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, speccolor);
	glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, 100.0);
	glLineWidth (2);

	glBegin (GL_LINES);
		glVertex3fv (&a[0]);
		glVertex3fv (&b[0]);
	glEnd ();

	float diffcolor2[4] = { 0, 1, 0, 1 };
	glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, diffcolor2);
	glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, diffcolor2);

	glBegin (GL_LINES);
		glVertex3fv (&a[0]);
		glVertex3fv (&c[0]);
	glEnd ();

	float diffcolor3[4] = { 0, 0, 1, 1 };
	glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, diffcolor3);
	glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, diffcolor3);

	glBegin (GL_LINES);
		glVertex3fv (&a[0]);
		glVertex3fv (&d[0]);
	glEnd ();
	glLineWidth (1);
}

void MiniGL::drawVector(const Vector3r &a, const Vector3r &b, const float w, float *color)
{
	float speccolor [4] = {1.0, 1.0, 1.0, 1.0};
	glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, color);
	glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, color);
	glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, speccolor);
	glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, 100.0);
	glColor3fv(color);

	glLineWidth (w);

	glBegin (GL_LINES);
		glVertex3v(&a[0]);
		glVertex3v(&b[0]);
	glEnd ();

	glLineWidth (1);
}

void MiniGL::drawCylinder(const Vector3r &a, const Vector3r &b, const float *color, const float radius, const unsigned int subdivisions)
{
	float speccolor[4] = { 1.0, 1.0, 1.0, 1.0 };
	glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, color);
	glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, color);
	glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, speccolor);
	glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 100.0);
	glColor3fv(color);

	Real vx = (b.x() - a.x());
	Real vy = (b.y() - a.y());
	Real vz = (b.z() - a.z());
	//handle the degenerate case with an approximation
	if (vz == 0)
		vz = .00000001;
	Real v = sqrt(vx*vx + vy*vy + vz*vz);
	Real ax = static_cast<Real>(57.2957795)*acos(vz / v);
	if (vz < 0.0)
		ax = -ax;
	Real rx = -vy*vz;
	Real ry = vx*vz;

	GLUquadricObj *quadric = gluNewQuadric();
	gluQuadricNormals(quadric, GLU_SMOOTH);

	glPushMatrix();
	glTranslatef((float)a.x(), (float)a.y(), (float)a.z());
	glRotatef((float)ax, (float)rx, (float)ry, 0.0f);
	//draw the cylinder
	gluCylinder(quadric, radius, radius, v, subdivisions, 1);
	gluQuadricOrientation(quadric, GLU_INSIDE);
	//draw the first cap
	gluDisk(quadric, 0.0, radius, subdivisions, 1);
	glTranslatef(0, 0, (float)v);
	//draw the second cap
	gluQuadricOrientation(quadric, GLU_OUTSIDE);
	gluDisk(quadric, 0.0, radius, subdivisions, 1);
	glPopMatrix();

	gluDeleteQuadric(quadric);
}

void MiniGL::drawSphere(const Vector3r &translation, float radius, float *color, const unsigned int subDivision)
{
	float speccolor [4] = {1.0, 1.0, 1.0, 1.0};
	glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, color);
	glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, color);
	glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, speccolor);
	glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, 100.0);
	glColor3fv(color);

	if (m_sphereQuadric == nullptr)
	{
		m_sphereQuadric = gluNewQuadric();
		gluQuadricNormals(m_sphereQuadric, GLU_SMOOTH);
	}

	glPushMatrix ();
	glTranslated ((translation)[0], (translation)[1], (translation)[2]);

	gluSphere(m_sphereQuadric, radius, subDivision, subDivision);
	glPopMatrix();
}

void MiniGL::drawPoint(const Vector3r &translation, const float pointSize, const float * const color)
{
	float speccolor [4] = {1.0, 1.0, 1.0, 1.0};
	glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, color);
	glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, color);
	glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, speccolor);
	glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, 100.0);
	glColor3fv(color);

	glPointSize(pointSize);

	glBegin (GL_POINTS);
	glVertex3v(&translation[0]);
	glEnd ();

	glPointSize(1);
}

void MiniGL::drawMesh(const TriangleMesh &mesh, const float * const color)
{
	// draw mesh
	const unsigned int *faces = mesh.getFaces().data();
	const unsigned int nFaces = mesh.numFaces();
	const Vector3r *vertices = mesh.getVertices().data();
	const Vector3r *vertexNormals = mesh.getVertexNormals().data();

	if (MiniGL::checkOpenGLVersion(3, 3))
	{
		glEnableVertexAttribArray(0);
		glVertexAttribPointer(0, 3, GL_REAL, GL_FALSE, 0, &mesh.getVertices()[0]);
		glEnableVertexAttribArray(2);
		glVertexAttribPointer(2, 3, GL_REAL, GL_FALSE, 0, &vertexNormals[0][0]);
	}
	else
	{
		float speccolor[4] = { 1.0, 1.0, 1.0, 1.0 };
		glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, color);
		glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, color);
		glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, speccolor);
		glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 100.0f);
		glColor3fv(color);

		glEnableClientState(GL_VERTEX_ARRAY);
		glEnableClientState(GL_NORMAL_ARRAY);
		glVertexPointer(3, GL_REAL, 0, &vertices[0][0]);
		glNormalPointer(GL_REAL, 0, &vertexNormals[0][0]);
	}

	glDrawElements(GL_TRIANGLES, (GLsizei)3 * mesh.numFaces(), GL_UNSIGNED_INT, mesh.getFaces().data());

	if (MiniGL::checkOpenGLVersion(3, 3))
	{
		glDisableVertexAttribArray(0);
		glDisableVertexAttribArray(2);
	}
	else
	{
		glDisableClientState(GL_VERTEX_ARRAY);
		glDisableClientState(GL_NORMAL_ARRAY);
	}
}

void MiniGL::drawMesh(const std::vector<Vector3r> &vertices, const std::vector<unsigned int> &faces,
		const std::vector<Vector3r> &vertexNormals, const float * const color)
{
	// draw mesh
	if (MiniGL::checkOpenGLVersion(3, 3))
	{
		glEnableVertexAttribArray(0);
		glVertexAttribPointer(0, 3, GL_REAL, GL_FALSE, 0, &vertices[0][0]);
		if (vertexNormals.size() > 0)
		{
			glEnableVertexAttribArray(2);
			glVertexAttribPointer(2, 3, GL_REAL, GL_FALSE, 0, &vertexNormals[0][0]);
		}
	}
	else
	{
		float speccolor[4] = { 1.0, 1.0, 1.0, 1.0 };
		glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, color);
		glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, color);
		glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, speccolor);
		glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 100.0f);
		glColor3fv(color);

		glEnableClientState(GL_VERTEX_ARRAY);
		glVertexPointer(3, GL_REAL, 0, &vertices[0][0]);
		if (vertexNormals.size() > 0)
		{
			glEnableClientState(GL_NORMAL_ARRAY);
			glNormalPointer(GL_REAL, 0, &vertexNormals[0][0]);
		}
	}

	glDrawElements(GL_TRIANGLES, (GLsizei) faces.size(), GL_UNSIGNED_INT, faces.data());

	if (MiniGL::checkOpenGLVersion(3, 3))
	{
		glDisableVertexAttribArray(0);
		glDisableVertexAttribArray(2);
	}
	else
	{
		glDisableClientState(GL_VERTEX_ARRAY);
		glDisableClientState(GL_NORMAL_ARRAY);
	}
}

void MiniGL::drawQuad(const Vector3r &a, const Vector3r &b, const Vector3r &c, const Vector3r &d, const Vector3r &norm, float *color)
{
	float speccolor[4] = { 1.0, 1.0, 1.0, 1.0 };
	glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, color);
	glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, color);
	glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, speccolor);
	glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, 100.0);

	glBegin (GL_QUADS);
		glNormal3v(&norm[0]);
		glVertex3v(&a[0]);
		glVertex3v(&b[0]);
		glVertex3v(&c[0]);
		glVertex3v(&d[0]);
	glEnd ();
}

void MiniGL::drawTriangle (const Vector3r &a, const Vector3r &b, const Vector3r &c, const Vector3r &norm, float *color)
{
	float speccolor[4] = { 1.0, 1.0, 1.0, 1.0 };
	glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, color);
	glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, color);
	glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, speccolor);
	glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, 100.0);

	glBegin (GL_TRIANGLES);
		glNormal3v(&norm[0]);
		glVertex3v(&a[0]);
		glVertex3v(&b[0]);
		glVertex3v(&c[0]);
	glEnd ();
}

void MiniGL::drawTetrahedron(const Vector3r &a, const Vector3r &b, const Vector3r &c, const Vector3r &d, float *color)
{
	Vector3r normal1 = (b-a).cross(c-a);
	Vector3r normal2 = (b-a).cross(d-a);
	Vector3r normal3 = (c-a).cross(d-a);
	Vector3r normal4 = (c-b).cross(d-b);
	drawTriangle(a, b, c, normal1, color);
	drawTriangle(a, b, d, normal2, color);
	drawTriangle(a, c, d, normal3, color);
	drawTriangle(b, c, d, normal4, color);
}

void MiniGL::drawGrid_xz(float *color)
{
	float speccolor[4] = { 1.0, 1.0, 1.0, 1.0 };
	glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, color);
	glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, color);
	glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, speccolor);
	glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 100.0);

	const int size = 5;

	glBegin(GL_LINES);
	for (int i = -size; i <= size; i++)
	{
		glVertex3f((float) i, 0.0f, (float) -size);
		glVertex3f((float) i, 0.0f, (float) size);
		glVertex3f((float) -size, 0.0f, (float) i);
		glVertex3f((float) size, 0.0f, (float) i);
	}
	glEnd();

	glLineWidth(3.0f);
	glBegin(GL_LINES);
	glVertex3f((float)-size, 0.0f, 0.0f);
	glVertex3f((float)size, 0.0f, 0.0f);
	glVertex3f(0.0f, 0.0f, (float) -size);
	glVertex3f(0.0f, 0.0f, (float) size);
	glEnd();
}

void MiniGL::drawGrid_xy(float *color)
{
	float speccolor[4] = { 1.0, 1.0, 1.0, 1.0 };
	glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, color);
	glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, color);
	glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, speccolor);
	glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 100.0);

	const int size = 5;

	glBegin(GL_LINES);
	for (int i = -size; i <= size; i++)
	{
		glVertex3f((float)i, (float)-size, 0.0f );
		glVertex3f((float)i, (float)size, 0.0f);
		glVertex3f((float)-size, (float)i, 0.0f);
		glVertex3f((float)size, (float)i, 0.0f);
	}
	glEnd();

	glLineWidth(3.0f);
	glBegin(GL_LINES);
	glVertex3f((float)-size, 0.0f, 0.0f);
	glVertex3f((float)size, 0.0f, 0.0f);
	glVertex3f(0.0f, (float)-size, 0.0f);
	glVertex3f(0.0f, (float)size, 0.0f);
	glEnd();
}

void MiniGL::setViewport(float pfovy, float pznear, float pzfar, const Vector3r &peyepoint, const Vector3r &plookat)
{
	fovy = pfovy;
	znear = pznear;
	zfar = pzfar;

	glLoadIdentity ();
	gluLookAt (peyepoint [0], peyepoint [1], peyepoint [2], plookat[0], plookat[1], plookat[2], 0, 1, 0);

	Matrix4r transformation;
	Real *lookAtMatrix = transformation.data();
	glGetRealv(GL_MODELVIEW_MATRIX, &lookAtMatrix[0]);

	Matrix3r rot;
	Vector3r scale;

	rot.row(0) = Vector3r (transformation(0,0), transformation(0,1), transformation(0,2));
	rot.row(1) = Vector3r (transformation(1,0), transformation(1,1), transformation(1,2));
	rot.row(2) = Vector3r (transformation(2,0), transformation(2,1), transformation(2,2));
	scale[0] = rot.col(0).norm();
	scale[1] = rot.col(1).norm();
	scale[2] = rot.col(2).norm();
	m_translation = Vector3r (transformation(0,3), transformation(1,3), transformation(2,3));

	rot.col(0) = 1.0/scale[0] * rot.col(0);
	rot.col(1) = 1.0/scale[1] * rot.col(1);
	rot.col(2) = 1.0/scale[2] * rot.col(2);

	m_zoom = scale[0];
	m_rotation = Quaternionr(rot);

	glLoadIdentity ();
}

void MiniGL::setViewport(float pfovy, float pznear, float pzfar)
{
	fovy = pfovy;
	znear = pznear;
	zfar = pzfar;
}

void MiniGL::setClientSceneFunc (SceneFct func)
{
	scenefunc = func;
}

void MiniGL::init(int argc, char **argv, const int width, const int height, const char *name)
{
	fovy = 60;
	znear = 0.5f;
	zfar = 1000;

	m_width = width;
	m_height = height;

	scenefunc = nullptr;

	glfwSetErrorCallback(error_callback);

	if (!glfwInit())
		exit(EXIT_FAILURE);

	//glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
	//glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
	//glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

	//glfwWindowHint(GLFW_DOUBLEBUFFER, GL_FALSE);
	m_glfw_window = glfwCreateWindow(width, height, name, NULL, NULL);
	if (!m_glfw_window)
	{
		glfwTerminate();
		exit(EXIT_FAILURE);
	}

	glfwMakeContextCurrent(m_glfw_window);
	gladLoadGL(glfwGetProcAddress);
	glfwSwapInterval(0);

	glfwSetFramebufferSizeCallback(m_glfw_window, reshape);

	getOpenGLVersion(m_context_major_version, m_context_minor_version);
	glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &m_context_profile);

	LOG_INFO << "OpenGL version " << m_context_major_version << "." << m_context_minor_version;
	LOG_INFO << "Vendor: " << glGetString(GL_VENDOR);
	LOG_INFO << "Renderer: " << glGetString(GL_RENDERER);
	LOG_INFO << "Version: " << glGetString(GL_VERSION);

	glEnable (GL_DEPTH_TEST);
	glEnable (GL_NORMALIZE);
	glShadeModel (GL_SMOOTH);
	glEnable (GL_BLEND);
	glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	glClearColor(0.4f, 0.4f, 0.4f, 1.0f);

	glfwSetKeyCallback(m_glfw_window, keyboard);
	glfwSetCharCallback(m_glfw_window, char_callback);
	glfwSetMouseButtonCallback(m_glfw_window, mousePress);
	glfwSetCursorPosCallback(m_glfw_window, mouseMove);
	glfwSetScrollCallback(m_glfw_window, mouseWheel);

	glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
}

void MiniGL::initTexture()
{
	int value;
	for (int row = 0; row < IMAGE_ROWS; row++)
	{
		for (int col = 0; col < IMAGE_COLS; col++)
		{
			if (((row & 0x8) == 0) ^ ((col & 0x8) == 0))
				value = 192;
			else
				value = 128;
// 			// Each cell is 8x8, value is 0 or 255 (black or white)
// 			value = (((row & 0x8) == 0) ^ ((col & 0x8) == 0)) * 255;
			texData[row][col][0] = (GLubyte)value;
			texData[row][col][1] = (GLubyte)value;
			texData[row][col][2] = (GLubyte)value;
		}
	}

	glGenTextures(1, &m_texId);
	glBindTexture(GL_TEXTURE_2D, m_texId);
	glTexImage2D(GL_TEXTURE_2D, 0, 3, IMAGE_COLS, IMAGE_ROWS, 0, GL_RGB,
		GL_UNSIGNED_BYTE, texData);  // Create texture from image data
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

	glEnable(GL_TEXTURE_2D);  // Enable 2D texture

	// Correct texture distortion in perpective projection
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

	glBindTexture(GL_TEXTURE_2D, 0);
}

void MiniGL::setMouseMoveFunc(int button, void(*func) (int, int, void*))
{
	mousefunc = func;
	mouseFuncButton = button;
}

void MiniGL::setSelectionFunc(void(*func) (const Vector2i&, const Vector2i&, void*), void *clientData)
{
	selectionfunc = func;
	selectionfuncClientData = clientData;
}

void MiniGL::destroy ()
{
	gluDeleteQuadric(m_sphereQuadric);
}

void MiniGL::reshape (GLFWwindow* glfw_window, int w, int h)
{
	if ((w > 0) && (h > 0))
	{
		m_width = w;
		m_height = h;

		for (auto i = 0; i < m_reshapeFct.size(); i++)
			m_reshapeFct[i](m_width, m_height);
		glViewport(0, 0, m_width, m_height);
	}
}

void MiniGL::setClientIdleFunc (IdleFct func)
{
	idlefunc = func;
}

void MiniGL::setClientDestroyFunc(DestroyFct func)
{
	destroyfunc = func;
}

void MiniGL::addKeyFunc (unsigned char k, std::function<void()> const& func)
{
	if (func == nullptr)
		return;
	else
		keyfunc.push_back({ func, k });
}

void MiniGL::keyboard(GLFWwindow* window, int key, int scancode, int action, int mods)
{
	// Check if registered listener wants the event
	for (auto i=0; i < m_keyboardFct.size(); i++)
	{
		if (m_keyboardFct[i](key, scancode, action, mods))
			return;
	}

	if (key == GLFW_KEY_ESCAPE)
	{
		m_breakPointLoop = false;
		m_breakPointActive = false;
#ifndef __APPLE__
		leaveMainLoop();
#else
		exit(0);
#endif
		return;
	}
	else if (key == GLFW_KEY_A)
		move (0, 0, movespeed);
	else if (key == GLFW_KEY_Y)
		move (0, 0, -movespeed);
	else if (key == GLFW_KEY_UP)
		move(0, -movespeed, 0);
	else if (key == GLFW_KEY_DOWN)
		move(0, movespeed, 0);
	else if (key == GLFW_KEY_LEFT)
		move(movespeed, 0, 0);
	else if (key == GLFW_KEY_RIGHT)
		move(-movespeed, 0, 0);
	else if (key == GLFW_KEY_F5)
		m_breakPointLoop = false;
}

void MiniGL::char_callback(GLFWwindow* window, unsigned int codepoint)
{
	// Check if registered listener wants the event
	for (auto i = 0; i < m_charFct.size(); i++)
	{
		if (m_charFct[i](codepoint, GLFW_PRESS))
			return;
	}

	for (int i = 0; i < keyfunc.size(); i++)
	{
		if (codepoint == keyfunc[i].key)
			keyfunc[i].fct();
		else if (codepoint == GLFW_KEY_1)
			rotateX(-turnspeed);
		else if (codepoint == GLFW_KEY_2)
			rotateX(turnspeed);
		else if (codepoint == GLFW_KEY_3)
			rotateY(-turnspeed);
		else if (codepoint == GLFW_KEY_4)
			rotateY(turnspeed);
	}
}

void MiniGL::setProjectionMatrix (int width, int height)
{
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(fovy, (Real)width / (Real)height, znear, zfar);
}

void MiniGL::viewport ()
{
	glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glRenderMode (GL_RENDER);
	glfwGetFramebufferSize(m_glfw_window, &m_width, &m_height);
	glViewport (0, 0, m_width, m_height);
	glMatrixMode (GL_PROJECTION);
	glLoadIdentity ();
	setProjectionMatrix (m_width, m_height);
	glMatrixMode (GL_MODELVIEW);

	glTranslatef((float)m_translation[0], (float)m_translation[1], (float)m_translation[2]);
	Matrix3r rot;
	rot = m_rotation.toRotationMatrix();
	Matrix4r transform(Matrix4r::Identity());
	Vector3r scale(m_zoom, m_zoom, m_zoom);
	transform.block<3,3>(0,0) = rot;
	transform.block<3,1>(0,3) = m_translation;
	transform(0,0) *= scale[0];
	transform(1,1) *= scale[1];
	transform(2,2) *= scale[2];
	Real *transformMatrix = transform.data();
	glLoadMatrix(&transformMatrix[0]);
}

void MiniGL::initLights ()
{
	float t = 0.9f;
	float a = 0.2f;
	float amb0 [4] = {a,a,a,1};
	float diff0 [4] = {t,0,0,1};
	float spec0 [4] = {1,1,1,1};
	float pos0 [4] = {-10,10,10,1};
	glLightfv(GL_LIGHT0, GL_AMBIENT,  amb0);
	glLightfv(GL_LIGHT0, GL_DIFFUSE,  diff0);
	glLightfv(GL_LIGHT0, GL_SPECULAR, spec0);
	glLightfv(GL_LIGHT0, GL_POSITION, pos0);
	glEnable(GL_LIGHT0);

	float amb1 [4] = {a,a,a,1};
	float diff1 [4] = {0,0,t,1};
	float spec1 [4] = {1,1,1,1};
	float pos1 [4] = {10,10,10,1};
	glLightfv(GL_LIGHT1, GL_AMBIENT,  amb1);
	glLightfv(GL_LIGHT1, GL_DIFFUSE,  diff1);
	glLightfv(GL_LIGHT1, GL_SPECULAR, spec1);
	glLightfv(GL_LIGHT1, GL_POSITION, pos1);
	glEnable(GL_LIGHT1);

	float amb2 [4] = {a,a,a,1};
	float diff2 [4] = {0,t,0,1};
	float spec2 [4] = {1,1,1,1};
	float pos2 [4] = {0,10,10,1};
	glLightfv(GL_LIGHT2, GL_AMBIENT,  amb2);
	glLightfv(GL_LIGHT2, GL_DIFFUSE,  diff2);
	glLightfv(GL_LIGHT2, GL_SPECULAR, spec2);
	glLightfv(GL_LIGHT2, GL_POSITION, pos2);
	glEnable(GL_LIGHT2);

	glEnable(GL_LIGHTING);
	glLightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
	glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);

}

void MiniGL::move(Real x, Real y, Real z)
{
	m_translation[0] += x;
	m_translation[1] += y;
	m_translation[2] += z;
}

void MiniGL::rotateY (Real y)
{
	AngleAxisr angleAxis(y, Vector3r(0,1,0));
	Quaternionr quat(angleAxis);
	m_rotation = m_rotation*quat;
}

void MiniGL::rotateX(Real x)
{
	AngleAxisr angleAxis(x, Vector3r(1,0,0));
	Quaternionr quat(angleAxis);
	m_rotation = quat*m_rotation;
}

void MiniGL::mousePress(GLFWwindow* window, int button, int action, int mods)
{
	//getting cursor position
	glfwGetCursorPos(m_glfw_window, &mouse_pos_x_old, &mouse_pos_y_old);

	// Check if registered listener wants the event
	for (auto i = 0; i < m_mousePressFct.size(); i++)
	{
		if (m_mousePressFct[i](button, action, mods))
			return;
	}

	modifier_key = mods;

	if (action == GLFW_PRESS)
		mouse_button = button;
	else
		mouse_button = -1;

	if ((selectionfunc != NULL) && (modifier_key == 0))
	{
		if (button == GLFW_MOUSE_BUTTON_1)
		{
			if (action == GLFW_PRESS)
				m_selectionStart = Vector2i(mouse_pos_x_old, mouse_pos_y_old);
			else
			{
				if (m_selectionStart[0] != -1)
				{
					const Vector2i pos(mouse_pos_x_old, mouse_pos_y_old);
					selectionfunc(m_selectionStart, pos, selectionfuncClientData);
				}
				m_selectionStart = Vector2i(-1, -1);
			}
		}
	}
}

void MiniGL::mouseWheel(GLFWwindow* window, double xoffset, double yoffset)
{
	mouse_wheel_pos += yoffset;

	// Check if registered listener wants the event
	for (auto i = 0; i < m_mouseWheelFct.size(); i++)
	{
		if (m_mouseWheelFct[i](static_cast<int>(mouse_wheel_pos), xoffset, yoffset))
			return;
	}

	if (yoffset > 0)
		movespeed *= 2.0;
	else
		movespeed *= 0.5;
}

void MiniGL::mouseMove (GLFWwindow* window, double x, double y)
{
	// Check if registered listener wants the event
	for (auto i = 0; i < m_mouseMoveFct.size(); i++)
	{
		if (m_mouseMoveFct[i](static_cast<int>(x), static_cast<int>(y)))
			return;
	}

	double d_x = mouse_pos_x_old - x;
	double d_y = y - mouse_pos_y_old;

	if (mouse_button == GLFW_MOUSE_BUTTON_1)
	{
		// translate scene in z direction
		if (modifier_key == GLFW_MOD_CONTROL)
		{
			move (0, 0, -static_cast<Real>(d_x + d_y) / static_cast<Real>(10.0));
		}
		// translate scene in x/y direction
		else if (modifier_key == GLFW_MOD_SHIFT)
		{
			move (-static_cast<Real>(d_x) / static_cast<Real>(20.0), -static_cast<Real>(d_y) / static_cast<Real>(20.0), 0);
		}
		// rotate scene around x, y axis
		else if (modifier_key == GLFW_MOD_ALT)
		{
			rotateX(static_cast<Real>(d_y)/ static_cast<Real>(100.0));
			rotateY(-static_cast<Real>(d_x)/ static_cast<Real>(100.0));
		}
	}

	if (mousefunc != NULL)
	{
		if ((mouseFuncButton == -1) || (mouseFuncButton == mouse_button))
			mousefunc(static_cast<int>(x), static_cast<int>(y), selectionfuncClientData);
	}

	mouse_pos_x_old = x;
	mouse_pos_y_old = y;
}

void MiniGL::unproject(const int x, const int y, Vector3r &pos)
{
	GLint viewport[4];
	GLdouble mv[16], pm[16];
	glGetIntegerv(GL_VIEWPORT, viewport);
	glGetDoublev(GL_MODELVIEW_MATRIX, mv);
	glGetDoublev(GL_PROJECTION_MATRIX, pm);

	GLdouble resx, resy, resz;
	gluUnProject(x, viewport[3] - y, znear, mv, pm, viewport, &resx, &resy, &resz);
	pos[0] = (Real) resx;
	pos[1] = (Real) resy;
	pos[2] = (Real) resz;
}

float MiniGL::getZNear()
{
	return znear;
}

float MiniGL::getZFar()
{
	return zfar;
}

void MiniGL::hsvToRgb(float h, float s, float v, float *rgb)
{
	int i = (int)floor(h * 6);
	float f = h * 6 - i;
	float p = v * (1 - s);
	float q = v * (1 - f * s);
	float t = v * (1 - (1 - f) * s);

	switch (i % 6)
	{
	case 0: rgb[0] = v, rgb[1] = t, rgb[2] = p; break;
	case 1: rgb[0] = q, rgb[1] = v, rgb[2] = p; break;
	case 2: rgb[0] = p, rgb[1] = v, rgb[2] = t; break;
	case 3: rgb[0] = p, rgb[1] = q, rgb[2] = v; break;
	case 4: rgb[0] = t, rgb[1] = p, rgb[2] = v; break;
	case 5: rgb[0] = v, rgb[1] = p, rgb[2] = q; break;
	}
}

bool MiniGL::checkOpenGLVersion(const int major_version, const int minor_version)
{
	if ((m_context_major_version > major_version) ||
		((m_context_major_version == major_version) && (m_context_minor_version >= minor_version)))
		return true;
	return false;
}

Shader *MiniGL::createShader(const std::string &vertexShader, const std::string &geometryShader, const std::string &fragmentShader)
{
	if (checkOpenGLVersion(3,3))
	{
		Shader *shader = new Shader();

		if (vertexShader != "")
			shader->compileShaderFile(GL_VERTEX_SHADER, vertexShader);
		if (geometryShader != "")
			shader->compileShaderFile(GL_GEOMETRY_SHADER, geometryShader);
		if (fragmentShader != "")
			shader->compileShaderFile(GL_FRAGMENT_SHADER, fragmentShader);
		shader->createAndLinkProgram();
		return shader;
	}
	return NULL;
}
void MiniGL::setBreakPointActive(const bool active)
{
	m_breakPointActive = active;
}

void MiniGL::breakPoint()
{
	breakPointMainLoop();
}

void MiniGL::error_callback(int error, const char* description)
{
	LOG_ERR << description;
}

void MiniGL::mainLoop()
{
	while (!glfwWindowShouldClose(m_glfw_window))
	{
		glfwPollEvents();

		if (idlefunc != nullptr)
			idlefunc();

		glPolygonMode(GL_FRONT_AND_BACK, drawMode);
		viewport();

		if (scenefunc != nullptr)
			scenefunc();

		glfwSwapBuffers(m_glfw_window);
		//glFlush();
	}

	if (destroyfunc != nullptr)
		destroyfunc();

	glfwDestroyWindow(m_glfw_window);

	glfwTerminate();

	destroy();
}

void MiniGL::leaveMainLoop()
{
	glfwSetWindowShouldClose(m_glfw_window, 1);
}

void MiniGL::swapBuffers()
{
	glfwSwapBuffers(m_glfw_window);
	//glFlush();
}

void MiniGL::breakPointMainLoop()
{
	if (m_breakPointActive)
	{
		m_breakPointLoop = true;
		while (m_breakPointLoop)
		{
			glPolygonMode(GL_FRONT_AND_BACK, drawMode);
			viewport();

			if (scenefunc != nullptr)
				scenefunc();

			glfwSwapBuffers(m_glfw_window);
			//glFlush();
			glfwPollEvents();
		}
	}
}

redpajama_set_name: RedPajamaGithub


Your Issue, My Issue, Our Issue?
Throughout history there have been many heated debates about many different topics. I don't usually talk about "hot issues" and this post isn't an exception. I've never been a person who enjoys confrontation but as I get older, I realize it's not really about the issue but about the bigger picture. If you study Jesus' life, you can see glimpses of what I'm talking about, but let me explain.
I believe, sometimes God calls us to take a stand. Sometimes, I believe, God calls us to be silent, even if the issue is one worth fighting for. Other times, I believe God calls us to be supportive of others, coming alongside them in their fight but not necessarily fighting ourselves. An example of that is found in Exodus 17 when Aaron and Hur helped Moses hold his hands up during a battle as God instructed.
If you look in John 8, it explains about the time the Pharisees tried to trap Jesus and He chose not to take the bait. Instead of getting into a debate with them, He chose to instead write something in the sand. The Bible isn't specific about what, so I'm interested to know exactly what it was He wrote that caused all the men to leave without condemning the woman.
Another example found in John 4 explains how Jesus confronted the woman at the well regarding the man she was living with was not her husband. However, I love how all the conversations Jesus has with people are wrapped in love. He speaks in love first, then and only then addresses the individual about their sinful lifestyle.
I think we would be smart to follow Jesus' examples. The only way to do that is to develop a close relationship with God. Read His word to find out how He handled situations and then do our best to imitate His actions. Sometimes, as a result, God will call us to take action regarding a specific issue presented in society. Other times, we could be asked to support someone else's fight by praying quietly from the background while they do the fighting. Always, though, our actions, our attitudes, and our hearts should be ones of loving the people involved and showing attitudes that reflect the Jesus we serve.
I'm pleasantly surprised how respect can be earned by even your strongest adversary when love is demonstrated and acceptance of people themselves is shown. Jesus always loved the people He encountered even if the lifestyle they were living in was one He didn't endorse.
I'm going to keep listening to God's voice so I can obey. Sometimes I'll need to join in the fight, other times pray from the sidelines, and still other times stand alongside. I want to be a person who follows Jesus' example in all my encounters. I'll never do it perfectly, but that won't keep me from trying. I want to make sure love is demonstrated loud and clear in all my interactions, just as Jesus has shown me through His example.
Have you ever participated in a blood drive? What about as a volunteer for a school carnival, Vacation Bible School, or your child's field trip? During the holidays, have you ever picked a child's name off a tree, helped serve food at a soup kitchen, or put your spare change in a Salvation Army red kettle?
Did you stop to think that by doing any of those things you've been part of something bigger than yourself? I was having a conversation with someone special the other day and we were talking about how peaceful it is to know that things occur in our lives not just because of us, but because there is a bigger picture, something more important than just what happens to us. And, sometimes we're given the privilege to actively participate in blessing others' lives through our actions.
The overlying message of the Bible is grace…and love. We don't have to earn our salvation. In fact, we can't. There is no work of any kind we can accomplish to earn us a spot in Heaven. And, God loves each and every one of us so much that His main goal is to heap love on us and point us in the direction to make that choice, to receive the free gift, to accept His love and choose Him.
What would you say if I told you once you accepted that gift for yourself, it wasn't over? What would you say if I told you there was more? What would you say if I told you it was your turn to be a blessing to someone else? To point them in the direction of God's love and show them they also don't have to do anything to get to Heaven except choose? How would it make you feel to be part of the bigger plan, the bigger picture, a small part of pointing someone you love, or a complete stranger, or a coworker in the right direction to make the choice for herself?
I'm excited to think about all the people I will someday meet in Heaven…some who have been a part of my "bigger picture" and hopefully some that I've been a part of their "bigger picture." To think we'll have eternity to get to know each other, build a friendship, and just enjoy knowing God gets all the glory for any of us being there to begin with.
We live in the Midwest and this past winter our kids had more snow days off from school than usual. One particular evening at dinner, one child prayed, "God, please let us have a snow day tomorrow," followed by the next child praying, "God, please let us have school tomorrow." I laughed. I know, not the most appropriate response. It struck me as funny because one person was going to "win" and one person was going to "lose." Literally within one minute of them finishing their prayers, a text came through on my phone signaling yet another snow day. While rejoicing with one child, I consoled the other.
The above scenario got me thinking about a bigger spiritual lesson. What if two people are simultaneously praying for the same job – one will ultimately be told "yes" while another is told "no." Does that mean God loves one person more than the other? Is He punishing one person and rewarding the other?
As I've learned more about God's personality and His motives, my answer would have to be "no." I don't believe He's punishing one person and rewarding the other. I think there are a couple things going on that we need to consider the next time we receive our answer from God. First of all, as the above verse explains, God's ultimate goal in life is for everyone to go to Heaven. His purpose isn't to make us comfortable or provide a life free from difficulty. One look in the Bible will prove that point. Study the lives of Joseph, David, Moses, or Daniel to name a few. These men dealt with difficult circumstances. They continued to obey God's commands and as a result, God ultimately got the glory and they were blessed. Everything that God does in life is to point people toward His Son, giving us the choice to choose Him and eternity in Heaven together.
Second, what might seem like the perfect "yes" for you may in fact be "just enough." I've talked quite a bit about how God wants more for us than "just enough." He ultimately wants "the Best" for our lives. When we look from our small viewpoint, some scenarios scream "yes" at us as though they would be the perfect solution. However, from God's much higher perspective, our "yes" could in fact spell disaster. I find for my own life, most often the easy road I prefer doesn't allow me to grow and mature in the skills I need for the next leg of my journey. Easy is nice, but most of the time easy just prolongs the growth necessary to fulfill my purpose as well as delays the potential blessings.
I want to encourage you the next time you pray and receive "no" when you really wanted "yes," or visa versa. God loves each and every one of us. He sees not only where we are but where we ultimately are going much clearer than we do. Trust Him with your "yes" and with your "no." If you continue to obey and listen to His voice, the final result may be better than you originally asked for.
I think it's fair to say winter in 2014 has been rough everywhere. More snow, ice, and subzero temperatures then we've experienced in a while. While standing with my daughter waiting for the school bus with windchills in the single digits, I vaguely remembered hearing someone say it was going to be extra cold because the fur growing on the horses this fall was thick.
I experienced a "winter" in my personal life in 2013. I felt like nothing was happening. I wondered what God was preparing me for, questioned my direction, and contemplated whether or not I'd heard Him correctly. I had a choice. I could've turned away, looked for the solution myself, and ended up moving further in the wrong direction. Or, I could've pressed in closer, asking God to speak, waiting patiently while walking where I thought He wanted me to, listening intently for any change of direction. I chose to press in closer.
I discovered multiple answers. The first was that He was preparing me – I didn't know what for, but this was preparation time. I was in winter. Winter is dormant. Action takes place underground, but the movement isn't visible. Instead of growth, it's a time to strengthen.
Second, He gave me a verse to learn how to "Stand firm and see the deliverance He would give." God needed to bring me personally to a place where I trusted Him, stopped trying to earn His favor and love, and just let Him provide. That was a hard lesson for someone who has struggled with sitting still. I'm used to working for things, but needed to learn the true definition of grace.
Lastly, He gave me permission to rest. In fact, He was very clear that now was the time to rest because soon I'd be working hard. He wanted me mentally, physically, and most importantly, spiritually ready. However, He only gave me the "all clear" to work after He'd taught me first what it felt like to have Him deliver me. This last one was hard for me also because I like to get my work done and then rest instead of resting ahead of time.
In 2014, God started showing me a glimpse of what He has planned. Only a glimpse. He gave me some very clear directions and it is with excitement that I'm beginning to accomplish what He's asking of me, in His strength. He's continually adding to the bigger picture what He wants me to do and while I have a little residual fear, I'm choosing to venture out and obey in those areas as well. Most importantly, He's showing me how wonderful the spring feels after having endured what has felt like a very long and difficult winter. In addition, He's showing me how important winter is to prepare for spring and summer.
As you begin to see signs of spring weather in your community, can you identify any areas of your personal life where God has brought you out of a winter season into the freshness of spring?
Last time we were together, I talked about going shopping on a Friday morning for four hours. I prepared everything the night before, ready to set out bright and early the next day. In all honesty, I wasn't really looking forward to it. I needed to restock our pantry, had limited funds, and wasn't sure how it was going to be accomplished. Not to mention, I knew it would take a lot of time and my day was pretty full.
Our littlest piped up from the backseat, inquiring what I was talking about and I had a chance to explain to him the choice I just made. Not only was it a great reminder for me, but I was able to show through example that complaining isn't necessary. We ended up saving $50 on groceries at our main store that morning because so many things I hadn't realized were on sale. If I had bought them at the bargain store, I would've ended up paying more instead of less. That was the first blessing that occurred. Then, at the bargain store, an older man approached us and started talking to me about my purse, the one I mentioned in the post, Free or False Advertising. We ended up in line next to each other which gave us even more time to talk. Turns out, he and his wife are looking for a new church and I had the opportunity to invite them to join us at our church. And, the fact that the man was hard of hearing and I had to speak loudly, I just may have invited a few more unsuspecting people who were close by as well.
As I was driving out of the parking twenty minutes later, I thanked God for the saved money and the divine appointment He created between us and the older gentleman. I asked Him if this was possibly why He changed the order of my shopping that morning so that I could invite this family to our church.
I may never know the exact reason my schedule was changed. But I learned a valuable lesson. When I choose to be thankful, God has a chance to work through me to bless others. He also has a chance to bless me as well. When I harden my heart through temper tantrums, I restrict the ways God can use me to bless others and I miss the blessings He has for me as well.
One Friday in late January, I was on my way to help chaperone my son's dance when all of a sudden I was filled with thankfulness. I was also tired. I had spent four hours that morning traveling to several groceries stores searching for the best bargains, putting groceries away, grabbing lunch, and then leaving again. As I was driving, my knee was screaming at me. I realized standing for the next two to three hours probably would make it worse, but I was happy. I was feeling blessed to experience throbbing knees and an aching back. Then my thoughts went further and I was happy for stretch marks, a little extra cushion in places I wish it wasn't, and wrinkles, sunspots, and a gray hair or two. Okay, maybe not so much for the gray hair.
You see, it was then I realized that all the above "discomforts" were really a blessing. It meant I was living life instead of sitting on the sidelines. A full life. Yes, there were lumps and bumps in places that used to be smoother, aches and pains in places I used to take for granted, and lines and wrinkles in undiscovered territory…but I wouldn't change my journey. Has it always been fun? No, but what true adventure is only filled with laughter and fun? Most adventures, that you reminisce about with your friends anyway, are filled with the unexpected. That's what makes them adventures. That's what makes life worth sharing.
I believe God doesn't want us to sit on the sidelines either. If you take a look at Jesus' life while He lived on the Earth, He seized every opportunity He had to tell others about His Father's love and how to spend eternity with Him in Heaven. While He made sure to take good care of His body, many times He preached all day long. That's what I want to do with my own life. I want to take better care of myself so I remain healthy to continue living until I breathe my last breath.
And my happiness continued throughout the dance. I was in charge of pouring pop. It gave me a chance to practice some bartending skills, but the most fun was making a connection with middle schoolers. Some I knew previously while others I was meeting for the first time. I left there a lot more tired but also a lot more happy.
I ended up falling asleep early that Friday night, but it was with a smile on my face. Thankful for the chance to be a wife to a loving husband, mother to three terrific kids, part-time bartender of middle school dances, part time coupon-savvy grocery guru, and full-time Christ follower. I'm still working on getting healthier so I can fulfill my mission in life easier, but in the meantime, I'm thankful for the lumps, bumps, aches and pains.
Tentative release date end of March/beginning of April.
As spring approaches and you dream of digging in the dirt…here's an opportunity to Dig Deeper into God's Word.


Leon Netardus' contributions to the community through his volunteerism and his historic tours are what he's most known for. But before his service to the city, Netardus enlisted in the U.S. Army.
Leon Netardus tried to see as much as Japan as possible. Despite all the devastation caused by the war, Netardus considered Kamakura a beautiful seaside city.
A couple of times during his stay in Japan, Leon Netardus' outfit was put on notice to ship out to the Korean peninsula.
Editor's Note—this is another article in the series of stories about Gonzales men and women who served their country. If you would like to recommend another veteran who served for this series, please contact Publisher Terry Fitzwater at terry.fitzwater@gonzalesinquirer.com, or call 830-672-2861.
Almost everyone who lives in Gonzales County knows who Leon Netardus is. He is known as much for his 38 years of service at GVEC as he is known for being one of the area's leading historians and thespians.
What many people do not know about is Leon's service to his country. This is his story.
Leon Netardus was born on April 12, 1929 to Lydia (Skrehot) and August Netardus in Yoakum, Texas. The oldest of two sons (his brother Joseph was a veterinarian who was born in 1932), Leon spent his formative years moving with his parents as they struggled like most Americans in the Great Depression.
"Dad owned a grocery store, but a lot of people did not have money to pay with during the Great Depression so he closed the business," Netardus said. "I was small and didn't realize a lot of what was going on. We never had much so I didn't really expect much back then. We moved a few times, until Dad found a job with Curtis Candy in 1942. That's when we moved to Gonzales from Victoria.
"I guess in another 25 years, you might actually be able to call me a local," Netardus added jokingly.
Netardus attended Gonzales High, where he lettered in football and basketball. He even tried out for track.
"There were 75 people in my graduating class, so there weren't a lot of athletes," Netardus said. "I went out for track one year, and they made me run the mile. Well, that was the end of my track career," he laughed.
While in high school, Netardus had three routes delivering the Gonzales Inquirer newspaper on his bicycle.
Having been graduated in 1946, Netardus and his friend George Ritchie decided to join the United States Navy to take advantage of the G.I. Bill. They both signed up, a huge party was held in their honor, and then they both left to go for their Navy physical. Netardus failed the eye exam, and he was not allowed to join the Navy, which he felt crushed about. His friend George went off to serve in the Navy.
Leon did some odd jobs, including trying his hand at flying, before he joined the United States Army for an 18-month enlistment. The war had ended the previous September, but the military was offering benefits to go to college.
After enlisting at Ft. Randolph Field, Leon was off to Ft. Bliss in El Paso for basic training, then after finishing boot camp, he was shipped off to Ft. Stoneman in northern California to a replacement depot. After five weeks of washing pots and pans, doing KP [kitchen patrol] duty and other mundane Army tasks, Netardus' outfit, the 1st Cavalry Division, 5th Regiment, shipped out for Japan on the General Hodges.
The 12-day voyage took him to Yokahama, Japan, a city that had been devastated by the Army Air Corps bombings during World War II. Sailing up Tokyo Bay, Netardus said he admired the beauty of 12,000-foot cone-shaped Mt. Fuji, but was in for a surprise at the devastation that had rained down on Japan.
During his stay in Japan, Netardus—who had been promoted to corporal after eight months of service—tried to see as much of the country as possible.
"I enjoyed Kamakura the most," Netardus recalled. "Despite all the rubble and devastation, the Japanese train system was up and running and it ran on perfect timing. If we didn't get a Jeep we would take a train.
A couple of times during his stay in Japan, Netardus' outfit was put on notice that they would be shipping out in one hour. Their destination: the Korean peninsula.
"That was the only time I got a little nervous, because we knew there were hostilities in Korea," Netardus said. "When we got notice were going to be on the move, yes, I was a little scared.
After 16 months, Leon was shipped back home on the Admiral Sims, and was quickly discharged from the Army. He got $97 for discharge pay.
Upon returning to his life in Gonzales, Leon enrolled in St. Mary's College in San Antonio where he earned a BBA with a major in accounting.
About the time he purchased his flashy convertible, Leon saw a lovely lady at church who caught his eye. Her name was Rose Mary (Wroblesky) Butchek.
"I saw her sitting there, and I just had to meet her," said Leon. "It was at St. James Church, and I'm sure I did not get in any trouble upstairs," he joked.
Leon and Rose Mary were married on July 2, 1955. Rose Mary (whose previous husband had died in a car accident) had a daughter named Priscilla, and together the couple had a daughter named Janet. Priscilla Finch has three children of her own and Janet Flynt has two children of her own, making Leon and Rose Mary great grandparents five times over.
"We've had a good life," Leon said on reflection. "After I retired, I volunteered at the chamber and now I give historic tours around Gonzales.


There are 2 public schools and 3 private schools listed on our site for Edgerton.
There are 26 full-time teachers educating a total of 324 students. 79 students receive a free lunch while 48 receive a reduced-price lunch.


Rivers of Carbon and South East Local Land Services would like to invite you to the launch of Buffers, Sponges & Moderators: Managing swampy meadows, wetlands and chain of ponds. Join us for an afternoon screening with scones and tea, and hear from and meet the cast!
Please also share the event with anyone who would be interested!
Rivers of Carbon is a community driven initiative that focuses on connecting and linking riparian rehabilitation projects with remnant vegetation and other works. We work with landowners and community groups to rehabilitate riparian areas for biodiversity, carbon sequestration, reduced sedimentation, and improved stock management. We also raise awareness, share knowledge and celebrate the many values our rivers have for communities – both human and ecological.


text:
Jeffs Place 2nd at ECAC Championships
Contact: Justin Long
NEW YORK, N.Y. – Three phenomenal races by Keri Lambert '13 and another school-record performance by Naomi Bates '14 helped the Amherst women's track and field team place second at the ECAC Championships.
The Lord Jeffs were one of 57 teams to score points at The Armory Track and Field Center, as Amherst (46) trailed only MIT (56.33) in the standings. Rounding out the top five were Tufts (45), Williams (42) and Cortland State (42).
Amherst earned two wins on the day, the first of which went to Lauren Almeida '13 in the 1,000-meter run. Almeida posted a time of 2:59.19, while teammate Amy Dao '14 finished fifth with a new personal record (3:03.43).
Dao would also run the final leg of the 4x800 relay, which Amherst won with a time of 9:23.69. Also running in the 4x800 were Ellen Richmond '12, Lambert and Melissa Sullivan '12, as the group posted a new Division III Armory record. An outstanding second leg by Lambert gave the Lord Jeffs a comfortable 40-meter lead in the race, as Sullivan and Dao were able to close out the victory.
Lambert also placed second in the mile run with a personal-best 4:53.76, marking the second fastest time in school history and one of the five fastest Division III times of the year. Lambert would later help the Jeffs post the school's second best time in the distance medley relay, as she teamed up with Almeida, Bates and Sullivan to finish third (11:52.12).
Bates placed fifth in both the 60-meter dash (7.83) and the 200-meter dash (25.68), achieving a new personal best in the 60 and setting a new school record in the 200. First-year Lizzy Briskin ran a 5:12.03 in the mile, marking a 28-second improvement from the beginning of her debut season. Also closing out a great first year was Abraelle Shirley '15, whose time of 26.34 in the 200 marked a new personal best.
The NCAA Championships are set to take place next weekend in Grinnell, Iowa. The official field will be released on Monday.

redpajama_set_name: RedPajamaCommonCrawl


text:
Tourism | UK, Chinese visitors top list as thousands have a Saudi holiday
- Monday, November 25, 2019 - 2 months ago No Comments 3,668 Views
Saudi Arabia's embryonic efforts to turn the kingdom into a magnet for holidaymakers attracted 50,000 visitors since the September launch, and almost three times that number applied for tourist visas officials hope will diversify an oil-dependent economy.
British tourists, followed by Chinese, were the top visitors, Ahmed Al-Khateeb, chairman of the Saudi Commission for Tourism and National Heritage, said in an interview in Riyadh. About 140,000 people requested tourist visas, he said.
The numbers are "in line with our expectations," Al-Khateeb, a key adviser to Saudi Crown Prince Mohammed bin Salman, said Wednesday. "We are expecting that the adventurous will come first to explore the country, and this is what is happening."
He spoke on the sidelines of an event to launch a $17 billion project called Diriyah Gate, a revamp of the historic hometown of the Saudi royal family that officials want to be a major draw for tourists.
While representing an important beginning for the conservative Islamic kingdom, there's a long way to go before it can compare to long-established regional destinations. Dubai received more than 130,000 Saudi tourists a month on average last year. Officials say they'll need to add flights and hotel rooms to meet demand as they chase their targets.
Until September, Saudi Arabia had been one of the hardest countries in the world to visit, issuing visas only for business trips, religious pilgrimage or family gatherings. But the government's now delivering on a pledge made in 2016 to allow tourism as the oil-price rout wreaked havoc on finances and triggered Prince Mohammed's plan to overhaul the economy.
To attract visitors, officials have significantly loosened some social restrictions, dropping a requirement that foreign women wear floor-length robes in public and allowing foreign, unmarried couples to share hotel rooms.
The kingdom "will continue our reforms," Al-Khateeb said, but he didn't expect a ban on alcohol consumption to be eased.
"I don't see it happening," he said. "When we promote our tourism, we're promoting the history, the heritage, the culture and I believe we have enough offerings to our guests."
Businesses could be allowed to stay open during Islam's daily prayers – Saudi restaurants, cafes and shops close for half an hour several times a day – Al-Khateeb said, if it becomes "a must." For now, people are managing their time and the prayer closures are "not a problem," he said.
"I think this is not an obstacle to people to come and shop in a shopping mall or outside," he said. "But definitely, we are assessing the tourist's journey and we are receiving very valuable feedback from our tourists and our visitors." Vivian Nereim, Bloomberg


text:
New South WalesFestevez - Australian Film Festivals2020-03-30T15:53:11+11:00
04may7:00 pm10:00 pmBanff Mountain Film Festival 2022 - Orpheum 4 May 7pm7:00 pm - 10:00 pm
Festevent Details
The 2022 Banff Mountain Film Festival World Tour is a 3 hour celebration of the mountain and adventure sport world. Sharing over 2 1/2 hours of the most exhilarating short
The 2022 Banff Mountain Film Festival World Tour is a 3 hour celebration of the mountain and adventure sport world. Sharing over 2 1/2 hours of the most exhilarating short films from explorers, runners, mountain bikers, skiers, paddlers and climbers from around the globe.
The tour is hot on the heels of the largest and most prestigious mountain festivals in the world, the Banff Mountain Festival, which takes place every November in the mountain town of Banff, in Canada.
More than 300 of the world's best mountain sport, culture, environment, adventure, and exploration films are shown during the week-long event. A selection of award winners and audience favourites then tours the globe, visiting 390 communities and 35 countries as part of the festival's official world tour.
This year, the Australian line-up features two-and-a-half hours of captivating short films shot in some of the most wild and remote corners of the world. The program is packed full of mesmerising cinematography, thought-provoking storylines and adrenaline-inducing action sequences.
The original and the best mountain film festival is presented by World Expeditions, and will be screening at the Hayden Orpheum Picture Palace.
For more details visit www.banffaustralia.com.au
SORRY NO REFUNDS
Should this event be postponed due to COVID restrictions ticket holders will be offered the choice of a full refund or their tickets will be automatically moved to the new screening date.
(Wednesday) 7:00 pm - 10:00 pm
(Thursday) 7:00 pm - 10:00 pm
(Friday) 7:00 pm - 10:00 pm
12may7:00 pm10:00 pmBanff Mountain Film Festival 2022 - Wollongong 12 May 7pm7:00 pm - 10:00 pm
The original and the best mountain film festival is presented by World Expeditions, and will be screening at UniMovies.
SEATING IS NOT ALLOCATED: Come early for the best seats.
13may7:30 pm10:30 pmBanff Mountain Film Festival 2022 - Avoca Beach 13 May 7pm7:30 pm - 10:30 pm
The original and the best mountain film festival is presented by World Expeditions, and will be screening at the Avoca Beach Theatre in Avoca Beach.


Intensive neurodevelopmental treatment (NDT) significantly improves motor function in children with developmental delays, regardless of whether they have cerebral palsy (CP), a Korean study shows.
The study, "Efficacy of Intensive Neurodevelopmental Treatment for Children With Developmental Delay, With or Without Cerebral Palsy," appeared in the journal Annals of Rehabilitation Medicine.
NDT for children with CP has been widely accepted since 194o — even before acceptance of evidence-based medicine and a thorough understanding of central nervous system development — and forms the basis of CP treatment.
Intensive NDT is more effective because sessions last longer and are more frequent. However, the specific regimen depends on individual hospital settings and family support. Due to the variation in age and severity of CP patients, there is no consensus on which regimen is more effective.
Although previous studies have shown that intensive NDT helps children, these were pilot studies that did not include non-CP children with developmental delays.
This latest study, led by Bum Sun Kwon, MD, of Dongguk University College of Medicine in Goyang, evaluated the effectiveness of in-patient intensive NDT on gross motor function of developmentally delayed children with or without CP.
The group consisted of 42 children whose median age was 5 years old; 24 had CP and 18 did not. None showed much improvement after three months of conventional NDT (once or twice a week for 30 minutes a day). They received intensive NDT three times a week, 60 minutes a day, for three months, followed by conventional NDT for another 3 months.
The researchers assessed gross motor function before the initial conventional NDT, before and after intensive NDT, and after the additional three months of conventional NDT. Unlike previous studies, scientists did not include a rest phase after intensive NDT.
They found that intensive NDT improved gross motor function score, and that the improvement was maintained after the final three months of conventional NDT. Furthermore, researchers observed improvement in kids with and without CP, with similar efficacy.
In addition, the absence rate was lower in intensive NDT than during conventional NDT, "which implies better concentration and compliance to intensive NDT," researchers said.
Among the study's limitations was the lack of a control group with conventional NDT for the duration of the study. Nor did researchers control the time and frequency of occupational therapy and functional activity training programs, which may involve NDT and therefore affect gross motor function scores.
Finally, the study urged fine-tuning the assessment of NDT efficacy, and determining gross motor function beyond three months of intensive NDT to assess long-term effects.
Tagged developmental delay, disability, gross motor function, intensive neurodevelopmental treatment, rehabilitation.
Next:If You Could Cure Your Disability, Would You?