JOGL & Pixelnerve objimporter "OpenGL error 1280 at top endDraw(): invalid enumerant" and view distortion
in
Contributed Library Questions
•
1 year ago
Hello!
There is some weird view distortion in my app when displaying meshes loaded from obj files. I am not sure if it is related to the error 1280, but it wasted everything (.
I have been searching for answers to this and looks like the error occures much, but there is no only reason for it and no uniform solution. I have been unable to find any sensible information regarding the error nature except for that it occures when there is some malformed data passed to OpenGL. For me it occures every time i load ANY obj file with Pixelnerve objimporter. The error seems to be not critical in terms that it does not crash the application, but if it's there, then there must be something wrong.
The application does not crush, but, however, there is something strange happening when it runs. After several hours trying to find a mistake in my computations, I have localized the cause in a very unexpected place. As only I try to display any loaded mesh, with this code:
- Global.modelDB.getModel(index).draw(context.beginGL());
I am not sure if the view distortion is somehow related to the error 1280 but I think that it might be some problems with the endDraw() and the matrices do not get correctly arranged or something.
I also have to say one more thing: the application is running in 16:9 mode, the transformation is done like that, at the begging of every draw cycle:
- context.gl.glMatrixMode(GL.GL_PROJECTION); //setting up the far clipping plane and aspect
- context.gl.glLoadIdentity();
- context.gl.glFrustum(-1.77777, 1.77777, -1, 1, 1, 100000); //the 1.7777 / 1 thing is the 16:9 aspect ratio
- context.gl.glMatrixMode(GL.GL_MODELVIEW); //returning to model drawing
EDIT: The -90 degrees rotation is actually performed by my code. There is an option to rotate the context cw or ccw. But now I find that for some reason the keyboard button that does this, has no action when no model is displayed. The rotation is done through the rotateZ method, which looks like this in GLGraphicsOffscreen:
- public void rotateZ(float angle) {
- if (glMode) gl.glRotatef(PApplet.degrees(angle), 0.0f, 0.0f, 1.0f);
- else super.rotateZ(angle);
- }
So that must somehow be related to the glMode!!!
1