EDIT: I realize how difficult it is to make any sense of the following problem, and I know no one wants to sift through the gory details of my program, so let me simply state: I have something that's being drawn occasionally (maybe 1 in 20 times) in my program, when I have an empty glBegin(GL2.GL_QUADS);gl.glEnd();, that is not being drawn if I comment that out. Why would that happen?
Longer version: Ok, this is simply the most perplexing bug I've ever had with JoGL. It took me many many hours just to characterize the bug this far. The simplest way I can describe it is the following: Something seems to be getting stuck in some kind of buffer. My program draws a lot of a specific object (a box made with quads). Originally I used a gl list for this, but for the sake of debugging, I made it make explicit calls every time. I also have a sprite effect. Sometimes when I draw the sprite effect, it gets covered up with a box that shouldn't be there. I found that if I replaced the ENTIRE sprite drawing with gl.glBegin(GL2.GL_QUADS); gl.glEnd(); the box would somehow still be drawn. If I comment out these last two lines, the box is not drawn. Therefore, somehow, just having a begin/end with no code in between is causing an earlier displayed series of quad calls (the box) to be recalled. What on earth could be causing this?! Thanks for any help, Nick |
Administrator
|
Given the statement u provided u are right an empty glBegin(GL2.GL_QUADS);gl.glEnd(); is a legal combination according to the OpenGL spec. But often such "extreme cases" trap into some nasty driver bugs (e.g. see some recent Mesa3D bug regarding a similar issue: http://www.mail-archive.com/mesa3d-dev@lists.sourceforge.net/msg08483.html).
So keeping ur drivers up2date is always a good idea. Other than that is ur program working correctly when using display-lists ? If so maybe u do not correcty begin/end ur glBegin/glEnd calls leaving the driver in some undefined state ?! Also don't hesitate to post/attach code snippets or even ur full code. Moste people here are crazy enough to read it |
I checked all my begin/end blocks, and I think they match up. Here's some more description:
If I comment out the code that makes boxes be drawn, the 'phantom' box never appears. If I comment out ALL of the code used to draw the sprite, the phantom box never appears. If I leave in code for drawing normal boxes, and leave only "begin/end" for the sprite drawing, I occasionally get the phantom box. |
http://michael-bien.com/mbien/entry/jogl_2_composeable_pipline regards, michael On 10/09/2010 02:17 AM, NickJPGeorge [via jogamp] wrote: I checked all my begin/end blocks, and I think they match up. Here's some more description: -- - - - - http://michael-bien.com |
Hmm, does it matter that I'm using GL2 instead of GL3? (I'm still kind of fuzzy about the difference)?
I used drawable.setGL(new DebugGL2(drawable.getGL().getGL2())); instead. It doesn't give me any errors. I've learned a little more about the problem: The thing being drawn is a real thing, that should be drawn. It's just being drawn at the wrong time. So, for instance gl.glPushMatrix(); //transforms #1 //Draw Box gl.glPopMatrix(); gl.glPushMatrix(); //transforms #2 gl.glBegin(GL2.GL_QUADS); gl.glEnd(); gl.glPopMatrix(); The box is being drawn under transforms #2 instead of transforms #1, even though the begin/end block after transforms #2 is empty. |
The only solution I've found to this problem is to litter my code with blocks like
gl.glPushMatrix(); gl.glScalef( .001f , .001f, .001f); gl.glBegin( GL2.GL_QUADS ); gl.glEnd(); gl.glPopMatrix(); anytime I draw anything, making it draw these phantom objects really small somewhere I can't see them. Obviously this is a very unsatisfactory solution. |
Free forum by Nabble | Edit this page |