Hi to all I'm writing grafical simulation in jogl.
To generate terrain I'm using glTringlestrips and it's working fine. Now I wanted to add glutSolidSphere to simulate objects. And now problem scene is lighted ok without sphere but when I'm adding sphere is ligted properly and terrain is black |
ok maby I wasnt to precized so I'm linking my project.
thing is that only part of my project is lighted properly rest is black
when I'm swiching spheres rest is lighted properly
http://dl.dropbox.com/u/12358991/SimpleGLCanvas.rar
so any help would by fantastic
|
Administrator
|
Hi Tomasz,
It might be a bit much to ask someone to look at your entire project at once Maybe you could perform some experiments to narrow down the possible problem, then ask a simpler question? For example, what happens if you add a simple object like one triangle instead of a sphere? |
thing is simple all going on in the class GlRenderer.java and I'm using using glMaterial and my problem has somthing with settings of material propertis.
Some I've manage to resolve by my self Here are updated setings: float no_mat[] = { 0.1f, 0.1f, 0.3f, 0.0f };//materiał float mat_ambient[] = { 0.7f, 0.7f, 0.7f, 0.8f }; float mat_ambient_color[] = { 0.8f, 0.8f, 0.2f, 1.0f }; float mat_diffuse[] = { 0.3f, 0.5f,0.0f, 1.0f }; float mat_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f }; float no_shininess[] = { 0.0f }; float low_shininess[] = { 5.0f }; float high_shininess[] = { 75.0f } float green[] = { 0.5f, 0.2f, 0.4f, 0.0f};//kolor osi float red[] = { 0.7f, 0.0f, 0.0f, 0.5f}; gl.glMaterialfv(GL.GL_FRONT , GL.GL_AMBIENT, no_mat, 1); gl.glMaterialfv(GL.GL_FRONT, GL.GL_DIFFUSE, mat_diffuse, 1); gl.glMaterialfv(GL.GL_FRONT, GL.GL_SPECULAR, mat_specular, 1); gl.glMaterialfv(GL.GL_FRONT, GL.GL_SHININESS, high_shininess, 0); gl.glMaterialfv(GL.GL_FRONT, GL.GL_EMISSION, no_mat, 0); and for one group of spheres: gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, green, 1); second gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, red, 1); Now the colours show for all: terain + 2 grups of spheres, but I've lost all depth in tarrain coulors it's flat (no shadows no briter points) - but when I'm disconecting spheres is once again looking ok. I bet that this are material settings or somthing with light any idea would be helpfull p.s. I've added whole project because without all classes and imports you wouldn't be able to run it and see what I'm talnking about. |
ok I think that I've resolved my problim last and current setings.
float no_mat[] = { 0.0f, 0.0f, 0.0f, 0.0f };//materiał float mat_ambient[] = { 0.7f, 0.7f, 0.7f, 0.8f }; float mat_ambient_color[] = { 0.8f, 0.8f, 0.2f, 1.0f }; float mat_diffuse[] = { 0.3f, 0.5f,0.0f, 1.0f }; float mat_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f }; float no_shininess[] = { 0.0f }; float low_shininess[] = { 5.0f }; float high_shininess[] = { 75.0f }; float mat_emission[] = { 0.3f, 0.2f, 0.2f, 0.3f };//światło float ambient[] = { 1.0f, 1.0f, 1.0f, 0.8f }; float diffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f }; float specular[] = { 1.0f, 1.0f, 1.0f, 1.0f }; float position[] = { 70.0f, 6.0f, -25.5f, 0.5f }; float lmodel_ambient[] = { 0.4f, 0.4f, 0.4f, 1.0f }; float local_view[] = { 0.3f }; float green[] = { 0.5f, 0.2f, 0.4f, 0.0f};//kolor osi float red[] = { 0.7f, 0.0f, 0.0f, 0.5f}; //światło gl.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, ambient, 0); gl.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, diffuse, 0); gl.glLightfv(GL.GL_LIGHT0, GL.GL_SPECULAR,specular, 0); gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, position, 0); gl.glLightModelfv(GL.GL_LIGHT_MODEL_AMBIENT, lmodel_ambient, 0); gl.glLightModelfv(GL.GL_LIGHT_MODEL_COLOR_CONTROL, local_view, 0); gl.glEnable(GL.GL_LIGHT0); gl.glEnable(GL.GL_LIGHTING); and fills ok with me Another question sorry that in one post: how to make the light in one place eaven when I'm turning arround the scene( i know thees are the basics) but I don't have freas mind I know that I should push and pop matriks someware or add angles correction somwhere |
Administrator
|
On Sunday, November 21, 2010 17:35:16 Tomasz [via jogamp] wrote:
> Dear Tomasz, I am afraid this is not the best place to seek for basic OpenGL help. Not that you are not welcome here, sure you are, but don't hold your breath and wait for an answer too long. You may find more suitable boards & lists for these basic - not really JOGL related questions. http://www.gamedev.net/community/forums/ http://www.gamedev.net/community/forums/forum.asp?forum_id=31 Of course, if you encounter problems with JOGL we can help you here best. Cheers, Sven |
sorry to bother you
/close |
Administrator
|
On Monday, November 22, 2010 20:43:18 Tomasz [via jogamp] wrote:
> > sorry to bother you > /close > not bothering .. as I have written, the other source of information (forum, etc) might be much more helpful in your case. Cheers, Sven |
Free forum by Nabble | Edit this page |