The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
#1
[Originally posted by plgliu]

Hi Jon:

I tried to run the FancyApp programs from your example files. I always got
java.lang.NullPointerException which I believe was because that the program
could not find the resources files (for example, the dirPath passed to
addIcons method was .... esourcescatalog). I put the resources files in
several difference hierarchical places but all failed. Can you please tell me
what I should do for avoiding this problem?

What I did was to generate a project (under JBuilder 4) called fancyapp and
under this project I generated all java files with the same name as your
example files then copied your files to each of mine.

Thank you!

G.B.
import-bot (20211) [Avatar] Offline
#2
Re: FancyApp
[Originally posted by plgliu]

Thank you Jon:

I fixed the problem for location of the resources. While I run the program, I
got the following error, no matter whether I run your programs in Dos under
the right directory or the copied program under my JBuilder 4.

wglMakeCurrent Failed: This function is not supported on this system.
extensionStr == null

I appreciate it if you could help disgnose the reason of this problem.



G.B.
import-bot (20211) [Avatar] Offline
#3
Re: FancyApp
[Originally posted by author]

Take a look at j3dui.utils.blocks.Blocks.java. It contains a method,
buildResourcePath(), used by all the examples for loading resources (models,
sounds, etc.). As noted in the javadoc, it only works from an example
directory (i.e. a subdirectory under "examples", such as examples/FancyApp/).
This method uses the constant RESOURCE_DIR to build the resource path. It is
set to "../../resources/", which means that for your example to work you have
to have the "resource" directory two levels up from your example directory
(look at the book software directory structure again).

--jon
import-bot (20211) [Avatar] Offline
#4
Further problem about Examples
[Originally posted by plgliu]

Thank you Jon:

I fixed the problem for location of the resources.
While I run the program, I got the following error,
no matter whether I run your programs from Dos under
the right directory or the copied program under my JBuilder 4.

wglMakeCurrent Failed: This function is not supported on this system.
extensionStr == null

I appreciate it if you could help disgnose the reason of this problem.



G.B.
import-bot (20211) [Avatar] Offline
#5
Further problem about Examples
[Originally posted by plgliu]

Thank you Jon:

I fixed the problem for location of the resources.
While I run the program, I got the following error,
no matter whether I run your programs from Dos under
the right directory or the copied program under my JBuilder 4.

wglMakeCurrent Failed: This function is not supported on this system.
extensionStr == null

I appreciate it if you could help disgnose the reason of this problem.



G.B.
import-bot (20211) [Avatar] Offline
#6
Further problem about Examples
[Originally posted by author]

This is not a method in the 3dui code. I'm not sure what class it is from or
how it was called. In any case, take a look at the stack trace. If you still
can't figure it out post the trace here and perhapsI or someone else can
figure it out.

--jon
import-bot (20211) [Avatar] Offline
#7
Further problem about Examples
[Originally posted by author]

I did a bit of research. wglMakeCurrent is a bridge function to get OpenGL to
work with Windows. Since j3dui is using Java and Java 3D in a normal fashion
(no magic functions or native code, not even JNI), my guess is that you have
found a bug in the "system". The question now is whose bug is it. Is it with
your flavor of Windows, OpenGL, or Java 3D. Also, you mention that you are
trying to use the code in JBuilder. Does the problem occur without JBuilder
around using the original j3dui code as released?

Perhaps someone else has some ideas. I don't, especially since I can't
reproduce the problem. If worse comes to worse you can try submitting it to
the Java 3D folks as a bug and see what they say.

--jon
import-bot (20211) [Avatar] Offline
#8
Further problem about Examples
[Originally posted by plgliu]

Hi Jon:

When I run your example programs from Dos, the error message:

wglMakeCurrent Failed: This function is not supported on this system.
extensionStr == null

keep being printed on the message window any time when I resize or move the
helpdialog window or the image window. This is also found in the copy of your
examples running under jbuilder4. I run the example programs copied from the
Tutorial named "Getting Started with the Java 3D API" and did not get this
kind of problem. wglMakeCurrent and extensionStr were found from a lot of
programs, inside and outside Java. One example is j3d.dll which is located
under jdk1.3/bin

I am guessing maybe some commands in your interface conflict with some thing
in J3d.dll. I appreciate it if you could help. Thank you!

G.B.
import-bot (20211) [Avatar] Offline
#9
possible bug with wglMakeCurrent
[Originally posted by plgliu]

The problem happens no matter whether I use JBuilder or just run your *.bat
files under DOS. It did not happen when I run some other J3D example
programs, I am wondering whether this is due to some specific functions in
J3Dui. Thank you for your soggestion. I am going to put it to J3d Forum to
see whether I can get some suggestion.

G.B.
import-bot (20211) [Avatar] Offline
#10
further test for wglMakeCurrent
[Originally posted by plgliu]

Hi Jon:

I tested all your example files under Jbuilder4 and found that
When I run MultiDisplaying and SimpleApp, the error messages:

extensionStr == null
wglMakeCurrent Failed: This function is not supported on this system.

kept displaying on the output window if I resized the image window. This was
not found in all other example files.

Therefore, I am guessing this was due to some problems related to these two
files.
import-bot (20211) [Avatar] Offline
#11
further test for wglMakeCurrent
[Originally posted by author]

Hmmm...As I recall, there are 3 examples that use dual displays: SimpleApp,
MultiDisplaying, and FancyApp. Are you sure FancyApp doesn't also exhibit the
problem? If so then my guess is that the problem has something to do with the
fact that OpenGL is being asked via Windows to display not one but two
displays in the same app. As to what the specific problem is and why your
setup is the only one I have heard of that exhibits this problem, who knows.

--jon
import-bot (20211) [Avatar] Offline
#12
FancyApp test for wglMakeCurrent
[Originally posted by plgliu]

Hi Jon:

Sorry for the late reply. I tested the FancyApp this time and found the same
problem as seen in SimpleApp and MultiDisplaying. Do you think I need to
install new version of OpenGL? By the way, I downloaded a StereoTest exmple
prigram which includes StereoTestMain and EyeWindow files. When I run it, I
got the same problem as the above three.

Thank you!

G.B.
import-bot (20211) [Avatar] Offline
#13
FancyApp test for wglMakeCurrent
[Originally posted by author]

Your problem defintely seems to be related to trying to use two displays at
the same time. Updating your OpenGL drivers can't hurt.

Good luck,
--jon
import-bot (20211) [Avatar] Offline
#14
wglMakeCurrent promlem again
[Originally posted by plgliu]

Hi Jon:

As this problem happened when I am running dual display, can you please
suggest some possible reason of this problem and any possible solution to it?
Thank you!

G.B.
import-bot (20211) [Avatar] Offline
#15
wglMakeCurrent promlem again
[Originally posted by author]

Sorry. I have no suggestions other than to update your OpenGL drivers. You
might also try another display card. You might also try it on a completely
different computer. Maybe somebody else has a better suggestion.

Good luck,
--jon
import-bot (20211) [Avatar] Offline
#16
wglMakeCurrent promlem solved
[Originally posted by plgliu]

Hi Jon:

Guess what? The graphic card of my PC is ATI Rage 128 VR which is not
supported by OpenGL. Therefore every time when I run example files like
FancyApp I get the error message:

wglMakeCurrent Failed: This function is not supported on this system.



I could not upgrade OpenGL as it does not have a driver for my graphic card.
I tried running the example files on another PC with different graphic card
and the problem did not show up again.

Thank you for your help!

G.B.