Note that there are some explanatory texts on larger screens.

plurals
  1. POJOGL - lighting/camera
    primarykey
    data
    text
    <p>Ive added a light source to my JOGL project which seems to work quite well when the object is stationary, when I move the camera it gradually gets darker as it rotates, which is what id expect but as soon as it rotates 90 degree the screen goes completely black, does anyone know why this is? Do I need to another light source for the other side? I was hoping it would kind of act like the sun, i.e. light up the whole scene but be slightly darker when the camera is on the other side of the object.</p> <p>Lighting</p> <pre><code>float light_ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f }; float light_diffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f }; float light_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f }; float light_position[] = { 1.0f, 1.0f, 1.0f, 0.0f }; gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_AMBIENT, light_ambient, 0); gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_DIFFUSE, light_diffuse, 0); gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_SPECULAR, light_specular, 0); gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, light_position, 0); gl.glEnable(GL2.GL_LIGHTING); gl.glEnable(GL2.GL_LIGHT0); gl.glDepthFunc(GL.GL_LESS); gl.glEnable(GL.GL_DEPTH_TEST); </code></pre> <hr> <p>Secondly, when the camera rotates some of the shapes seem to deform and look like completely different shapes, i.e. cubes turning pincushion like, sides being stretched an incredible amount and its making my whole object look slightly deformed. Is there an easy way to change this? Ive tried messing with <code>gluPerspective</code> and that doesnt seem to do change what I want either. Is there any way around this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload