[vtkusers] How to draw line strips with smoothly varying colors ?
Dingrong Yi
yidingr at cim.mcgill.ca
Tue Jun 20 13:59:58 EDT 2000
Hello,
I want to draw line strips with vtk (basically OpenGL). Each 3D vertex on
the line have a color. I would like to draw lines with smoothly changing
colors between each two vertex. However, I have not a clear pipeline for
doing this.
What I tried is as follows which cause segmentation error. Please help.
Thanks.
Dingrong
#include <stdlib.h>
#include <math.h>
#ifdef _WIN32
#include "vtkWin32OpenGLRenderWindow.h"
#else
#include "vtkOpenGLRenderWindow.h"
#endif
#include "vtkOpenGLRenderer.h"
#include "vtkOpenGLActor.h"
#include <GL/gl.h>
int main()
{
vtkOpenGLRenderWindow *renWin = vtkOpenGLRenderWindow::New();
vtkOpenGLRenderer *ren = vtkOpenGLRenderer::New();
renWin->AddRenderer(ren);
glBegin(GL_LINES);
glVertex3f(0.0,0.0,0.0);
glColor3f(0.0,0.0,1.0);
glVertex3f(1.0,1.0,1.0);
glColor3f(0.0,0.0,1.0);
glEnd();
//ren->AddActor(aObject);
return 0;
}
More information about the vtkusers
mailing list