[Piglit] [PATCH 18/19] glean: Remove syntatic sugar classes from GLUtils.

Kenneth Graunke kenneth at whitecape.org
Mon Dec 31 18:41:07 PST 2012


It turns out these "frequently-used OpenGL operations" weren't used
at all.
---
 tests/glean/glutils.cpp | 157 ------------------------------------------------
 tests/glean/glutils.h   |  42 -------------
 2 files changed, 199 deletions(-)

diff --git a/tests/glean/glutils.cpp b/tests/glean/glutils.cpp
index a7b2542..81be2f0 100644
--- a/tests/glean/glutils.cpp
+++ b/tests/glean/glutils.cpp
@@ -133,163 +133,6 @@ logGLErrors(Environment& env) {
 		env.log << "\tOpenGL error: " << gluErrorString(err) << '\n';
 } // logGLErrors
 
-
-///////////////////////////////////////////////////////////////////////////////
-// Syntactic sugar for light sources
-///////////////////////////////////////////////////////////////////////////////
-
-Light::Light(int l) {
-	lightNumber = static_cast<GLenum>(GL_LIGHT0 + l);
-} // Light::Light
-
-void
-Light::ambient(float r, float g, float b, float a){
-	GLfloat v[4];
-	v[0] = r; v[1] = g; v[2] = b; v[3] = a;
-	glLightfv(lightNumber, GL_AMBIENT, v);
-} // Light::ambient
-
-void
-Light::diffuse(float r, float g, float b, float a){
-	GLfloat v[4];
-	v[0] = r; v[1] = g; v[2] = b; v[3] = a;
-	glLightfv(lightNumber, GL_DIFFUSE, v);
-} // Light::diffuse
-
-void
-Light::specular(float r, float g, float b, float a){
-	GLfloat v[4];
-	v[0] = r; v[1] = g; v[2] = b; v[3] = a;
-	glLightfv(lightNumber, GL_SPECULAR, v);
-} // Light::specular
-
-void
-Light::position(float x, float y, float z, float w){
-	GLfloat v[4];
-	v[0] = x; v[1] = y; v[2] = z; v[3] = w;
-	glLightfv(lightNumber, GL_POSITION, v);
-} // Light::position
-
-void
-Light::spotDirection(float x, float y, float z){
-	GLfloat v[3];
-	v[0] = x; v[1] = y; v[2] = z;
-	glLightfv(lightNumber, GL_SPOT_DIRECTION, v);
-} // Light::spotDirection
-
-void
-Light::spotExponent(float e){
-	glLightf(lightNumber, GL_SPOT_EXPONENT, e);
-} // Light::spotExponent
-
-void
-Light::spotCutoff(float c){
-	glLightf(lightNumber, GL_SPOT_CUTOFF, c);
-} // Light::spotCutoff
-
-void
-Light::constantAttenuation(float a){
-	glLightf(lightNumber, GL_CONSTANT_ATTENUATION, a);
-} // Light::constantAttenuation
-
-void
-Light::linearAttenuation(float a){
-	glLightf(lightNumber, GL_LINEAR_ATTENUATION, a);
-} // Light::linearAttenuation
-
-void
-Light::quadraticAttenuation(float a){
-	glLightf(lightNumber, GL_QUADRATIC_ATTENUATION, a);
-} // Light::quadraticAttenuation
-
-void
-Light::enable() {
-	glEnable(lightNumber);
-} // Light::enable
-
-void
-Light::disable() {
-	glDisable(lightNumber);
-} // Light::disable
-
-///////////////////////////////////////////////////////////////////////////////
-// Syntactic sugar for light model
-///////////////////////////////////////////////////////////////////////////////
-
-LightModel::LightModel() {
-} // LightModel::LightModel
-
-void
-LightModel::ambient(float r, float g, float b, float a) {
-	GLfloat v[4];
-	v[0] = r; v[1] = g; v[2] = b; v[3] = a;
-	glLightModelfv(GL_LIGHT_MODEL_AMBIENT, v);
-} // LightModel::ambient
-
-void
-LightModel::localViewer(bool v) {
-	glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, static_cast<GLint>(v));
-} // LightModel::localViewer
-
-void
-LightModel::twoSide(bool v) {
-	glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, static_cast<GLint>(v));
-} // LightModel::twoSide
-
-void
-LightModel::colorControl(GLenum e) {
-	glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, e);
-} // LightModel::colorControl
-
-///////////////////////////////////////////////////////////////////////////////
-// Syntactic sugar for material properties
-///////////////////////////////////////////////////////////////////////////////
-
-Material::Material(GLenum f) {
-	face = f;
-} // Material::Material
-
-void
-Material::ambient(float r, float g, float b, float a) {
-	GLfloat v[4];
-	v[0] = r; v[1] = g; v[2] = b; v[3] = a;
-	glMaterialfv(face, GL_AMBIENT, v);
-} // Material::ambient
-
-void
-Material::diffuse(float r, float g, float b, float a) {
-	GLfloat v[4];
-	v[0] = r; v[1] = g; v[2] = b; v[3] = a;
-	glMaterialfv(face, GL_DIFFUSE, v);
-} // Material::diffuse
-
-void
-Material::ambientAndDiffuse(float r, float g, float b, float a) {
-	GLfloat v[4];
-	v[0] = r; v[1] = g; v[2] = b; v[3] = a;
-	glMaterialfv(face, GL_AMBIENT_AND_DIFFUSE, v);
-} // Material::ambientAndDiffuse
-
-void
-Material::specular(float r, float g, float b, float a) {
-	GLfloat v[4];
-	v[0] = r; v[1] = g; v[2] = b; v[3] = a;
-	glMaterialfv(face, GL_SPECULAR, v);
-} // Material::specular
-
-void
-Material::emission(float r, float g, float b, float a) {
-	GLfloat v[4];
-	v[0] = r; v[1] = g; v[2] = b; v[3] = a;
-	glMaterialfv(face, GL_EMISSION, v);
-} // Material::emission
-
-void
-Material::shininess(float s) {
-	glMaterialf(face, GL_SHININESS, static_cast<GLfloat>(s));
-} // Material::shininess
-
-
 } // namespace GLUtils
 
 } // namespace GLEAN
