overte-thingvellir/interface/src/ui/Sphere3DOverlay.cpp
2014-02-16 12:30:15 -08:00

45 lines
1,018 B
C++

//
// Sphere3DOverlay.cpp
// interface
//
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
//
// include this before QGLWidget, which includes an earlier version of OpenGL
#include "InterfaceConfig.h"
#include <QGLWidget>
#include <SharedUtil.h>
#include "Sphere3DOverlay.h"
Sphere3DOverlay::Sphere3DOverlay() {
}
Sphere3DOverlay::~Sphere3DOverlay() {
}
void Sphere3DOverlay::render() {
if (!_visible) {
return; // do nothing if we're not visible
}
const float MAX_COLOR = 255;
glColor4f(_color.red / MAX_COLOR, _color.green / MAX_COLOR, _color.blue / MAX_COLOR, _alpha);
glDisable(GL_LIGHTING);
glPushMatrix();
glTranslatef(_position.x + _size * 0.5f,
_position.y + _size * 0.5f,
_position.z + _size * 0.5f);
glLineWidth(_lineWidth);
const int slices = 15;
if (_isSolid) {
glutSolidSphere(_size, slices, slices);
} else {
glutWireSphere(_size, slices, slices);
}
glPopMatrix();
}