Commit 88c5dec4 authored by Ken Martin's avatar Ken Martin
Browse files

fixed some bugs

parent 9bd1a815
......@@ -243,8 +243,8 @@ void vtkXglrCamera::Render(vtkCamera *cam, vtkXglrRenderer *ren)
dc_bounds.xmin = vport[0]*(size[0] - 1);
dc_bounds.xmax = vport[2]*(size[0] - 1);
dc_bounds.ymin = vport[1]*(size[1] - 1);
dc_bounds.ymax = vport[3]*(size[1] - 1);
dc_bounds.ymin = (1.0 - vport[3])*(size[1] - 1);
dc_bounds.ymax = (1.0 - vport[1])*(size[1] - 1);
dc_bounds.zmin = 0;
dc_bounds.zmax = max_device_values.z;
xgl_object_set(*context, XGL_CTX_DC_VIEWPORT, &dc_bounds, NULL);
......
......@@ -44,9 +44,9 @@ void vtkXglrLight::Render(vtkLight *lgt, vtkXglrRenderer *ren,int light_index)
FocalPoint = lgt->GetFocalPoint();
Position = lgt->GetPosition();
direction.x = Position[0] - FocalPoint[0];
direction.y = Position[1] - FocalPoint[1];
direction.z = Position[2] - FocalPoint[2];
direction.x = FocalPoint[0] - Position[0];
direction.y = FocalPoint[1] - Position[1];
direction.z = FocalPoint[2] - Position[2];
lights = ren->GetLightArray();
......
......@@ -65,7 +65,7 @@ void vtkXglrProperty::Render(vtkProperty *prop, vtkXglrRenderer *ren)
prop->GetSpecularPower(),
XGL_3D_CTX_SURF_FRONT_SPECULAR_COLOR, &specularColor,
XGL_CTX_SURF_FRONT_COLOR, &diffuseColor,
XGL_CTX_LINE_COLOR, &DiffuseColor,
XGL_CTX_LINE_COLOR, &diffuseColor,
XGL_3D_CTX_SURF_BACK_AMBIENT, Ambient,
XGL_3D_CTX_SURF_BACK_DIFFUSE, Diffuse,
XGL_3D_CTX_SURF_BACK_SPECULAR, Specular,
......
......@@ -36,6 +36,27 @@ vtkXglrRenderWindow::vtkXglrRenderWindow()
strcpy(this->Name,"Visualization Toolkit - XGL");
}
// Description:
// free the memory
vtkXglrRenderWindow::~vtkXglrRenderWindow()
{
// close the XGL window
if (this->Context)
{
xgl_object_destroy(this->WindowRaster);
xgl_object_destroy(this->Context);
this->Context = NULL;
this->WindowRaster = NULL;
}
/* free the Xwindow we created no need to free the colormap */
if (this->OwnWindow)
{
XDestroyWindow(this->DisplayId,this->WindowId);
}
XSync(this->DisplayId,0);
}
// Description:
// Create a XGL specific light.
vtkLightDevice *vtkXglrRenderWindow::MakeLight()
......@@ -784,6 +805,7 @@ unsigned char *vtkXglrRenderWindow::GetPixelData(int x1, int y1,
static Xgl_ras *getRas = NULL;
static Xgl_3d_ctx getContext;
Xgl_usgn32 *input;
Xgl_usgn32 *pos;
if (!getRas)
{
......@@ -853,15 +875,15 @@ unsigned char *vtkXglrRenderWindow::GetPixelData(int x1, int y1,
/* now write the binary info one row at a time */
p_data = data;
for (yloop = (this->Size[1] - y_hi - 1);
yloop <= (this->Size[1] - y_low -1); yloop++)
for (yloop = y_low; yloop <= y_hi; yloop++)
{
pos = input + (this->Size[1] - yloop - 1)*this->Size[0];
for (xloop = 0; xloop <= (abs(x2-x1)); xloop++)
{
*p_data = *input & 0x000000ff; p_data++;
*p_data = (*input & 0x0000ff00) >> 8; p_data++;
*p_data = (*input & 0x00ff0000) >> 16; p_data++;
input++;
*p_data = *pos & 0x000000ff; p_data++;
*p_data = (*pos & 0x0000ff00) >> 8; p_data++;
*p_data = (*pos & 0x00ff0000) >> 16; p_data++;
pos++;
}
}
......@@ -923,8 +945,8 @@ void vtkXglrRenderWindow::SetPixelData(int x1, int y1, int x2, int y2,
// now write the binary info one row at a time
p_data = data;
for (yloop = (this->Size[1] - y_hi - 1);
yloop <= (this->Size[1] - y_low -1); yloop++)
for (yloop = (this->Size[1] - y_low - 1);
yloop >= (this->Size[1] - y_hi -1); yloop--)
{
pos.y = yloop;
for (xloop = 0; xloop <= (abs(x2-x1)); xloop++)
......
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