Exemplo n.º 1
0
void RenderSystem::init_camera()
{
	//Viewport Infomation
	D3D11_VIEWPORT vp;
	ZeroMemory(&vp, sizeof(D3D11_VIEWPORT));
	vp.TopLeftX = 0;
	vp.TopLeftY = 0;
	vp.Width    = static_cast<FLOAT>(m_ScreenWidth);
	vp.Height   = static_cast<FLOAT>(m_ScreenHeight);
	m_pD3D11DeviceContext->RSSetViewports(1, &vp);

	//MVP Matrix
	XMVECTOR camPos    = XMVectorSet(0.0f, 0.0f, -5.0f, 0.0f);
	XMVECTOR camTarget = XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f);
	XMVECTOR camUp     = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f);
	XMMATRIX View      = XMMatrixLookAtLH(camPos, camTarget, camUp);
	XMMATRIX Proj      = XMMatrixPerspectiveFovLH(0.4f*3.14f, GetAspect(), 1.0f, 1000.0f);
	XMMATRIX Model     = XMMatrixRotationY(60.0f);


	XMStoreFloat4x4(&m_Matrix.model, XMMatrixTranspose(Model) );
	XMStoreFloat4x4(&m_Matrix.view,  XMMatrixTranspose(View) );
	XMStoreFloat4x4(&m_Matrix.proj,  XMMatrixTranspose(Proj) );

}
Exemplo n.º 2
0
void RenderSystem::CheckPick()
{
	float tempDist;
	float closestDist = FLT_MAX;
	int hitIndex;
	float pickedDist = 0;

	XMMATRIX Proj      = XMMatrixPerspectiveFovLH(0.4f*3.14f, GetAspect(), 1.0f, 1000.0f);
	d3dPicking.PickRayVector(m_Camera.GetMouseX(), m_Camera.GetMouseY(), XMLoadFloat4x4(&m_Camera.GetViewMatrix()), Proj);

	//Check if picking the object and mark it
	for (int i = 0; i < 20; i++)
	{
		if (bottleHit[i] == 0) //No need to check bottles already hit
		{
			tempDist = d3dPicking.Pick(bottleModel[i]);
			if (tempDist < closestDist)
			{
				closestDist = tempDist;
				hitIndex = i;
			}
		}
	}

	//We pick a object, and set the closest one be the target object
	if (closestDist < FLT_MAX)
	{
		bottleHit[hitIndex] = 1;
		pickedDist = closestDist;
		++score;
	}

}
Exemplo n.º 3
0
void RenderSystem::init_camera()
{
	//Viewport Infomation
	D3D11_VIEWPORT vp;
	ZeroMemory(&vp, sizeof(D3D11_VIEWPORT));
	vp.TopLeftX = 0;
	vp.TopLeftY = 0;
	vp.MinDepth = 0.0f;
	vp.MaxDepth = 1.0f;
	vp.Width    = m_ScreenWidth;
	vp.Height   = m_ScreenHeight;
	m_pD3D11DeviceContext->RSSetViewports(1, &vp);

	//MVP Matrix
	XMVECTOR camPos    = XMVectorSet(0.0f,  5.0f, -8.0f, 0.0f);
	XMVECTOR camTarget = XMVectorSet( 0.0f, 0.0f, 0.0f, 0.0f );
	XMVECTOR camUp     = XMVectorSet( 0.0f, 1.0f, 0.0f, 0.0f );
	XMMATRIX View      = XMMatrixLookAtLH( camPos, camTarget, camUp );
	XMMATRIX Model     = XMMatrixIdentity();
	XMMATRIX Proj      = XMMatrixPerspectiveFovLH(0.4f*3.14f, GetAspect(), 1.0f, 1000.0f);

	XMStoreFloat4x4(&m_Proj, XMMatrixTranspose(Proj));
	XMStoreFloat4x4(&m_Model, XMMatrixTranspose(Model) );
	XMStoreFloat4x4(&m_View, XMMatrixTranspose(View) );

}
Exemplo n.º 4
0
void RenderSystem::v_Render()
{

	static const GLfloat black[] = { 0.0f, 0.0f, 0.0f, 1.0f };
	glClearBufferfv(GL_COLOR, 0, black);

	m_Plane.Render(GetAspect());

}
Exemplo n.º 5
0
void RenderSystem::v_Render()
{
	static const glm::vec4 bgColor(0.2f, 0.4f, 0.5f, 1.0f);
	glClearBufferfv(GL_COLOR, 0, &bgColor[0]);

	static const GLfloat aspect = GetAspect();

	m_Rectangle.Render(aspect);
}
Exemplo n.º 6
0
void RenderSystem::v_Render()
{
	static const GLfloat black[] ={ 0.2f, 0.3f, 0.4f, 1.0f };
	glClearBufferfv(GL_COLOR, 0, black);
	static const GLfloat one[] ={ 1.0f };
	glClearBufferfv(GL_DEPTH, 0, one);

	m_Sphere.Render(GetAspect());

}
Exemplo n.º 7
0
void RenderSystem::v_Render()
{

	static const GLfloat black[] = { 0.0f, 0.0f, 0.0f, 1.0f };
	glClearBufferfv(GL_COLOR, 0, black);
	static const GLfloat one[] = { 1.0f };
	glClearBufferfv(GL_DEPTH, 0, one);

	m_Cube.Render(GetAspect(), GetScreenWidth(), GetScreenHeight() );

}
Exemplo n.º 8
0
	// ==================================================
	void ViewPort::Render()
	{
		if (m_isDirty)
		{
			m_matrix = m_cameraType == CAMERA_TYPE::PERPECTIVE ?
				glm::perspective(glm::radians(m_cameraParams.z), GetAspect(), m_cameraParams.x, m_cameraParams.y)
				: glm::ortho(0.0f, static_cast<float>(m_width), 0.0f, static_cast<float>(m_height), m_cameraParams.x, m_cameraParams.y);
			m_isDirty = false;
		}
		glClearColor(m_backRed, m_backGreen, m_backBlue, m_backAlpha);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	}
