Search Results

Search found 4 results on 1 pages for 'badcodenotreat'.

Page 1/1 | 1 

  • How do I prevent jagged edges alongside the surfaces of my 3d model?

    - by badcodenotreat
    Lets say I've implemented in openGL a crude model viewer with shading which renders a series of blocks, such that I have something that looks like this. http://i.imgur.com/TsF7K.jpg Whenever I rotate my model to the side, it causes an unwanted jagged effect along any surface with a steep viewing angle. http://i.imgur.com/Bgl9o.jpg I'm pretty sure this is due to the polygon offset I used to prevent z-fighting between the model and the wireframe, however I'm not able to find the factor/unit parameters in openGL which prevent this unwanted effect. what are the best values of factor and unit for glPolygonOffset to prevent this? would implementing anti-aliasing alleviate the problem? is the trade off in performance trivial/significant? is this perhaps a shading issue? should i try a solution along this line of thought?

    Read the article

  • Lighting does not work with gluSphere

    - by badcodenotreat
    This is a simple issue that I'm somewhat ashamed to ask for help on. I'm making a simple call to gluSphere to render a sphere, however, it does not light properly even though I'm pretty sure I added the normals and lighting correctly. If, however, I add a texture, the model lights normally, except it seems to be always SMOOTH, and I cannot change it to flat. This is the lighting code in my init() function: gl.glLightfv( GL.GL_LIGHT0, GL.GL_AMBIENT , AMBIENT_LIGHT, 0 ); gl.glLightfv( GL.GL_LIGHT0, GL.GL_DIFFUSE , DIFFUSE_LIGHT, 0 ); gl.glLightfv( GL.GL_LIGHT0, GL.GL_POSITION, light_pos , 0 ); gl.glEnable ( GL.GL_LIGHT0 ); gl.glEnable ( GL.GL_LIGHTING ); this is my sphere code in my display() function: gl.glColor3d(1.0, 1.0, 1.0); glu.gluQuadricDrawStyle (quad, GLU.GLU_FILL); glu.gluQuadricNormals (quad, GLU.GLU_FLAT); glu.gluQuadricOrientation(quad, GLU.GLU_OUTSIDE); glu.gluSphere(quad, 1.0, lat, lon); Please advise.

    Read the article

  • How does Java handle multithreading?

    - by badcodenotreat
    How does Java decide which core to assign a thread or a process? Is there any way to control that? to prevent two large threads from executing on the same core? Basically what I am asking is for further information on either how multi-threading works in Java, or how to control it within Java.

    Read the article

  • Resizing a GLJPanel with JOGL causes my model to disappear.

    - by badcodenotreat
    I switched over to using a GLJPanel from a GLCanvas to avoid certain flickering issues, however this has created several unintended consequences of it's own. From what I've gleaned so far, GLJPanel calls GLEventListener.init() every time it's resized which either resets various openGL functions i've enabled in init() (depth test, lighting, etc...) if i'm lucky, or completely obliterates my model if i'm not. I've tried debugging it but I'm not able to correct this behavior. This is my init() function: gl.glShadeModel( GL.GL_SMOOTH ); gl.glEnable( GL.GL_DEPTH_TEST ); gl.glDepthFunc( GL.GL_LEQUAL ); gl.glDepthRange( zNear, zFar ); gl.glDisable( GL.GL_LINE_SMOOTH ); gl.glEnable(GL.GL_NORMALIZE); gl.glEnable( GL.GL_BLEND ); gl.glBlendFunc( GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA ); // set up the background color gl.glClearColor( ((float)backColor.getRed () / 255.0f), ((float)backColor.getGreen() / 255.0f), ((float)backColor.getBlue () / 255.0f), 1.0f); gl.glEnable ( GL.GL_LIGHTING ); gl.glLightfv( GL.GL_LIGHT0, GL.GL_AMBIENT, Constants.AMBIENT_LIGHT, 0 ); gl.glLightfv( GL.GL_LIGHT0, GL.GL_DIFFUSE, Constants.DIFFUSE_LIGHT, 0 ); gl.glEnable ( GL.GL_LIGHT0 ); gl.glTexEnvf( GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE ); gl.glHint( GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST ); // code to generate model Is there any way around this other than removing everything from init(), adding it to my display() function? Given the behavior of init() and reshape() for GLJPanel, i'm not sure if that will fix it either.

    Read the article

1