Commit 32f5c668 authored by Ken Martin's avatar Ken Martin

fix a number of dashbaord issues

Change-Id: Id7896004671988f0e8ab5026501bb9699011536f
parent 78e6ada9
......@@ -96,8 +96,6 @@ set_source_files_properties(
vtkglVBOHelper
vtkglVertexArrayObject
vtkFrameBufferObject
vtkOpenGLImageMapper
vtkOpenGLImageSliceMapper
vtkOpenGLGlyph3DHelper
vtkOpenGLGlyph3DMapper
vtkOpenGLHardwareSelector
......
......@@ -113,7 +113,6 @@ protected:
bool Done; // is the event loop done running
//BTX
// Description:
// Class variables so an exit method can be defined for this class
// (used to set different exit methods for various language bindings,
......@@ -121,7 +120,6 @@ protected:
static void (*ClassExitMethod)(void *);
static void (*ClassExitMethodArgDelete)(void *);
static void *ClassExitMethodArg;
//ETX
// Description:
// Win32-specific internal timer methods. See the superclass for detailed
......
......@@ -107,7 +107,6 @@ protected:
void SetTimerDictionary(void *dictionary); // Really an NSMutableDictionary*
void *GetTimerDictionary();
//BTX
// Description:
// Class variables so an exit method can be defined for this class
// (used to set different exit methods for various language bindings,
......@@ -115,7 +114,6 @@ protected:
static void (*ClassExitMethod)(void *);
static void (*ClassExitMethodArgDelete)(void *);
static void *ClassExitMethodArg;
//ETX
// Description:
// Cocoa-specific internal timer methods. See the superclass for detailed
......
......@@ -29,9 +29,7 @@
#include "vtkRenderingOpenGL2Module.h" // For export macro
#include "vtkSmartPointer.h" // needed for vtkSmartPointer.
#include "vtkWeakPointer.h" // needed for vtkWeakPointer.
//BTX
#include <vector> // for the lists of logical buffers.
//ETX
class vtkRenderWindow;
class vtkTextureObject;
......@@ -165,7 +163,6 @@ public:
// prints detected errors to vtkErrorMacro.
int CheckFrameBufferStatus(unsigned int mode);
//BTX
protected:
// Description:
// Load all necessary extensions.
......@@ -242,7 +239,6 @@ protected:
private:
vtkFrameBufferObject(const vtkFrameBufferObject&); // Not implemented.
void operator=(const vtkFrameBufferObject&); // Not implemented.
//ETX
};
#endif
......@@ -55,7 +55,6 @@ public:
virtual void ReleaseGraphicsResources(vtkWindow *window);
protected:
//BTX
vtkOpenGLGlyph3DMapper();
~vtkOpenGLGlyph3DMapper();
......@@ -85,8 +84,6 @@ private:
void operator=(const vtkOpenGLGlyph3DMapper&); // Not implemented.
virtual void Render(vtkRenderer*, vtkActor*, vtkDataSet*);
//ETX
};
#endif
......@@ -1187,7 +1187,8 @@ void vtkOpenGLPolyDataMapper::UpdateVBO(vtkActor *act)
{
this->Tris.indexCount = CreateTriangleIndexBuffer(prims[2],
this->Tris.ibo,
poly->GetPoints());
poly->GetPoints(),
cellPointMap);
this->TriStrips.indexCount = CreateMultiIndexBuffer(prims[3],
this->TriStrips.ibo,
this->TriStrips.offsetArray,
......
......@@ -519,8 +519,9 @@ void vtkOpenGLPolyDataMapper2D::UpdateVBO(vtkActor2D *act, vtkViewport *viewport
this->Lines.offsetArray,
this->Lines.elementsArray, false);
this->Tris.indexCount = CreateTriangleIndexBuffer(prims[2],
this->Tris.ibo,
poly->GetPoints());
this->Tris.ibo,
poly->GetPoints(),
cellPointMap);
this->TriStrips.indexCount = CreateMultiIndexBuffer(prims[3],
this->TriStrips.ibo,
this->TriStrips.offsetArray,
......
......@@ -38,7 +38,6 @@ public:
// Implement base class method.
void BackfaceRender(vtkActor *a, vtkRenderer *ren);
//BTX
// Description:
// This method is called after the actor has been rendered.
// Don't call this directly. This method cleans up
......
......@@ -1436,67 +1436,12 @@ int vtkOpenGLRenderWindow::SetZbufferData( int x1, int y1, int x2, int y2,
return this->SetZbufferData(x1, y1, x2, y2, buffer->GetPointer(0));
}
int vtkOpenGLRenderWindow::SetZbufferData( int x1, int y1, int x2, int y2,
int vtkOpenGLRenderWindow::SetZbufferData( int vtkNotUsed(x1), int vtkNotUsed(y1),
int vtkNotUsed(x2), int vtkNotUsed(y2),
float *vtkNotUsed(buffer) )
{
int y_low;
int x_low;
//int width, height;
// set the current window
this->MakeCurrent();
if (y1 < y2)
{
y_low = y1;
}
else
{
y_low = y2;
}
if (x1 < x2)
{
x_low = x1;
}
else
{
x_low = x2;
}
//width = abs(x2 - x1)+1;
//height = abs(y2 - y1)+1;
// Error checking
// Must clear previous errors first.
while(glGetError() != GL_NO_ERROR)
{
;
}
/*
glViewport(0, 0, this->Size[0], this->Size[1]);
glRasterPos2f( 2.0 * static_cast<GLfloat>(x_low) / this->Size[0] - 1,
2.0 * static_cast<GLfloat>(y_low) / this->Size[1] - 1);
glDisable( GL_SCISSOR_TEST );
glPixelStorei( GL_PACK_ALIGNMENT, 1 );
glDrawPixels( width, height, GL_DEPTH_COMPONENT, GL_FLOAT, buffer); // TODO replace
*/
// This seems to be necessary for the image to show up
glFlush();
if (glGetError() != GL_NO_ERROR)
{
return VTK_ERROR;
}
else
{
return VTK_OK;
}
// Todo: not sure this can be done in the new opengl, either implement or remove
return VTK_ERROR;
}
......@@ -1556,12 +1501,8 @@ int vtkOpenGLRenderWindow::GetTextureUnitForTexture(vtkTextureObject *texture)
// \pre not_initialized: !OffScreenUseFrameBuffer
// \post valid_result: (result==0 || result==1)
// && (result implies OffScreenUseFrameBuffer)
int vtkOpenGLRenderWindow::CreateHardwareOffScreenWindow(int width, int height)
int vtkOpenGLRenderWindow::CreateHardwareOffScreenWindow(int vtkNotUsed(width), int vtkNotUsed(height))
{
assert("pre: positive_width" && width>0);
assert("pre: positive_height" && height>0);
assert("pre: not_initialized" && !this->OffScreenUseFrameBuffer);
// TODO: write this
return 0;
......
......@@ -188,12 +188,10 @@ public:
// Returns an Shader Cache object
vtkGetObjectMacro(ShaderCache,vtkOpenGLShaderCache);
//BTX
// Description:
// Returns its texture unit manager object. A new one will be created if one
// hasn't already been set up.
vtkOpenGLTextureUnitManager *GetTextureUnitManager();
//ETX
// Description:
// Block the thread until the actual rendering is finished().
......@@ -208,9 +206,7 @@ protected:
long OldMonitorSetting;
//BTX
std::map<const vtkTextureObject *, int> TextureResourceIds;
//ETX
int GetPixelData(int x, int y, int x2, int y2, int front, unsigned char* data);
int GetRGBAPixelData(int x, int y, int x2, int y2, int front, float* data);
......
......@@ -479,9 +479,9 @@ void vtkOpenGLRenderer::DeviceRenderTranslucentPolygonalGeometry()
// return false otherwise returns true. Also if layer==0 and no prop have
// been rendered (there is no translucent geometry), it returns false.
// \pre positive_layer: layer>=0
int vtkOpenGLRenderer::RenderPeel(int layer)
int vtkOpenGLRenderer::RenderPeel(int vtkNotUsed(layer))
{
assert("pre: positive_layer" && layer>=0);
// assert("pre: positive_layer" && layer>=0);
return 0;
}
......
......@@ -86,7 +86,6 @@ protected:
// Internal method to release graphics resources in any derived renderers.
virtual void ReleaseGraphicsResources(vtkWindow *w);
//BTX
// Picking functions to be implemented by sub-classes
virtual void DevicePickRender();
virtual void StartPick(unsigned int pickFromSize);
......@@ -99,7 +98,6 @@ protected:
// Ivars used in picking
class vtkGLPickInfo* PickInfo;
//ETX
double PickedZ;
......@@ -110,12 +108,10 @@ protected:
// \pre positive_layer: layer>=0
int RenderPeel(int layer);
//BTX
friend class vtkOpenGLProperty;
friend class vtkOpenGLTexture;
friend class vtkOpenGLImageSliceMapper;
friend class vtkOpenGLImageResliceMapper;
//ETX
// Description:
// This flag is on if the current OpenGL context supports extensions
......@@ -127,9 +123,7 @@ protected:
// technique have been checked.
int DepthPeelingIsSupportedChecked;
vtkTexturedActor2D *DepthPeelingActor;
//BTX
std::vector<float> *DepthZData;
//ETX
vtkTextureObject *OpaqueZTexture;
vtkTextureObject *OpaqueRGBATexture;
......
......@@ -22,9 +22,7 @@
#include "vtkRenderingOpenGL2Module.h" // For export macro
#include "vtkTexture.h"
//BTX
#include "vtkWeakPointer.h" // needed for vtkWeakPointer.
//ETX
class vtkRenderWindow;
class vtkTextureObject;
......@@ -77,7 +75,6 @@ public:
int GetTextureUnit();
protected:
//BTX
vtkOpenGLTexture();
~vtkOpenGLTexture();
......@@ -98,8 +95,6 @@ protected:
private:
vtkOpenGLTexture(const vtkOpenGLTexture&); // Not implemented.
void operator=(const vtkOpenGLTexture&); // Not implemented.
//ETX
};
#endif
......@@ -41,7 +41,6 @@ class VTKRENDERINGOPENGL2_EXPORT vtkPixelBufferObject : public vtkObject
{
public:
//BTX
// Usage values.
enum
{
......@@ -56,7 +55,6 @@ public:
DynamicCopy,
NumberOfUsages
};
//ETX
static vtkPixelBufferObject* New();
vtkTypeMacro(vtkPixelBufferObject, vtkObject);
......@@ -259,7 +257,6 @@ public:
void UnmapPackedBuffer()
{ this->UnmapBuffer(PACKED_BUFFER); }
//BTX
// PACKED_BUFFER for download APP<-PBO
// UNPACKED_BUFFER for upload APP->PBO
enum BufferType{
......@@ -308,8 +305,6 @@ public:
// Extension will be loaded when the conetxt is set.
static bool IsSupported(vtkRenderWindow* renWin);
//ETX
//BTX
protected:
vtkPixelBufferObject();
~vtkPixelBufferObject();
......@@ -337,7 +332,6 @@ protected:
private:
vtkPixelBufferObject(const vtkPixelBufferObject&); // Not implemented.
void operator=(const vtkPixelBufferObject&); // Not implemented.
//ETX
};
#endif
......@@ -59,9 +59,9 @@ void vtkRenderPass::UpdateCamera(vtkRenderer *renderer)
// Description:
// Call ClearLights() on Renderer. See note about UpdateCamera().
// \pre renderer_exists: renderer!=0
void vtkRenderPass::ClearLights(vtkRenderer *renderer)
void vtkRenderPass::ClearLights(vtkRenderer *vtkNotUsed(renderer))
{
assert("pre: renderer_exists" && renderer != 0);
// assert("pre: renderer_exists" && renderer != 0);
/// FIXME: What to do if there is no clear lights? Remove this API?
//vtkOpenGLRenderer *oRenderer = vtkOpenGLRenderer::SafeDownCast(renderer);
//oRenderer->ClearLights();
......
......@@ -55,13 +55,11 @@ class VTKRENDERINGOPENGL2_EXPORT vtkRenderPass : public vtkObject
vtkTypeMacro(vtkRenderPass,vtkObject);
void PrintSelf(ostream& os, vtkIndent indent);
//BTX
// Description:
// Perform rendering according to a render state \p s.
// It modifies NumberOfRenderedProps.
// \pre s_exists: s!=0
virtual void Render(const vtkRenderState *s)=0;
//ETX
// Description:
// Number of props rendered at the last Render call.
......
......@@ -35,7 +35,6 @@ class VTKRENDERINGOPENGL2_EXPORT vtkTextureObject : public vtkObject
{
public:
//BTX
// DepthTextureCompareFunction values.
enum
{
......@@ -90,8 +89,6 @@ public:
NumberOfDepthFormats
};
//ETX
static vtkTextureObject* New();
vtkTypeMacro(vtkTextureObject, vtkObject);
void PrintSelf(ostream& os, vtkIndent indent);
......@@ -505,7 +502,6 @@ public:
//BTX
protected:
vtkTextureObject();
~vtkTextureObject();
......@@ -569,7 +565,6 @@ protected:
private:
vtkTextureObject(const vtkTextureObject&); // Not implemented.
void operator=(const vtkTextureObject&); // Not implemented.
//ETX
};
#endif
......@@ -111,7 +111,6 @@ public:
// Sets the HWND id of the window that WILL BE created.
void SetParentInfo(char *);
//BTX
virtual void *GetGenericDisplayId() {return (void *)this->ContextId;};
virtual void *GetGenericWindowId() {return (void *)this->WindowId;};
virtual void *GetGenericParentId() {return (void *)this->ParentId;};
......@@ -151,8 +150,6 @@ public:
// parent.
virtual void SetNextWindowId(void *arg);
//ETX
// Description:
// Prescribe that the window be created in a stereo-capable mode. This
// method must be called before the window is realized. This method
......@@ -254,14 +251,12 @@ protected:
int CreatingOffScreenWindow; // to avoid recursion (and memory leaks...)
//BTX
// message handler
virtual LRESULT MessageProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam);
static LRESULT APIENTRY WndProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam);
//ETX
int CursorHidden;
int ForceMakeCurrent;
......
......@@ -81,7 +81,6 @@ public:
// ExitMethod for alternative behavior (i.e. suppression of keyboard exit)
void TerminateApp(void);
//BTX
friend VTKRENDERINGOPENGL2_EXPORT LRESULT CALLBACK vtkHandleMessage(HWND hwnd,UINT uMsg, WPARAM w, LPARAM l);
friend VTKRENDERINGOPENGL2_EXPORT LRESULT CALLBACK vtkHandleMessage2(HWND hwnd,UINT uMsg, WPARAM w, LPARAM l, vtkWin32OpenGLRenderWindowInteractor *me);
......@@ -106,7 +105,6 @@ public:
virtual void OnFocus(HWND wnd, UINT nFlags);
virtual void OnKillFocus(HWND wnd, UINT nFlags);
virtual void OnTouch(HWND wnd, UINT wParam, UINT lParam);
//ETX
// Description:
// Methods to set the default exit method for the class. This method is
......@@ -131,7 +129,6 @@ protected:
int MouseInWindow;
int StartedMessageLoop;
//BTX
// Description:
// Class variables so an exit method can be defined for this class
// (used to set different exit methods for various language bindings,
......@@ -139,7 +136,6 @@ protected:
static void (*ClassExitMethod)(void *);
static void (*ClassExitMethodArgDelete)(void *);
static void *ClassExitMethodArg;
//ETX
// Description:
// Win32-specific internal timer methods. See the superclass for detailed
......
......@@ -41,11 +41,9 @@
class vtkCallbackCommand;
class vtkXOpenGLRenderWindowInteractorInternals;
//BTX
// Forward declare internal friend functions.
void VTKRENDERINGOPENGL2_EXPORT vtkXOpenGLRenderWindowInteractorCallback(Widget,XtPointer, XEvent *,Boolean *);
void VTKRENDERINGOPENGL2_EXPORT vtkXOpenGLRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
//ETX
class VTKRENDERINGOPENGL2_EXPORT vtkXOpenGLRenderWindowInteractor : public vtkRenderWindowInteractor
{
......
......@@ -15,7 +15,7 @@
#define __vtkglBufferObject_h
#include "vtkRenderingOpenGL2Module.h"
#include <string> // For member variables.
#include "vtkStdString.h" // for std::string
namespace vtkgl {
......
......@@ -282,26 +282,31 @@ std::string replace(std::string source, const std::string &search,
// used to create an IBO for triangle primatives
size_t CreateTriangleIndexBuffer(vtkCellArray *cells, BufferObject &indexBuffer,
vtkPoints *points)
vtkPoints *points, std::vector<unsigned int> &cellPointMap)
{
std::vector<unsigned int> indexArray;
vtkIdType* indices(NULL);
vtkIdType npts(0);
indexArray.reserve(cells->GetNumberOfCells() * 3);
// the folowing are only used if we have to triangulate a polygon
// otherwise they just sit at NULL
vtkPolygon *polygon = NULL;
vtkIdList *tris = NULL;
vtkPoints *triPoints = NULL;
for (cells->InitTraversal(); cells->GetNextCell(npts, indices); )
{
// ignore degenerate triangles
if (npts < 3)
{
exit(-1); // assert(points >= 3);
continue;
}
// triangulate needed
if (npts > 3)
{
// special case for quads which VTK uses a lot
// special case for quads, penta, hex which are common
if (npts == 4)
{
indexArray.push_back(static_cast<unsigned int>(indices[0]));
......@@ -311,19 +316,61 @@ size_t CreateTriangleIndexBuffer(vtkCellArray *cells, BufferObject &indexBuffer,
indexArray.push_back(static_cast<unsigned int>(indices[2]));
indexArray.push_back(static_cast<unsigned int>(indices[3]));
}
else
else if (npts == 5)
{
indexArray.push_back(static_cast<unsigned int>(indices[0]));
indexArray.push_back(static_cast<unsigned int>(indices[1]));
indexArray.push_back(static_cast<unsigned int>(indices[2]));
indexArray.push_back(static_cast<unsigned int>(indices[0]));
indexArray.push_back(static_cast<unsigned int>(indices[2]));
indexArray.push_back(static_cast<unsigned int>(indices[3]));
indexArray.push_back(static_cast<unsigned int>(indices[0]));
indexArray.push_back(static_cast<unsigned int>(indices[3]));
indexArray.push_back(static_cast<unsigned int>(indices[4]));
}
else if (npts == 6)
{
indexArray.push_back(static_cast<unsigned int>(indices[0]));
indexArray.push_back(static_cast<unsigned int>(indices[1]));
indexArray.push_back(static_cast<unsigned int>(indices[2]));
indexArray.push_back(static_cast<unsigned int>(indices[0]));
indexArray.push_back(static_cast<unsigned int>(indices[2]));
indexArray.push_back(static_cast<unsigned int>(indices[3]));
indexArray.push_back(static_cast<unsigned int>(indices[0]));
indexArray.push_back(static_cast<unsigned int>(indices[3]));
indexArray.push_back(static_cast<unsigned int>(indices[5]));
indexArray.push_back(static_cast<unsigned int>(indices[3]));
indexArray.push_back(static_cast<unsigned int>(indices[4]));
indexArray.push_back(static_cast<unsigned int>(indices[5]));
}
else // 7 sided polygon or higher, do a full smart triangulation
{
if (!polygon)
{
polygon = vtkPolygon::New();
tris = vtkIdList::New();
triPoints = vtkPoints::New();
}
vtkIdType *triIndices = new vtkIdType[npts];
triPoints->SetNumberOfPoints(npts);
for (int i = 0; i < npts; ++i)
{
int idx = indices[i];
if (cellPointMap.size() > 0 && cellPointMap[indices[i]] > 0)
{
idx = cellPointMap[indices[i]]-1;
}
triPoints->SetPoint(i,points->GetPoint(idx));
triIndices[i] = i;
}
polygon->Initialize(npts, indices, points);
polygon->Initialize(npts, triIndices, triPoints);
polygon->Triangulate(tris);
for (int j = 0; j < tris->GetNumberOfIds(); ++j)
{
indexArray.push_back(static_cast<unsigned int>(indices[tris->GetId(j)]));
}
delete [] triIndices;
}
}
else
......@@ -337,6 +384,7 @@ size_t CreateTriangleIndexBuffer(vtkCellArray *cells, BufferObject &indexBuffer,
{
polygon->Delete();
tris->Delete();
triPoints->Delete();
}
indexBuffer.Upload(indexArray, vtkgl::BufferObject::ElementArrayBuffer);
return indexArray.size();
......
......@@ -38,7 +38,7 @@ std::string replace(std::string source, const std::string &search,
// used to create an IBO for triangle primatives
size_t CreateTriangleIndexBuffer(vtkCellArray *cells, BufferObject &indexBuffer,
vtkPoints *points);
vtkPoints *points, std::vector<unsigned int> &cellPointMap);
// used to create an IBO for point primatives
size_t CreatePointIndexBuffer(vtkCellArray *cells, BufferObject &indexBuffer);
......
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