Commit 268c1993 authored by Ken Martin's avatar Ken Martin

More fixes based on test dashboard

This should fix kamino by alowing the software renderer

Should fix compiler warnings on dashlin1
parent 792e8052
......@@ -335,9 +335,13 @@ vtkgl::VBOLayout vtkOpenGLStickMapperCreateVBO(float * points, vtkIdType numPts,
float *orientPtr;
unsigned char *colorPtr;
unsigned char offsets[4];
offsets[3] = 0;
unsigned int selId = 0;
vtkgl::vtkucfloat offsets;
offsets.c[3] = 0;
vtkgl::vtkucfloat selId;
selId.c[0] = 0;
selId.c[1] = 0;
selId.c[2] = 0;
selId.c[3] = 0;
for (vtkIdType i = 0; i < numPts; ++i)
{
......@@ -348,7 +352,11 @@ vtkgl::VBOLayout vtkOpenGLStickMapperCreateVBO(float * points, vtkIdType numPts,
float length = sizes[i*3];
if (selectionIds)
{
selId = static_cast<unsigned int>(selectionIds[i]) + 1;
vtkIdType thisId = selectionIds[i] + 1;
selId.c[0] = thisId % 256;
selId.c[1] = (thisId >> 8) % 256;
selId.c[2] = (thisId >> 16) % 256;
selId.c[3] = 0;
}
// Vertices
......@@ -359,14 +367,14 @@ vtkgl::VBOLayout vtkOpenGLStickMapperCreateVBO(float * points, vtkIdType numPts,
*(it++) = orientPtr[0]*length;
*(it++) = orientPtr[1]*length;
*(it++) = orientPtr[2]*length;
offsets[0] = 0;
offsets[1] = 0;
offsets[2] = 0;
*(it++) = *reinterpret_cast<float *>(offsets);
offsets.c[0] = 0;
offsets.c[1] = 0;
offsets.c[2] = 0;
*(it++) = offsets.f;
*(it++) = radius;
if (selectionIds)
{
*(it++) = *reinterpret_cast<float *>(&selId);
*(it++) = selId.f;
}
*(it++) = pointPtr[0];
......@@ -376,14 +384,14 @@ vtkgl::VBOLayout vtkOpenGLStickMapperCreateVBO(float * points, vtkIdType numPts,
*(it++) = orientPtr[0]*length;
*(it++) = orientPtr[1]*length;
*(it++) = orientPtr[2]*length;
offsets[0] = 1;
offsets[1] = 0;
offsets[2] = 0;
*(it++) = *reinterpret_cast<float *>(offsets);
offsets.c[0] = 1;
offsets.c[1] = 0;
offsets.c[2] = 0;
*(it++) = offsets.f;
*(it++) = radius;
if (selectionIds)
{
*(it++) = *reinterpret_cast<float *>(&selId);
*(it++) = selId.f;
}
*(it++) = pointPtr[0];
......@@ -393,14 +401,14 @@ vtkgl::VBOLayout vtkOpenGLStickMapperCreateVBO(float * points, vtkIdType numPts,
*(it++) = orientPtr[0]*length;
*(it++) = orientPtr[1]*length;
*(it++) = orientPtr[2]*length;
offsets[0] = 1;
offsets[1] = 0;
offsets[2] = 1;
*(it++) = *reinterpret_cast<float *>(offsets);
offsets.c[0] = 1;
offsets.c[1] = 0;
offsets.c[2] = 1;
*(it++) = offsets.f;
*(it++) = radius;
if (selectionIds)
{
*(it++) = *reinterpret_cast<float *>(&selId);
*(it++) = selId.f;
}
*(it++) = pointPtr[0];
......@@ -410,14 +418,14 @@ vtkgl::VBOLayout vtkOpenGLStickMapperCreateVBO(float * points, vtkIdType numPts,
*(it++) = orientPtr[0]*length;
*(it++) = orientPtr[1]*length;
*(it++) = orientPtr[2]*length;
offsets[0] = 0;
offsets[1] = 0;
offsets[2] = 1;
*(it++) = *reinterpret_cast<float *>(offsets);
offsets.c[0] = 0;
offsets.c[1] = 0;
offsets.c[2] = 1;
*(it++) = offsets.f;
*(it++) = radius;
if (selectionIds)
{
*(it++) = *reinterpret_cast<float *>(&selId);
*(it++) = selId.f;
}
*(it++) = pointPtr[0];
......@@ -427,14 +435,14 @@ vtkgl::VBOLayout vtkOpenGLStickMapperCreateVBO(float * points, vtkIdType numPts,
*(it++) = orientPtr[0]*length;
*(it++) = orientPtr[1]*length;
*(it++) = orientPtr[2]*length;
offsets[0] = 1;
offsets[1] = 1;
offsets[2] = 1;
*(it++) = *reinterpret_cast<float *>(offsets);
offsets.c[0] = 1;
offsets.c[1] = 1;
offsets.c[2] = 1;
*(it++) = offsets.f;
*(it++) = radius;
if (selectionIds)
{
*(it++) = *reinterpret_cast<float *>(&selId);
*(it++) = selId.f;
}
*(it++) = pointPtr[0];
......@@ -444,14 +452,14 @@ vtkgl::VBOLayout vtkOpenGLStickMapperCreateVBO(float * points, vtkIdType numPts,
*(it++) = orientPtr[0]*length;
*(it++) = orientPtr[1]*length;
*(it++) = orientPtr[2]*length;
offsets[0] = 0;
offsets[1] = 1;
offsets[2] = 1;
*(it++) = *reinterpret_cast<float *>(offsets);
offsets.c[0] = 0;
offsets.c[1] = 1;
offsets.c[2] = 1;
*(it++) = offsets.f;
*(it++) = radius;
if (selectionIds)
{
*(it++) = *reinterpret_cast<float *>(&selId);
*(it++) = selId.f;
}
}
vertexBuffer.Upload(packedVBO, vtkgl::BufferObject::ArrayBuffer);
......
......@@ -319,25 +319,25 @@ void vtkOpenGLContextDevice2D::BuildVBO(
std::vector<float> va;
va.resize(nv*stride);
unsigned char c[4];
vtkgl::vtkucfloat c;
for (int i = 0; i < nv; i++)
{
va[i*stride] = f[i*2];
va[i*stride+1] = f[i*2+1];
if (colors)
{
c[0] = colors[nc*i];
c[1] = colors[nc*i+1];
c[2] = colors[nc*i+2];
c.c[0] = colors[nc*i];
c.c[1] = colors[nc*i+1];
c.c[2] = colors[nc*i+2];
if (nc == 4)
{
c[3] = colors[nc*i+3];
c.c[3] = colors[nc*i+3];
}
else
{
c[3] = 255;
c.c[3] = 255;
}
va[i*stride+cOffset] = *reinterpret_cast<float *>(c);
va[i*stride+cOffset] = c.f;
}
if (tcoords)
{
......
......@@ -208,7 +208,7 @@ void vtkOpenGLContextDevice3D::BuildVBO(
std::vector<float> va;
va.resize(nv*stride);
unsigned char c[4];
vtkgl::vtkucfloat c;
for (int i = 0; i < nv; i++)
{
va[i*stride] = f[i*3];
......@@ -216,18 +216,18 @@ void vtkOpenGLContextDevice3D::BuildVBO(
va[i*stride+2] = f[i*3+2];
if (colors)
{
c[0] = colors[nc*i];
c[1] = colors[nc*i+1];
c[2] = colors[nc*i+2];
c.c[0] = colors[nc*i];
c.c[1] = colors[nc*i+1];
c.c[2] = colors[nc*i+2];
if (nc == 4)
{
c[3] = colors[nc*i+3];
c.c[3] = colors[nc*i+3];
}
else
{
c[3] = 255;
c.c[3] = 255;
}
va[i*stride+cOffset] = *reinterpret_cast<float *>(c);
va[i*stride+cOffset] = c.f;
}
if (tcoords)
{
......
......@@ -888,7 +888,8 @@ void vtkCocoaRenderWindow::CreateGLContext()
attribs[i++] = NSOpenGLPFAOpenGLProfile;
attribs[i++] = NSOpenGLProfileVersion3_2Core;
attribs[i++] = NSOpenGLPFAAccelerated;
// OSX always preferrs an accelerated context
// attribs[i++] = NSOpenGLPFAAccelerated;
attribs[i++] = NSOpenGLPFADepthSize;
attribs[i++] = (NSOpenGLPixelFormatAttribute)32;
......
......@@ -106,12 +106,12 @@ void TemplatedAppendVBO3(VBOLayout &layout,
}
else
{
unsigned char c[4];
c[0] = *(colorPtr++);
c[1] = *(colorPtr++);
c[2] = *(colorPtr);
c[3] = 255;
*(it++) = *reinterpret_cast<float *>(c);
vtkucfloat c;
c.c[0] = *(colorPtr++);
c.c[1] = *(colorPtr++);
c.c[2] = *(colorPtr);
c.c[3] = 255;
*(it++) = c.f;
}
}
}
......
......@@ -34,6 +34,14 @@ class vtkWindow;
namespace vtkgl
{
// useful union for stuffing colors into a float
union vtkucfloat
{
unsigned char c[4];
float f;
};
// Process the string, and return a version with replacements.
std::string VTKRENDERINGOPENGL2_EXPORT replace(std::string source,
const std::string &search,
......
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