Eclipse, processing and OpenGL
in
Integration and Hardware
•
3 years ago
Hey guys,
im getting null pointer exception when pgl.beginGL() is called. It seems like, allocate method inside PGraphicsOpenGL is never called, so gl in never inicialized. It is written that this method is called by resize method, but it doesnt seem to be so. Anyway, i am out of ideas what is wrong. Here's my code:
public
class Demo1 extends PApplet { private static final long serialVersionUID = 1L; CameraState cameraState ;GL
_gl ;PGraphicsOpenGL
_pgl ;PeasyCam
_camera ; private Mesh3D _mesh ;ArrayList<Word>
_wordDictionary ;MatrixSize
_matrixSize ;ArrayList<Node>
_nodes ;HashMap<String, WordIndex>
_dictionary = new HashMap<String, WordIndex>(); int _numOfMaxWordsToDisplay ;WindowControl
_wc ; private boolean _is_setup=false ; @SuppressWarnings("deprecation" ) public void setup() { if(!_is_setup ){ _is_setup=true ;size(
screen
.
}
hint(
ENABLE_OPENGL_4X_SMOOTH ); this._camera = new PeasyCam(this , 0, 0, 0, 500); try { this._wordDictionary = DataParser.getWordDictionary(); this._matrixSize = DataParser.getMatrixSize(); this._nodes = DataParser.getNodes();}
catch (IOException e) {println(
"read error: " + e.getMessage()); return ;}
if (DataParser.wordsToDisplay == -1) {println(
"ERROR!!!!" ); return ;}
fillDictionary(
_wordDictionary ); // inic Mesh3DMesh3D mesh =
new Mesh3D(_wordDictionary, _matrixSize, _nodes ); this._wc = new WindowControl(this,DataParser.wordsToDisplay , mesh, _nodes ); } @SuppressWarnings("deprecation" ) public void draw() { int screenHeight =}
_gl .glViewport(0, 0, screenHeight, screenWidth); _pgl .endGL();
}
Please help.
Thanks, Kaja
1