• Content count

  • Joined

  • Last visited

Community Reputation

103 Neutral

About ruben7

  • Rank
  1. Hi guys, beginner here, I'm getting a very weird problem in opengl. Whenever I draw a glutWire or solid sphere, the lighting on the rest of my objects are disabled. Here's my Render method: [CODE] void RenderLights() { // x,y,z,w // w = 0 is directional; 1 is point light // create light components GLfloat ambientLight[] = { 0.2f, 0.2f, 0.2f, 1.0f }; GLfloat diffuseLight[] = { 0.8f, 0.8f, 0.8, 1.0f }; GLfloat specularLight[] = { 0.5f, 0.5f, 0.5f, 1.0f }; GLfloat position[] = { -10.0f, 1.0f, 10.0f, 1.0f }; // assign created components to GL_LIGHT0 glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight); glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight); glLightfv(GL_LIGHT0, GL_SPECULAR, specularLight); glLightfv(GL_LIGHT0, GL_POSITION, position); } // offset everything by the position of the player/camera glTranslatef(-camera->GetPosition().x, -camera->GetPosition().y, -camera->GetPosition().z); glPushMatrix(); RenderLights(); // this just sets materials and position glPopMatrix(); // this here draws all the Balls, their render method simply translates and glutSolidSphere() for(int i = 0; i < NUM_BALLS; i++) { glPushMatrix(); gameobj_list[i]->Render(); glPopMatrix(); } [/CODE] I've attached 2 screenshots, one with the glutSolidsphere() commented out and another drawing them.