Exemplo n.º 9
0
void RenderSystem::init_camera()
{
	//Viewport Infomation
	D3D11_VIEWPORT vp;
	ZeroMemory(&vp, sizeof(D3D11_VIEWPORT));
	vp.TopLeftX = 0;
	vp.TopLeftY = 0;
	vp.MinDepth = 0.0f;
	vp.MaxDepth = 1.0f;
	vp.Width    = m_ScreenWidth;
	vp.Height   = m_ScreenHeight;
	m_pD3D11DeviceContext->RSSetViewports(1, &vp);

	//MVP Matrix
	XMVECTOR camPos    = XMVectorSet(0.0f,  5.0f, -8.0f, 0.0f);
	XMVECTOR camTarget = XMVectorSet( 0.0f, 0.0f, 0.0f, 0.0f );
	XMVECTOR camUp     = XMVectorSet( 0.0f, 1.0f, 0.0f, 0.0f );
	XMMATRIX View      = XMMatrixLookAtLH( camPos, camTarget, camUp );
	XMMATRIX Model     = XMMatrixIdentity();
	XMMATRIX Proj      = XMMatrixPerspectiveFovLH(0.4f*3.14f, GetAspect(), 1.0f, 1000.0f);

	XMStoreFloat4x4(&m_Proj, XMMatrixTranspose(Proj));
	XMStoreFloat4x4(&m_Model, XMMatrixTranspose(Model) );
	XMStoreFloat4x4(&m_View, XMMatrixTranspose(View) );

	float bottleXPos = -30.0f;
	float bottleZPos = 30.0f;
	float bxadd = 0.0f;
	float bzadd = 0.0f;

	for (int i = 0; i < 20; i++)
	{
		//set the loaded bottles world space
		bottleModel[i] = XMMatrixIdentity();

		bxadd++;

		if (bxadd == 10)
		{
			bzadd -= 1.0f;
			bxadd = 0;
		}

		XMMATRIX Rotation = XMMatrixRotationY(3.14f);
		XMMATRIX Scale = XMMatrixScaling(1.0f, 1.0f, 1.0f);
		XMMATRIX Translation = XMMatrixTranslation(bottleXPos + bxadd*10.0f, 3.0f, bottleZPos + bzadd*10.0f);

		bottleModel[i] = Rotation * Scale * Translation;
	}


}
Exemplo n.º 10
0
void
avtOpenGLCurveRenderer::RenderBall(void)
{
    double ix = 0.;
    double iy = 0.;
    vtkIdType npts = input->GetPoints()->GetNumberOfPoints();
    for(vtkIdType i = 0; i < npts-1 ; i++)
    {
        double ptr[6];
        input->GetPoints()->GetPoint(i, ptr);
        input->GetPoints()->GetPoint(i+1, ptr+3);
        if (ptr[0] <= atts.GetTimeForTimeCue() && atts.GetTimeForTimeCue() <= ptr[3])
        {
            double lastX = ptr[0];
            double curX = ptr[3];
            double lastY = ptr[1];
            double curY = ptr[4];
            ix = atts.GetTimeForTimeCue();
            iy = (ix-lastX)/(curX-lastX)*(curY-lastY) + lastY;
        }
    }

    int    bin_x_n,      bin_y_n;
    double bin_x_size,   bin_y_size;
    double bin_x_offset, bin_y_offset;
    GetAspect(bin_x_n, bin_x_size, bin_x_offset,
              bin_y_n, bin_y_size, bin_y_offset);

    // Set the curve color.
    ColorAttribute curveColor(atts.GetBallTimeCueColor());
    curveColor.SetAlpha(255);
    glColor4ubv(curveColor.GetColor());

    int symbolNVerts = 100;
    glBegin(GL_TRIANGLE_FAN);
    double pt[3];
    pt[0] = ix;
    pt[1] = iy;
    pt[2] = 0.;
    glVertex3dv(pt);
    double REDUCE_SCALE = atts.GetTimeCueBallSize();
    for(int i = 0; i < symbolNVerts-1; ++i)
    {
        double t = double(i) / double(symbolNVerts-1-1);
        double angle = 2. * M_PI * t;
        pt[0] = ix + cos(angle) * REDUCE_SCALE * bin_x_size / 2.;
        pt[1] = iy + sin(angle) * REDUCE_SCALE * bin_y_size / 2.;
        pt[2] = 0.;                
        glVertex3dv(pt);
    }
    glEnd();
}
Exemplo n.º 11
0
	void RenderSystem::v_Render()
	{
		static const float bgColor[4] = {0.2f, 0.4f, 0.5f, 1.0f};
		glClearBufferfv(GL_COLOR, 0, bgColor);
		static const float one = 1.0f;
		glClearBufferfv(GL_DEPTH, 0, &one);

		static ogl::MvpMatrix matrix;
		matrix.view  = m_Camera.GetViewMatrix();
		matrix.proj  = glm::perspective(m_Camera.GetZoom(), GetAspect(), 0.1f, 1000.0f);
		matrix.model = glm::mat4(1.0f);

		m_Skybox.Render(matrix);


	}
