Commit b7ebbcb4 authored by schultezub's avatar schultezub

Various fixes for 64bit compatibility

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@478 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent d28eac80
......@@ -175,7 +175,7 @@ namespace campvis {
if (repLocal != 0) {
float mins = _intensityDomain.x;
float maxs = _intensityDomain.y;
size_t numBuckets = std::min(WeaklyTypedPointer::numBytes(repLocal->getWeaklyTypedPointer()._baseType) << 8, 512U);
size_t numBuckets = std::min(WeaklyTypedPointer::numBytes(repLocal->getWeaklyTypedPointer()._baseType) << 8, static_cast<size_t>(512));
_intensityHistogram = new IntensityHistogramType(&mins, &maxs, &numBuckets);
tbb::parallel_for(tbb::blocked_range<size_t>(0, repLocal->getNumElements()), IntensityHistogramGenerator(repLocal, _intensityHistogram));
}
......
......@@ -122,9 +122,9 @@ namespace campvis {
LGL_ERROR;
if (_vertices.size() > 2)
glDrawArrays(GL_POLYGON, 0, _vertices.size());
glDrawArrays(GL_POLYGON, 0, static_cast<GLsizei>(_vertices.size()));
else
glDrawArrays(GL_LINES, 0, _vertices.size());
glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(_vertices.size()));
LGL_ERROR;
}
......
......@@ -100,9 +100,9 @@ namespace campvis {
vao.addVertexAttribute(tgt::VertexArrayObject::NormalsAttribute, _normalsBuffer);
LGL_ERROR;
size_t startIndex = 0;
GLint startIndex = 0;
for (std::vector<FaceGeometry>::const_iterator it = _faces.begin(); it != _faces.end(); ++it) {
size_t numVertices = it->getVertices().size();
GLsizei numVertices = static_cast<GLsizei>(it->getVertices().size());
if (numVertices > 2)
glDrawArrays(GL_POLYGON, startIndex, numVertices);
else
......
......@@ -113,7 +113,7 @@ namespace campvis {
const std::string& name,
const std::string& title,
const GenericOption<T>* options,
size_t count,
int count,
int invalidationLevel = AbstractProcessor::INVALID_RESULT);
/**
......@@ -155,7 +155,7 @@ namespace campvis {
* Sets the selected option to the option with the given index.
* \param index Index of the option to select in the option array.
*/
void selectByIndex(size_t index);
void selectByIndex(int index);
protected:
std::vector< GenericOption<T> > _options;
......@@ -164,7 +164,7 @@ namespace campvis {
// = Template Implementation ======================================================================
template<typename T>
campvis::GenericOptionProperty<T>::GenericOptionProperty(const std::string& name, const std::string& title, const GenericOption<T>* options, size_t count, int invalidationLevel /*= AbstractProcessor::INVALID_RESULT*/)
campvis::GenericOptionProperty<T>::GenericOptionProperty(const std::string& name, const std::string& title, const GenericOption<T>* options, int count, int invalidationLevel /*= AbstractProcessor::INVALID_RESULT*/)
: AbstractOptionProperty(name, title, invalidationLevel)
{
tgtAssert(options != 0, "Pointer to options array must not be 0.")
......@@ -217,7 +217,7 @@ namespace campvis {
}
template<typename T>
void campvis::GenericOptionProperty<T>::selectByIndex(size_t index) {
void campvis::GenericOptionProperty<T>::selectByIndex(int index) {
tgtAssert(index > 0 && index < _options.size(), "Index out of bounds.");
setValue(index);
}
......
......@@ -8,7 +8,7 @@ namespace tgt {
const std::string VertexAttribute::loggerCat_ = "tgt.VertexAttribute";
VertexAttribute::VertexAttribute(size_t index, BufferObject* bufferObject, size_t stride, size_t offset)
VertexAttribute::VertexAttribute(GLuint index, BufferObject* bufferObject, GLsizei stride, size_t offset)
: _index(index)
, _stride(stride)
, _offset(offset)
......@@ -19,7 +19,7 @@ namespace tgt {
_bufferObject->bindToVertexAttribute(this);
// Todo: implement normalized flag if needed
_bufferObject->bind();
glVertexAttribPointer(_index, _bufferObject->getElementSize(), _bufferObject->getBaseType(), false, _stride, reinterpret_cast<void*>(_offset));
glVertexAttribPointer(_index, static_cast<GLint>(_bufferObject->getElementSize()), _bufferObject->getBaseType(), false, _stride, reinterpret_cast<void*>(_offset));
}
VertexAttribute::~VertexAttribute() {
......@@ -70,7 +70,7 @@ namespace tgt {
// }
}
size_t VertexArrayObject::addVertexAttribute(AttributeType attributeType, BufferObject* bufferObject, size_t stride /*= 0*/, size_t offset /*= 0*/, bool enableNow /*= true*/) {
size_t VertexArrayObject::addVertexAttribute(AttributeType attributeType, BufferObject* bufferObject, GLsizei stride /*= 0*/, size_t offset /*= 0*/, bool enableNow /*= true*/) {
if (_attributes.size() > 16) {
// TODO: The better way would be to check glGet(GL_MAX_VERTEX_ATTRIBS), but the standard says 16 is the minimum
// number to be supported and that should be enough and I currently feel lazy. If you're reading this,
......@@ -86,7 +86,7 @@ namespace tgt {
// bind and create VertexAttribute
bind();
size_t index = _attributes.size();
_attributes.push_back(VertexAttribute(index, bufferObject, stride, offset));
_attributes.push_back(VertexAttribute(static_cast<GLuint>(index), bufferObject, stride, offset));
// add to attribute-type map
if (attributeType != UnspecifiedAttribute)
......@@ -99,18 +99,18 @@ namespace tgt {
return index;
}
void VertexArrayObject::updateVertexAttribute(size_t index, BufferObject* bufferObject, size_t stride /*= 0*/, size_t offset /*= 0*/) {
void VertexArrayObject::updateVertexAttribute(size_t index, BufferObject* bufferObject, GLsizei stride /*= 0*/, size_t offset /*= 0*/) {
tgtAssert(index < _attributes.size(), "Index out of bounds.");
bind();
_attributes[index] = VertexAttribute(index, bufferObject, stride, offset);
_attributes[index] = VertexAttribute(static_cast<GLuint>(index), bufferObject, stride, offset);
}
void VertexArrayObject::enableVertexAttribute(size_t index) {
tgtAssert(index < _enabledAttributes.size(), "Index out of bounds.");
bind();
glEnableVertexAttribArray(index);
glEnableVertexAttribArray(static_cast<GLuint>(index));
_enabledAttributes[index] = true;
}
......@@ -123,7 +123,7 @@ namespace tgt {
tgtAssert(index < _enabledAttributes.size(), "Index out of bounds.");
bind();
glDisableVertexAttribArray(index);
glDisableVertexAttribArray(static_cast<GLuint>(index));
_enabledAttributes[index] = false;
}
......
......@@ -37,10 +37,10 @@ namespace tgt {
* \param index Index of the generic vertex attribute to be modified.
* \param bufferObject BufferObject to bind
*/
VertexAttribute(size_t index, BufferObject* bufferObject, size_t stride, size_t offset);
VertexAttribute(GLuint index, BufferObject* bufferObject, GLsizei stride, size_t offset);
size_t _index; ///< Index of the generic vertex attribute to be modified.
size_t _stride; ///< Specifies the byte offset between consecutive generic vertex attributes.
GLuint _index; ///< Index of the generic vertex attribute to be modified.
GLsizei _stride; ///< Specifies the byte offset between consecutive generic vertex attributes.
size_t _offset; ///< Offset in bytes to the first element in the buffer.
BufferObject* _bufferObject; ///< BufferObject that is bound to this VertexAttribute.
......@@ -100,7 +100,7 @@ namespace tgt {
* \param offset
* \return
*/
size_t addVertexAttribute(AttributeType attributeType, BufferObject* bufferObject, size_t stride = 0, size_t offset = 0, bool enable = true);
size_t addVertexAttribute(AttributeType attributeType, BufferObject* bufferObject, GLsizei stride = 0, size_t offset = 0, bool enable = true);
/**
*
......@@ -109,7 +109,7 @@ namespace tgt {
* \param stride
* \param offset
*/
void updateVertexAttribute(size_t index, BufferObject* bufferObject, size_t stride = 0, size_t offset = 0);
void updateVertexAttribute(size_t index, BufferObject* bufferObject, GLsizei stride = 0, size_t offset = 0);
/**
* Enables the VertexAttribute with the given index in the OpenGL client state.
......@@ -151,7 +151,7 @@ namespace tgt {
*/
static void initStaticMembers();
size_t _id; ///< Id of the internal OpenGL handle to the VAO.
GLuint _id; ///< Id of the internal OpenGL handle to the VAO.
std::vector<VertexAttribute> _attributes; ///< List of all VertexAttributes of this VAO.
std::vector<bool> _enabledAttributes; ///< List of the enabled VertexAttributes.
std::map<AttributeType, size_t> _attributeTypeMap; ///< Map of the AttributeTypes to their indices in the VertexAttributes list.
......
......@@ -162,7 +162,7 @@ namespace campvis {
p_transferFunction.getTF()->setImageHandle(img);
const tgt::svec3& imgSize = static_cast<const ImageData*>(img.getData())->getSize();
if (p_sliceNumber.getMaxValue() != imgSize.z - 1){
p_sliceNumber.setMaxValue(imgSize.z - 1);
p_sliceNumber.setMaxValue(static_cast<int>(imgSize.z) - 1);
}
p_use3DTexture.setValue(static_cast<const ImageData*>(img.getData())->getDimensionality() == 3);
}
......
......@@ -84,7 +84,7 @@ namespace campvis {
bool binary = false;
std::string url;
size_t dimensionality = 3;
tgt::svec3 size(0U);
tgt::svec3 size(static_cast<size_t>(0));
tgt::vec3 voxelSize(1.f);
tgt::vec3 imageOffset(0.f);
......
......@@ -66,13 +66,13 @@ namespace campvis {
if (img != 0) {
if (img->getDimensionality() == 3) {
if (img.getDataHandle().getTimestamp() != _sourceTimestamp) {
p_clipX.setMaxValue(tgt::ivec2(img->getSize().x, img->getSize().x));
p_clipY.setMaxValue(tgt::ivec2(img->getSize().y, img->getSize().y));
p_clipZ.setMaxValue(tgt::ivec2(img->getSize().z, img->getSize().z));
p_clipX.setMaxValue(tgt::ivec2(static_cast<int>(img->getSize().x), static_cast<int>(img->getSize().x)));
p_clipY.setMaxValue(tgt::ivec2(static_cast<int>(img->getSize().y), static_cast<int>(img->getSize().y)));
p_clipZ.setMaxValue(tgt::ivec2(static_cast<int>(img->getSize().z), static_cast<int>(img->getSize().z)));
p_clipX.setValue(tgt::ivec2(0, img->getSize().x));
p_clipY.setValue(tgt::ivec2(0, img->getSize().y));
p_clipZ.setValue(tgt::ivec2(0, img->getSize().z));
p_clipX.setValue(tgt::ivec2(0, static_cast<int>(img->getSize().x)));
p_clipY.setValue(tgt::ivec2(0, static_cast<int>(img->getSize().y)));
p_clipZ.setValue(tgt::ivec2(0, static_cast<int>(img->getSize().z)));
_sourceTimestamp = img.getDataHandle().getTimestamp();
}
tgt::Bounds volumeExtent = img->getWorldBounds(tgt::svec3(p_clipX.getValue().x, p_clipY.getValue().x, p_clipZ.getValue().x), tgt::svec3(p_clipX.getValue().y, p_clipY.getValue().y, p_clipZ.getValue().y));
......
......@@ -128,7 +128,7 @@ namespace campvis {
p_transferFunction.getTF()->setImageHandle(img);
const tgt::svec3& imgSize = static_cast<const ImageData*>(img.getData())->getSize();
if (p_sliceNumber.getMaxValue() != imgSize.z - 1){
p_sliceNumber.setMaxValue(imgSize.z - 1);
p_sliceNumber.setMaxValue(static_cast<int>(imgSize.z) - 1);
}
}
......
......@@ -145,7 +145,7 @@ namespace campvis {
void SliceRenderer3D::updateProperties(const ImageData* img) {
const tgt::svec3& imgSize = img->getSize();
if (p_sliceNumber.getMaxValue() != imgSize.z - 1){
p_sliceNumber.setMaxValue(imgSize.z - 1);
p_sliceNumber.setMaxValue(static_cast<int>(imgSize.z) - 1);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment