Anyone working on the NeHe tutorials?

Nope, just lots of time on the train due to business trips :smiley: I have another batch ready. Just need to package them…

Lesson17: 2D Texture fonts
Lesson20: Masking
Lesson23: Sphere mapping
Lesson26: Reflections
Lesson29: RAW files and blitter function
Lesson33: TGA files

Lesson 27: Shadow Volume
Damn I wish College didn’t start yet :’(.
Btw good job guys 8)

PS: Can I get confirmation on the fact that the ports run 20% faster than the original demos?
I mean here shadow volumes runs faster than its equivalent in C++, and so does the display lists.
Bump Mapping and Quadrics on the other hand run equally fast if not slightly faster ???

Request:
Could you guys include the fullscreen feature in your ports? pretty please :slight_smile:

Here’s few lines of code that might help


  public static void main(String []args) {

    int fullScreen = JOptionPane.showConfirmDialog(        null, "Would you like to run in fullscreen mode?",
                                                   "Fullscreen",  JOptionPane.YES_NO_OPTION);

    frame          = new JFrame();
    demo           = new Lesson27();
    screenWidth    = Toolkit.getDefaultToolkit().getScreenSize().width;
    screenHeight   = Toolkit.getDefaultToolkit().getScreenSize().height;

    switch(fullScreen){
      case 0:
        canvasWidth  = screenWidth;
        canvasHeight = screenHeight;
        frame.setUndecorated(true);
      break;
      default:
        canvasWidth  = 640;
        canvasHeight = 480;
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    xLocation    = (screenWidth  - canvasWidth )>>1;
    yLocation    = (screenHeight - canvasHeight)>>1;

    frame.setLocation(xLocation,yLocation);
    frame.getContentPane().add(demo.getCanvas(canvasWidth, canvasHeight),
                                              BorderLayout.CENTER);
    frame.pack();
    frame.requestFocus();
    frame.setVisible(true);
    if(fullScreen==0)
      GraphicsEnvironment.getLocalGraphicsEnvironment().
      getDefaultScreenDevice().setFullScreenWindow(frame);
  }

Thank you :slight_smile:

I elected not to do that as all that’s doing is maximizing the display to match the resolution of the desktop. This can severely affect framerates and isn’t the same as exclusive fullscreen mode.

I elected not to add exclusive fullscreen mode because it seemed to complicate the tutorial and make it more of an intermediate app rather than a beginner.

If we could come up with a common framework and distribution, then I’d be willing to use a common utility class. But the three of us are not packaging our tutorials the same or even structuring the code in a similar manner. Writing a common utility class we cna use might be hard.

Did you check the fullscreen that my demos features?
Besides, I try to minimize the number of classes I use, volume shadows for instance only got 1 more class than the equivalent code in c++.
Of course in no way I am implying that my code is better, it’s just different.
Aslo I would like to say how much I appreciate your efforts guys :slight_smile:

Yes, specifically 22. And performance is fine in windowed mode, but horrible in fullscreen. Adding a short line to display the final canvas resolution shows the app changed from 640x480 to 1600x1200 – which is my desktop resolution.

Had you gone into fullscreen exclusive mode, resolution would have remained at 640x480.

In case you haven’t seen it, the tutorial on fullscreen exclusive mode is here: http://java.sun.com/docs/books/tutorial/extra/fullscreen/

And I hope I didn’t come across as sounding like you were doing anything wrong. As you say, we’re just doing things differently. I’m trying to concentrate on keeping things simple, but perhaps I’m being too simple.

Excellent work guys, thanks very much for the effort!

:slight_smile:

Peter.

[quote]Yes, specifically 22. And performance is fine in windowed mode, but horrible in fullscreen. Adding a short line to display the final canvas resolution shows the app changed from 640x480 to 1600x1200 – which is my desktop resolution.

Had you gone into fullscreen exclusive mode, resolution would have remained at 640x480.

In case you haven’t seen it, the tutorial on fullscreen exclusive mode is here: http://java.sun.com/docs/books/tutorial/extra/fullscreen/

And I hope I didn’t come across as sounding like you were doing anything wrong. As you say, we’re just doing things differently. I’m trying to concentrate on keeping things simple, but perhaps I’m being too simple.
[/quote]
Speaking of fullscreen mode, I was thinking you’re referring to the frame where only the GLcanvas is seen.
And that’s exactly what my programs do as I undecorate my JFrame ( frame.setUndecorated(true); ) when fullscreen is selected.
My demos as you mentioned defaults to the desktop resolution when fullscreen is set to true. However it takes one line of code to change that to whatever resolution, refresh rate, color depth you want.
Also, man I’m impressed to hear that there are people running their desktop at the amazing resolution that is 16001200, you must have one excellent 19" monitor or simply a good 21", I’m envious ;D.
Speaking of performance I get 560 fps at 1024
768, 32bits no AA or AF set in the graphic driver.
In windowed mode which selects a frame size of 640480 it’s 830fps. Under the light of those two observations I could only speculate on the horrible performance drop occuring at 16001200.
Thanks for replying :slight_smile:

Done with Lesson 37: CellShading
I also Cleaned up my code a bit in the previous ports.
Here’s where you can download them.

Lesson12
Lesson18
Lesson22
Lesson27
Lesson37

Enjoy :slight_smile:
PS: If I had a stick, I would beat the stuffing outta the ReadMesh() function: Basically I had to learn everything about streams and byte to int/float conversions >:(

Great, please put in that line of code. It should set to 640x480@60hz. That’s safe on even the older monitors. I’m sure what color depth to default to. Either 16 or 32, but there should probably also be some fallback routine in case the mode is unavailable. I think 640x480:16@60 should work on all cards.

Yeah, but this pc doesn’t have a nice graphics card to match. It’s an ATI Rage 128 Ultra. :-/ At home, I’ve a GeForce2 in my laptop. It’s nice, but it’s aging.

Lesson09 NEW!!

I have updated all of my demos to work with Bitmaps instead of cheap PNGs, JPGs or GIFs.
I created a new texture loader that loads most of the common formats, I still have to implement TGA loading though, or steal pepi’s work ;D
Please redownload those, the quality of the textures is frankly better :slight_smile:

Lesson12
Lesson18
Lesson22
Lesson27
Lesson37

PS: I can’t get monitor resolution to change on my pc, it always reports a runtime error :’(

Feel free to use the tga loading from the relevant lesson. No use in reimplemting this. I do want to warn you that the TGA loading code is C-ish Java ;D
About the resolution switch: have you already set the fullscreen window when you call setDisplayMode. I think the docs mention that you have to be in fullscreen mode before being able to switch or otherwise you could get an exception.

Lesson34 NEW!!

I got fullscreen that defaults to 640*480 16Bpp @60Hz working in all my ports, two enthusiastics thumbs up for pepi ;D

If you don’t feel like re-downloading the demos and thus saving your bw, please replace the following line of code

if(fullScreen==0)
  GraphicsEnvironment.getLocalGraphicsEnvironment().
  getDefaultScreenDevice().setFullScreenWindow(frame);

with this one

if(fullScreen==0){
  GraphicsEnvironment.getLocalGraphicsEnvironment().
  getDefaultScreenDevice().setFullScreenWindow(frame);
  GraphicsEnvironment.getLocalGraphicsEnvironment().
  getDefaultScreenDevice().setDisplayMode((new DisplayMode(640, 480, 16, 60)));
}

Updated:
Lesson09
Lesson12
Lesson18
Lesson22
Lesson27
Lesson37

There’s a minimal TGA loader in the jogl-demos source tree.

Anyone up to the task of collecting all of these NeHe ports and getting them checked in to the jogl-demos tree?

[quote]There’s a minimal TGA loader in the jogl-demos source tree.
[/quote]
As opposed to personal loader-> patting one’s ego on the back ;D

I have all the examples done so far into the structure used by the demos area. The package is demos.nehe.lessonXX. All the data goes into demos.data.images or demos.data.models

I had to change some of the code to have it work correctly when run from a jar or the command line. Should clean some of it up at some point but for now here it is:

http://nlmueng.com/demos.jar

It is over a meg.

[quote]dum dee dee dum dee dum dum Another one bites the dust…
Lesson 18
Nforce2 Mobo
[/quote]
When I start this Lesson18 i got an "An unexpected exception has been detected in native code outside the VM. (…)
at net.java.games.jogl.impl.windows.WindowsGLImpl.glDisable(Native Method)
at Lesson18.keyPressed(Lesson18.java:284)
"

So, if I want to run properly this lesson18, I must change the code and move lines " if(!light)
gl.glDisable(GL.GL_LIGHTING);
else
gl.glEnable(GL.GL_LIGHTING);" in the keyPressed method just after the line 215 (“gl.glBindTexture(gl.GL_TEXTURE_2D, texture[filter]);”)

and now it’s work fine.

I have a GeForce4TI4200 with the Nvidia Driver 44.67 and JVM “1.4.1-b21 mixed mode”

Xerif
bye

I got this kind of errors for the most of the tutorials and reported one before. I am using RH linux 7.2 and not sure about graphic card and driver.

But I can run the c code from NEHE with some modification. For example, The lesson 11. I changed
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH) to without using GLUT_ALPHA), then the c code runs fine.

Thanks.

wz

I have noticed a similar problem running Jogl on Linux. It seems that requesting an alpha component for the color buffer crashes the default graphics driver (I’m running RedHat 9.0). For me, switching to use the default GLCapabilities parameters, which requests 0 alpha bits, fixed my problem.

Sean