[vtkusers] Re: Java, VTK, and XFree & Mesa OpenGL Problems

Kent Vander Velden graphix at iastate.edu
Wed Oct 4 14:22:53 EDT 2000


  The following short java program is a mixmash of different pieces of
vtkPanel and Regression.java and is nearly the minimal needed to test the
problem.  If after setting MESA_DEBUG to verbose and running the java
program you see:

GenuineIntel cpu detected.
MMX cpu detected.
Mesa warning: glEnable(GL_DEPTH_TEST) but no depth buffer
Mesa user error: GL_INVALID_OPERATION in glDrawBuffer

  there is a problem.  If instead you do not see the last two lines then
things are fine.  My feeling is that there is something not quite right 
about the DrawingSurface.  I have tried forcing the windowID to an application
that is running correctly, but get the same error message.

  Thanks.


import vtk.*;
import java.awt.*;
import java.awt.event.*;
import sun.awt.*;

public class Regression3a extends Frame {
    static { System.loadLibrary("vtkJava"); }

    public static class vRender extends Canvas {

	public vtkRenderer ren1 = new vtkRenderer();
	public vtkRenderWindow renWin = new vtkRenderWindow();
	
	public vRender() {
	    renWin.AddRenderer(ren1);
	    
	    vtkSphereSource sphere = new vtkSphereSource();
	    sphere.SetThetaResolution(10);
	    sphere.SetPhiResolution(10);
	    vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();
	    sphereMapper.SetInput(sphere.GetOutput());
	    
	    vtkActor sphereActor = new vtkActor();
	    sphereActor.SetMapper(sphereMapper);
	    
	    ren1.AddActor(sphereActor);

	    //setBackground(Color.red);
	}

	public void ini() {
	    DrawingSurfaceInfo surfaceInfo =
		((DrawingSurface)this.getPeer()).getDrawingSurfaceInfo();
	    surfaceInfo.lock();
	    
	    X11DrawingSurface wds =
		(X11DrawingSurface)surfaceInfo.getSurface();
	    int hWnd = wds.getDrawable();

	    surfaceInfo.unlock();
	    
	    String wi = "" + hWnd;
	    renWin.SetWindowInfo(wi);
	}
    }

    public vRender r;

    public Regression3a() {
	super("test");
	MenuBar menuBar = new MenuBar();
	setMenuBar(menuBar);
	Menu fileMenu = new Menu("File");
	menuBar.add(fileMenu);
	MenuItem item = new MenuItem("Exit");
	fileMenu.add(item);
	r = new vRender();
	r.setSize(600,400);
	removeAll();
	add(r);
	pack();
    }
    
    public static void main (String []args) {
	Regression3a reg = new Regression3a();
	reg.show();
	reg.r.ini();
	reg.r.renWin.Render();
    } 
}



---
Kent Vander Velden
kent at iastate.edu





More information about the vtkusers mailing list