Exemplo n.º 12
0
void RendSpline::OnAspectLock(HWND hWnd, TimeValue t)
{
	BOOL aspectLock;

	if(UseViewOrRenderParams(t) == rbViewport)
		pblock->GetValue(rnd_v2_vpt_aspect_lock,t,aspectLock,FOREVER);
	else
		pblock->GetValue(rnd_v2_aspect_lock,t,aspectLock,FOREVER);

	ISpinnerControl *iSpin = GetISpinner(GetDlgItem(hWnd, IDC_ASPECTSPIN));

	if(aspectLock)
	{	
		if(!mAspectLock)
			mAspect = GetAspect(t,(UseViewOrRenderParams(t)== rbViewport));

		iSpin->SetValue(mAspect,FALSE);
		iSpin->Disable();
		mAspectLock = aspectLock;
	}
	
	ReleaseISpinner(iSpin);
}
Exemplo n.º 13
0
void RenderSystem::v_Render()
{

	m_Cube.Render(GetAspect());

}
Exemplo n.º 14
0
Matrix4f Camera::GetProjection()
{
    return Matrix4f::createTranslation(-(GetAspect() - 1.0f) / 2.0f, 0, 0) *
           Matrix4f::createPerspective(mFOV, GetAspect(), 0.01f, 10240.0f);
}
Exemplo n.º 15
0
void shadowmapping_app::v_Render()
{
	double currentTime = glfwGetTime();
    static const GLfloat zeros[] = { 0.0f, 0.0f, 0.0f, 0.0f };
    
    static double last_time = 0.0;
    static double total_time = 0.0;

    if (!paused)
        total_time += (currentTime - last_time);
    last_time = currentTime;

    const float f = (float)total_time + 30.0f;

    vmath::vec3 view_position = vmath::vec3(0.0f, 0.0f, 40.0f);

    camera_proj_matrix = vmath::perspective(50.0f,
                                            GetAspect(),
                                            2.0f,
                                            300.0f);

    camera_view_matrix = vmath::lookat(view_position,
                                       vmath::vec3(0.0f),
                                       vmath::vec3(0.0f, 1.0f, 0.0f));

    objects[0].model_matrix = vmath::translate(5.0f, 0.0f, 20.0f) *
                              vmath::rotate(f * 14.5f, 0.0f, 1.0f, 0.0f) *
                              vmath::rotate(20.0f, 1.0f, 0.0f, 0.0f) *
                              vmath::translate(0.0f, -4.0f, 0.0f);

    objects[1].model_matrix = vmath::translate(-5.0f, 0.0f, 0.0f) *
                              vmath::rotate(f * 14.5f, 0.0f, 1.0f, 0.0f) *
                              vmath::rotate(20.0f, 1.0f, 0.0f, 0.0f) *
                              vmath::translate(0.0f, -4.0f, 0.0f);

    objects[2].model_matrix = vmath::translate(-15.0f, 0.0f, -20.0f) *
                              vmath::rotate(f * 14.5f, 0.0f, 1.0f, 0.0f) *
                              vmath::rotate(20.0f, 1.0f, 0.0f, 0.0f) *
                              vmath::translate(0.0f, -4.0f, 0.0f);

    objects[3].model_matrix = vmath::translate(-25.0f, 0.0f, -40.0f) *
                              vmath::rotate(f * 14.5f, 0.0f, 1.0f, 0.0f) *
                              vmath::rotate(20.0f, 1.0f, 0.0f, 0.0f) *
                              vmath::translate(0.0f, -4.0f, 0.0f);

    objects[4].model_matrix = vmath::translate(-35.0f, 0.0f, -60.0f) *
                              vmath::rotate(f * 14.5f, 0.0f, 1.0f, 0.0f) *
                              vmath::rotate(20.0f, 1.0f, 0.0f, 0.0f) *
                              vmath::translate(0.0f, -4.0f, 0.0f);

    glEnable(GL_DEPTH_TEST);
    render_scene(total_time);

    glUseProgram(filter_program);

    glBindImageTexture(0, color_tex, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA32F);
    glBindImageTexture(1, temp_tex, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA32F);

    glDispatchCompute(GetScreenHeight(), 1, 1);

    glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);

    glBindImageTexture(0, temp_tex, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA32F);
    glBindImageTexture(1, color_tex, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA32F);

    glDispatchCompute(GetScreenWidth(), 1, 1);

    glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);

    glBindTexture(GL_TEXTURE_2D, color_tex);
    glDisable(GL_DEPTH_TEST);
    glUseProgram(display_program);
    glUniform1f(uniforms.dof.focal_distance, focal_distance);
    glUniform1f(uniforms.dof.focal_depth, focal_depth);
    glBindVertexArray(quad_vao);
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
Exemplo n.º 16
0
void  RenderSystem::v_OnMouseWheel(WPARAM btnState, int x, int y)
{
	m_Camera.OnMouseWheel(btnState, x, y, GetAspect());
}
Exemplo n.º 17
0
void
avtOpenGLCurveRenderer::DrawCurveAsSymbols()
{
    int bin_x_n,         bin_y_n;
    double bin_x_size,   bin_y_size;
    double bin_x_offset, bin_y_offset;
    GetAspect(bin_x_n, bin_x_size, bin_x_offset,
              bin_y_n, bin_y_size, bin_y_offset);

#ifdef VISUALIZE_DYNAMIC_BINS
    //
    // Draw the grid that we use to dscretize space.
    //
    glColor3f(0.4,0.4,0.4);
    glBegin(GL_LINES);
    for(int i = 0; i < bin_x_n; ++i)
    {
        double v0[3], v1[3];
        v0[0] = bin_x_offset + double(i) * bin_x_size;
        v0[1] = bin_y_offset;
        v0[2] = 0.;

        v1[0] = bin_x_offset + double(i) * bin_x_size;
        v1[1] = bin_y_offset + win_dy;
        v1[2] = 0.;

        glVertex3dv(v0);
        glVertex3dv(v1);
    }
    glEnd();

    glBegin(GL_LINES);
    for(int i = 0; i < bin_y_n; ++i)
    {
        double v0[3], v1[3];
        v0[0] = bin_x_offset;
        v0[1] = bin_y_offset + double(i) * bin_y_size;
        v0[2] = 0.;

        v1[0] = bin_x_offset + win_dx;
        v1[1] = bin_y_offset + double(i) * bin_y_size;
        v1[2] = 0.;

        glVertex3dv(v0);
        glVertex3dv(v1);
    }
    glEnd();
#endif

    // Set the curve color.
    ColorAttribute curveColor(atts.GetCurveColor());
    curveColor.SetAlpha(255);
    glColor4ubv(curveColor.GetColor());

#define SWAP(a,b) { int tmp = a; a = b; b = tmp; }
#define ONE_THIRD_ROUND (2. * M_PI / 3.)
#define REDUCE_SCALE 0.8
#define MAX_SYMBOL_VERTS 25

    double symbolPoints[MAX_SYMBOL_VERTS][2];
    int symbolNVerts;
    if (atts.GetSymbol() == CurveAttributes::Point)
    {
        symbolNVerts = 1;
        glPointSize(atts.GetPointSize());
        symbolPoints[0][0] = 0.;
        symbolPoints[0][1] = 0.;
        glBegin(GL_POINTS);
    }
    else if(atts.GetSymbol() == CurveAttributes::TriangleUp)
    {
        symbolNVerts = 3;
        symbolPoints[0][0] = cos(M_PI/2.) * REDUCE_SCALE * bin_x_size / 2.;
        symbolPoints[0][1] = sin(M_PI/2.) * REDUCE_SCALE * bin_y_size / 2.;
        symbolPoints[1][0] = cos(M_PI/2. + ONE_THIRD_ROUND) * REDUCE_SCALE * bin_x_size / 2.;
        symbolPoints[1][1] = sin(M_PI/2. + ONE_THIRD_ROUND) * REDUCE_SCALE * bin_y_size / 2.;
        symbolPoints[2][0] = cos(M_PI/2. + 2.*ONE_THIRD_ROUND) * REDUCE_SCALE * bin_x_size / 2.;
        symbolPoints[2][1] = sin(M_PI/2. + 2.*ONE_THIRD_ROUND) * REDUCE_SCALE * bin_y_size / 2.;
        glBegin(GL_TRIANGLES);
    }
    else if(atts.GetSymbol() == CurveAttributes::TriangleDown)
    {
        symbolNVerts = 3;
        symbolPoints[0][0] = cos(3*M_PI/2.) * REDUCE_SCALE * bin_x_size / 2.;
        symbolPoints[0][1] = sin(3*M_PI/2.) * REDUCE_SCALE * bin_y_size / 2.;
        symbolPoints[1][0] = cos(3*M_PI/2. + ONE_THIRD_ROUND) * REDUCE_SCALE * bin_x_size / 2.;
        symbolPoints[1][1] = sin(3*M_PI/2. + ONE_THIRD_ROUND) * REDUCE_SCALE * bin_y_size / 2.;
        symbolPoints[2][0] = cos(3*M_PI/2. + 2.*ONE_THIRD_ROUND) * REDUCE_SCALE * bin_x_size / 2.;
        symbolPoints[2][1] = sin(3*M_PI/2. + 2.*ONE_THIRD_ROUND) * REDUCE_SCALE * bin_y_size / 2.;
        glBegin(GL_TRIANGLES);
    }
    else if(atts.GetSymbol() == CurveAttributes::Square)
    {
        symbolNVerts = 4;
        symbolPoints[0][0] = REDUCE_SCALE * bin_x_size / 2.;
        symbolPoints[0][1] = REDUCE_SCALE * bin_y_size / 2.;
        symbolPoints[1][0] = -REDUCE_SCALE * bin_x_size / 2.;
        symbolPoints[1][1] = REDUCE_SCALE * bin_y_size / 2.;
        symbolPoints[2][0] = -REDUCE_SCALE * bin_x_size / 2.;
        symbolPoints[2][1] = -REDUCE_SCALE * bin_y_size / 2.;
        symbolPoints[3][0] = REDUCE_SCALE * bin_x_size / 2.;
        symbolPoints[3][1] = -REDUCE_SCALE * bin_y_size / 2.;
        glBegin(GL_QUADS);
    }
    else if(atts.GetSymbol() == CurveAttributes::Circle)
    {
        symbolNVerts = MAX_SYMBOL_VERTS;
        symbolPoints[0][0] = 0.f;
        symbolPoints[0][1] = 0.f;
        for(int i = 0; i < MAX_SYMBOL_VERTS-1; ++i)
        {
            double t = double(i) / double(MAX_SYMBOL_VERTS-1-1);
            double angle = 2. * M_PI * t;
            symbolPoints[i+1][0] = cos(angle) * REDUCE_SCALE * bin_x_size / 2.;
            symbolPoints[i+1][1] = sin(angle) * REDUCE_SCALE * bin_y_size / 2.;
        }
    }
    else if(atts.GetSymbol() == CurveAttributes::Plus)
    {
        symbolNVerts = 4;
        symbolPoints[0][0] = 0.f;
        symbolPoints[0][1] = -REDUCE_SCALE * bin_y_size / 2.;
        symbolPoints[1][0] = 0.f;
        symbolPoints[1][1] = REDUCE_SCALE * bin_y_size / 2.;
        symbolPoints[2][0] = -REDUCE_SCALE * bin_x_size / 2.;
        symbolPoints[2][1] = 0.f;
        symbolPoints[3][0] = REDUCE_SCALE * bin_x_size / 2.;
        symbolPoints[3][1] = 0.f;
        glLineWidth(2.);
        glBegin(GL_LINES);
    }
    else if(atts.GetSymbol() == CurveAttributes::X)
    {
        symbolNVerts = 4;
        symbolPoints[0][0] = cos(M_PI/4. + M_PI/2.) * REDUCE_SCALE * bin_x_size / 2.;
        symbolPoints[0][1] = sin(M_PI/4. + M_PI/2.) * REDUCE_SCALE * bin_y_size / 2.;
        symbolPoints[1][0] = cos(M_PI/4. + M_PI + M_PI/2.) * REDUCE_SCALE * bin_x_size / 2.;
        symbolPoints[1][1] = sin(M_PI/4. + M_PI + M_PI/2.) * REDUCE_SCALE * bin_y_size / 2.;
        symbolPoints[2][0] = cos(M_PI/4. + 0.) * REDUCE_SCALE * bin_x_size / 2.;
        symbolPoints[2][1] = sin(M_PI/4. + 0.) * REDUCE_SCALE * bin_y_size / 2.;
        symbolPoints[3][0] = cos(M_PI/4. + M_PI) * REDUCE_SCALE * bin_x_size / 2.;
        symbolPoints[3][1] = sin(M_PI/4. + M_PI) * REDUCE_SCALE * bin_y_size / 2.;
        glLineWidth(2.);
        glBegin(GL_LINES);
    }

    // static case
    if (atts.GetPointFillMode() == CurveAttributes::Static)
    {
        vtkIdType stride = atts.GetPointStride();
        vtkIdType nPts = input->GetPoints()->GetNumberOfPoints();
        double pts[3] = {0., 0., 0.};
        for(vtkIdType i = 0; i < nPts-1; i+=stride)
        {
            input->GetPoints()->GetPoint(i, pts);

            if (atts.GetDoCropTimeCue() && atts.GetTimeForTimeCue() < pts[0])
                continue;

            if(atts.GetSymbol() == CurveAttributes::Circle)
                glBegin(GL_TRIANGLE_FAN);

            for(int j = 0; j < symbolNVerts; ++j)
            {
                double pt[3];
                pt[0] = pts[0] + symbolPoints[j][0];
                pt[1] = pts[1] + symbolPoints[j][1];
                pt[2] = 0.;
                glVertex3dv(pt);
            }

            if(atts.GetSymbol() == CurveAttributes::Circle)
                glEnd();
        }
        // add the last point.
        input->GetPoints()->GetPoint(nPts-1, pts);
        if (!atts.GetDoCropTimeCue() || 
           (atts.GetDoCropTimeCue() && atts.GetTimeForTimeCue() >= pts[0]))
        {
            if(atts.GetSymbol() == CurveAttributes::Circle)
                glBegin(GL_TRIANGLE_FAN);
            for(int j = 0; j < symbolNVerts; ++j)
            {
                double pt[3];
                pt[0] = pts[0] + symbolPoints[j][0];
                pt[1] = pts[1] + symbolPoints[j][1];
                pt[2] = 0.;
                glVertex3dv(pt);
            }

            if(atts.GetSymbol() == CurveAttributes::Circle)
                glEnd();
        }
    }
    else
    {
        // Now iterate over the line segments and draw the symbols on them.
        for(vtkIdType i = 1; i < input->GetPoints()->GetNumberOfPoints(); ++i)
        {
            double A[3], B[3];
            input->GetPoints()->GetPoint(i-1, A);
            input->GetPoints()->GetPoint(i,   B);

            // Determine the grid cells that contain the points.
            int x0 = int((A[0] - bin_x_offset) / bin_x_size);
            int y0 = int((A[1] - bin_y_offset) / bin_y_size);

            int x1 = int((B[0] - bin_x_offset) / bin_x_size);
            int y1 = int((B[1] - bin_y_offset) / bin_y_size);

            // Use Bresenham's line algorithm to produce a number of
            // cells encountered along the line segment.
            bool steep = abs(y1 - y0) > abs(x1 - x0);
            if(steep)
            {
                SWAP(x0, y0);
                SWAP(x1, y1);
            }
            if(x0 > x1)
            {
                SWAP(x0, x1);
                SWAP(y0, y1);
            }
            int deltax = x1 - x0;
            int deltay = y1 - y0;
            if(deltay < 0)
                deltay = -deltay;
            int err = 0;
            int y = y0;
            int ystep = (y0 < y1) ? 1 : -1;
            int cells_in_line = 0;
            for(int x = x0; x <= x1; ++x)
            {
                cells_in_line++;
                err = err + deltay;
                if((err << 1) >= deltax)
                {
                    y += ystep;
                    err -= deltax;
                }
            }

            // Use the number of cells along the way between the line
            // end points to calculate intermediate points at which to 
            // put symbols.
            for(int pindex = 0; pindex < cells_in_line; ++pindex)
            {
                double t = (cells_in_line == 1) ? 0. : (double(pindex) / double(cells_in_line-1));

                double ix = (1.-t)*A[0] + t*B[0];
                if (atts.GetDoCropTimeCue() && atts.GetTimeForTimeCue() < ix)
                    continue;
                double iy = (1.-t)*A[1] + t*B[1];

                if(atts.GetSymbol() == CurveAttributes::Circle)
                    glBegin(GL_TRIANGLE_FAN);

                for(int j = 0; j < symbolNVerts; ++j)
                {
                    double pt[3];
                    pt[0] = ix + symbolPoints[j][0];
                    pt[1] = iy + symbolPoints[j][1];
                    pt[2] = 0.;                
                    glVertex3dv(pt);
                }

                if(atts.GetSymbol() == CurveAttributes::Circle)
                    glEnd();
            }
        }
    }

    if(atts.GetSymbol() != CurveAttributes::Circle)
        glEnd();
}