Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (483)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (550)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Working with lights (NeHe tutorial 7)  (Read 1477 times)
0 Members and 1 Guest are viewing this topic.
Offline DanK

Junior Member




Javver games rock yawel!


« Posted 2003-08-05 19:07:36 »

I've been working through the NeHe tutorials in an attempt to learn OpenGL, and I've hit a snag up, the lighting doesn't seem to be enabled. I've checked the code and it all seems to be there, in the same order even as listed in the tutorial.

Is there a jogl light demo floating around that I can compare to? I'm pretty sure I'm missing some step to enable lighting.

float LightAmbient[]= { 0.5f, 0.5f, 0.5f, 1f };
float LightDiffuse[]= { 1.0f, 1.0f, 1.0f, 1.0f };
float LightPosition[]= { 0.0f, 0.0f, 2.0f, 1.0f };
gl.glLightfv(gl.GL_LIGHT1, gl.GL_AMBIENT, LightAmbient);
gl.glLightfv(gl.GL_LIGHT1, gl.GL_DIFFUSE, LightDiffuse);
gl.glLightfv(gl.GL_LIGHT1, gl.GL_POSITION,LightPosition);
gl.glEnable(gl.GL_LIGHT1);

Other than generating the normals that's all the code that appears to have anything to do with lighting (it sits in the init method). I'm pretty sure I'm missing something simple or maybe jogl requires some slightly different step to enable the lighting. Your help is appreciated.

Offline Mojomonkey

Senior Member




ooh ooh eee eeee


« Reply #1 - Posted 2003-08-05 19:08:48 »

gl.glEnable(gl.GL_LIGHTING);

Don't send a man to do a monkey's work.
Offline DanK

Junior Member




Javver games rock yawel!


« Reply #2 - Posted 2003-08-05 19:37:28 »

I KNEW it, after seeing the answer being something obvious like I suspected, I went through the tutorial and realized his on/off code for the lighting used GL_LIGHTING and not the GL_LIGHT1 I was using to switch the lighting on and off... I didn't use his keyboard control because it didn't fit with how java handles the keyboard... and carefully screwed the entire program up Smiley

Thanks for the answer Mojomonkey

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (19 views)
2014-08-22 19:31:30

atombrot (30 views)
2014-08-19 09:29:53

Tekkerue (26 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (15 views)
2014-08-16 06:20:21

Tekkerue (24 views)
2014-08-16 06:12:11

Rayexar (63 views)
2014-08-11 02:49:23

BurntPizza (40 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (38 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!