diff --git a/tests/glean/glutils.h b/tests/glean/glutils.h
index 34f89da..0015d13 100644
--- a/tests/glean/glutils.h
+++ b/tests/glean/glutils.h
@@ -65,48 +65,6 @@ float getVersion();
 // Check for OpenGL errors and log any that have occurred:
 void logGLErrors(Environment& env);
 
-// Syntactic sugar for dealing with light source parameters:
-class Light {
-	GLenum lightNumber;
-    public:
-	Light(int l);
-	void ambient(float r, float g, float b, float a);
-	void diffuse(float r, float g, float b, float a);
-	void specular(float r, float g, float b, float a);
-	void position(float x, float y, float z, float w);
-	void spotDirection(float x, float y, float z);
-	void spotExponent(float e);
-	void spotCutoff(float c);
-	void constantAttenuation(float a);
-	void linearAttenuation(float a);
-	void quadraticAttenuation(float a);
-	void enable();
-	void disable();
-}; // Light
-
-// Syntactic sugar for dealing with light model:
-class LightModel {
-    public:
-	LightModel();
-	void ambient(float r, float g, float b, float a);
-	void localViewer(bool v);
-	void twoSide(bool v);
-	void colorControl(GLenum e);
-}; // LightModel
-
-// Syntactic sugar for dealing with material properties:
-class Material {
-	GLenum face;
-    public:
-	Material(GLenum f = GL_FRONT_AND_BACK);
-	void ambient(float r, float g, float b, float a);
-	void diffuse(float r, float g, float b, float a);
-	void ambientAndDiffuse(float r, float g, float b, float a);
-	void specular(float r, float g, float b, float a);
-	void emission(float r, float g, float b, float a);
-	void shininess(float s);
-}; // Material
-
 } // namespace GLUtils
 
 } // namespace GLEAN
-- 
1.8.0.3



More information about the Piglit mailing list