This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Game Development and the fly likes Don't be like me Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Game Development
Reply Bookmark "Don Watch "Don New topic
Author

Don't be like me

Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24081
    
  15

Got bit by a JOGL "portability bug" that drove me crazy for about three hours today, and thought I'd report it so it didn't happen to anybody else!

OpenGL defines an unsigned int type "GLuint" which JOGL maps to a Java int. This isn't quite right, is it, because on most architectures, GLuint is a 32-bit unsigned int, while a Java int is signed. That means that some code originally written in C would not work right if naively translated to Java.

The function glGenLists() (which creates display lists, basically an enormous optimization) returns GLuint. It returns 0 on failure, and non-zero for success. On success, the return value is meaningful. Now, there exists C code that looks like



But in Java, glGenLists() can return a negative number on success, so this code would be broken.

So to make a long story short: NVIDIA's drivers return small positive integers here when used with GeForce3 or 4 or Quadro 8xx or 9xx cards; but the very same drivers return large negative numbers when you've got a Quadro FX card. The symptom was that the application ran very slowly on these high-end cards (because the optimization wasn't in force) and fast on cheaper cards. Took me three hours to track this down. Don't let this happen to you! Now the code says



[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Don't be like me
 
Similar Threads
CRC16 with Polynominal : 0x8408, and Preset CRC : 0x6363
Reading a String backward
Sun Cirtification
Odd issue - any ideas?
abs??