IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Java Discussion :

Que veut dire cette erreur (au runtime) ?


Sujet :

Java

  1. #1
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    54
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Décembre 2006
    Messages : 54
    Points : 26
    Points
    26
    Par défaut Que veut dire cette erreur (au runtime) ?
    Bonjour,
    Le programme compile mais quand je le lance il mecrit cela:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    run:
    Exception in thread "main" java.lang.NullPointerException: Canvas3D: null GraphicsConfiguration
            at javax.media.j3d.Canvas3D.checkForValidGraphicsConfig(Canvas3D.java:954)
            at javax.media.j3d.Canvas3D.<init>(Canvas3D.java:997)
            at courseworkjava3d.Simple3D.<init>(Simple3D.java:42)
            at courseworkjava3d.Simple3D.main(Simple3D.java:982)
    Je suis a 100% certain que cela marchait sans que je touche au code, et maintenant cela me faire cela, sous netbeans 5.5

    Je le sais car jai fait un backup qui fonctionnait et quand jai verifier avec le backup, cela me fait ca aussi...

    Je precise je "cleane" le project avant de compiler! et je ferme les "runtimes process" sous netbeans 5.5


    Merci!

  2. #2
    Membre éclairé Avatar de LeXo
    Profil pro
    Inscrit en
    Janvier 2004
    Messages
    1 147
    Détails du profil
    Informations personnelles :
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Janvier 2004
    Messages : 1 147
    Points : 868
    Points
    868
    Par défaut
    que t'as pas instancié un objet

    mais avec le code ça serait plus facile
    Plzzz pas de questions par MP.

  3. #3
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    54
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Décembre 2006
    Messages : 54
    Points : 26
    Points
    26
    Par défaut
    Citation Envoyé par LeXo Voir le message
    mais avec le code ça serait plus facile
    erm....Merci de ton aide!

    Je crains que vous allez pleurer pour le code...

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794
    795
    796
    797
    798
    799
    800
    801
    802
    803
    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    829
    830
    831
    832
    833
    834
    835
    836
    837
    838
    839
    840
    841
    842
    843
    844
    845
    846
    847
    848
    849
    850
    851
    852
    853
    854
    855
    856
    857
    858
    859
    860
    861
    862
    863
    864
    865
    866
    867
    868
    869
    870
    871
    872
    873
    874
    875
    876
    877
    878
    879
    880
    881
    882
    883
    884
    885
    886
    887
    888
    889
    890
    891
    892
    893
    894
    895
    896
    897
    898
    899
    900
    901
    902
    903
    904
    905
    906
    907
    908
    909
    910
    911
    912
    913
    914
    915
    916
    917
    918
    919
    920
    921
    922
    923
    924
    925
    926
    927
    928
    929
    930
    931
    932
    933
    934
    935
    936
    937
    938
    939
    940
    941
    942
    943
    944
    945
    946
    947
    948
    949
    950
    951
    952
    953
    954
    955
    956
    957
    958
    959
    960
    961
    962
    963
    964
    965
    966
    967
    968
    969
    970
    971
    972
    973
    974
    975
    976
    977
    978
    979
    980
    981
     
    package courseworkjava3d;
     
    import java.awt.*;
    import java.awt.event.*;
    import com.sun.j3d.utils.geometry.*;
    import com.sun.j3d.utils.universe.*;
    import javax.swing.*;
    import javax.media.j3d.*;
    import javax.vecmath.*;
    import javax.media.j3d.PositionPathInterpolator;
    import javax.media.j3d.Alpha;
    import javax.media.j3d.BoundingSphere;
    import com.sun.j3d.utils.applet.MainFrame;
    import java.applet.Applet;
    import java.awt.event.WindowAdapter;
    import javax.swing.Timer;
    import com.sun.j3d.utils.image.*;
     
    public class Simple3D extends JFrame implements ActionListener, KeyListener
    {
     
     
    private TransformGroup objTransxx;
    private Button go = new Button("Press to start the Bouncing Ball. Press A and S to move the ball Left and Right once it started!");
     
    private Transform3D transxx = new Transform3D();
     
    private float height=0.0f;
     
    private float sign = 1.0f; // aller vers le haut ou vers le bas
     
    private Timer timer;
     
    private float xloc=-2.25f;
     
     
      public Simple3D()
      {
        setSize(800, 800);
        GraphicsConfiguration graphicsConfig = SimpleUniverse.getPreferredConfiguration();
        Canvas3D canvas = new Canvas3D(graphicsConfig);
        getContentPane().add("Center", canvas);
        BasicUniverse universe = new BasicUniverse(canvas, 8.0f);
     
        // Rotate the view platform by PI/4 radians about X in the BasicUniverse
        TransformGroup viewTransform = universe.getViewPlatformTransform();
        Transform3D transform = new Transform3D();
        transform.rotX(-Math.PI / 4.0);
        Transform3D currentTransform = new Transform3D();
        viewTransform.getTransform(currentTransform);
        transform.mul(currentTransform);
        viewTransform.setTransform(transform);
     
        // Add something to display
        BranchGroup scene = createCubeGraph();
        universe.addBranchGraph(scene);
     
        /* //ultra important! comment theses lines otherwise it bugs!
        //Merde
        setLayout(new BorderLayout());
     
    GraphicsConfiguration config =
     
    SimpleUniverse.getPreferredConfiguration();
     
    Canvas3D c = new Canvas3D(config); */
     
     
    add("Center", canvas);
     
    //i messed up te code, i replaced canvas c by "canvas" as i already had one!
    canvas.addKeyListener(this);
     
    timer = new Timer(75,this);
     
    //timer.start();
     
    Panel p =new Panel();
     
    p.add(go);
     
    add("North",p);
     
    go.addActionListener(this);
     
    go.addKeyListener(this);
     
    // Créer une scène simple et l’ajouetr à l’univers
     
    //BranchGroup scene2 = createCubeGraph();
     
    //SimpleUniverse u = new SimpleUniverse(c);
     
    //u.getViewingPlatform().setNominalViewingTransform();
     
    //u.addBranchGraph(scene2);
        //End Merde
      }
     
      public BranchGroup createCubeGraph() {
     
          BranchGroup Humanoid = new BranchGroup();
     
     
          //Debut Ball REBOUND
     
    // Create the root of the branch graph
     
    //BranchGroup objRoot = new BranchGroup();
     
    objTransxx = new TransformGroup();
     
    objTransxx.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
     
    Humanoid.addChild(objTransxx);
     
    // Créer une forme simple et l’ajouter au graph de scène
     
    Sphere spherex = new Sphere(0.85f);
     
    objTransxx = new TransformGroup();
     
    objTransxx.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
     
    Transform3D pos1 = new Transform3D();
     
    pos1.setTranslation(new Vector3f(-2.0f,0.0f,-2.0f));
     
    objTransxx.setTransform(pos1);
     
    objTransxx.addChild(spherex);
     
    Humanoid.addChild(objTransxx);
     
    BoundingSphere boundsx =
     
    new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
     
     
    // I messed up the colors: I have applied 2 times some colorslights to the same BranchGroup
    Color3f light1Colorx = new Color3f(1.0f, 1.0f, 1.0f);
     
    Vector3f light1Directionx = new Vector3f(4.0f, -7.0f, -12.0f);
     
    DirectionalLight light1x
     
    = new DirectionalLight(light1Colorx, light1Directionx);
     
    light1x.setInfluencingBounds(boundsx);
     
    Humanoid.addChild(light1x);
     
    // Régler la lumière ambiante
     
    Color3f ambientColorx = new Color3f(1.0f, 1.0f, 1.0f);
     
    AmbientLight ambientLightNodex = new AmbientLight(ambientColorx);
     
    ambientLightNodex.setInfluencingBounds(boundsx);
     
    Humanoid.addChild(ambientLightNodex);
     
     
          // END BallRebound
     
     
    //  Apparence BODY
     
    // Configurer les couleurs
     
    Color3f blackbody = new Color3f(0.0f, 0.0f, 0.0f);
     
    Color3f whitebody = new Color3f(1.0f, 1.0f, 1.0f);
     
    Color3f redbody = new Color3f(0.8f, .85f, .85f);
     
     
    // Configurer la texture
    //if I want it in Black and white i need to replace RGB by LUMINANCE
    TextureLoader loaderbody = new TextureLoader("F:\\java3d\\body.jpg", "RGB", new Container());
     
    Texture texturebody = loaderbody.getTexture();
     
    texturebody.setBoundaryModeS(Texture.WRAP);
     
    texturebody.setBoundaryModeT(Texture.WRAP);
     
    texturebody.setBoundaryColor( new Color4f( 1.0f, 1.0f, 0.0f, 0.0f ) );
     
    // Configurer les attributs de la texture
     
    // Paramètres possibles : REPLACE, BLEND ou DECAL (ici, MODULATE)
     
    TextureAttributes texAttrbody = new TextureAttributes();
     
    texAttrbody.setTextureMode(TextureAttributes.MODULATE);
     
    Appearance apbody = new Appearance();
     
    apbody.setTexture(texturebody);
     
    apbody.setTextureAttributes(texAttrbody);
     
    //Configurer le matériau
     
    apbody.setMaterial(new Material(redbody, blackbody, redbody, blackbody, 1.0f));
     
    // Créer une sphère pour y appliquer les textures
     
    int primflagsbody = Primitive.GENERATE_NORMALS + Primitive.GENERATE_TEXTURE_COORDS;
    //  End Apparence BODY
     
     
     
    //  Apparence BODYHEAD
     
    // Configurer les couleurs
     
    Color3f blackbodyH = new Color3f(0.0f, 0.0f, 0.0f);
     
    Color3f whitebodyH = new Color3f(1.0f, 1.0f, 1.0f);
     
    Color3f redbodyH = new Color3f(0.8f, .85f, .85f);
     
     
    // Configurer la texture
    //if I want it in Black and white i need to replace RGB by LUMINANCE
    TextureLoader loaderbodyH = new TextureLoader("F:\\java3d\\head.jpg", "RGB", new Container());
     
    Texture texturebodyH = loaderbodyH.getTexture();
     
    texturebodyH.setBoundaryModeS(Texture.WRAP);
     
    texturebodyH.setBoundaryModeT(Texture.WRAP);
     
    texturebodyH.setBoundaryColor( new Color4f( 1.0f, 1.0f, 0.0f, 0.0f ) );
     
    // Configurer les attributs de la texture
     
    // Paramètres possibles : REPLACE, BLEND ou DECAL (ici, MODULATE)
     
    TextureAttributes texAttrbodyH = new TextureAttributes();
     
    texAttrbodyH.setTextureMode(TextureAttributes.MODULATE);
     
    Appearance apbodyH = new Appearance();
     
    apbodyH.setTexture(texturebodyH);
     
    apbodyH.setTextureAttributes(texAttrbodyH);
     
    //Configurer le matériau
     
    apbodyH.setMaterial(new Material(redbodyH, blackbodyH, redbodyH, blackbodyH, 1.0f));
     
    // Créer une sphère pour y appliquer les textures
     
    int primflagsbodyH = Primitive.GENERATE_NORMALS + Primitive.GENERATE_TEXTURE_COORDS;
    //  End Apparence BODY HEAD
     
     
          //for the trunk c le corps
          TransformGroup fortheTrunk = new TransformGroup();
     
     
          //will allow to modify object wgile executing
          fortheTrunk.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
     
          //alpha rotation time related
          Alpha rotationAlpha2=new Alpha(-1,9000);
     
          //behviour for our rotation
          RotationInterpolator rotator2= new RotationInterpolator(rotationAlpha2,fortheTrunk);
     
           // area where rotation will be
          BoundingSphere bounds2=new BoundingSphere();
          rotator2.setSchedulingBounds(bounds2);
          fortheTrunk.addChild(rotator2);
     
            //end of rtotation
     
     
          Alpha transAlphahuman=new Alpha(-1,600);
           //transform 3d trans for the interpolatipon HUMANOID
          Transform3D transhumanoid=new Transform3D();
          //matrix for 2positions
          Point3f[] cheminhuman=new Point3f[3];
          cheminhuman[0]=new Point3f(0.8f,0.0f,0.0f);
          cheminhuman[1]=new Point3f(-0.8f,0.0f,0.0f);         
          cheminhuman[2]=new Point3f(0.8f,0.0f,0.0f);
          //matrix of floats to make the dots match with timeline
          float[] timePositionhuman={0.0f,0.50f,1.0f};
          PositionPathInterpolator interpolhuman=new PositionPathInterpolator(transAlphahuman,fortheTrunk,transhumanoid,timePositionhuman,cheminhuman);
          BoundingSphere bounds4=new BoundingSphere();
          interpolhuman.setSchedulingBounds(bounds4);
          fortheTrunk.addChild(interpolhuman);
     
     
     
          //add the trunk to the branchgroup
          Humanoid.addChild(fortheTrunk);
     
     
            TransformGroup zeTrunk = new TransformGroup();
          zeTrunk.addChild(new com.sun.j3d.utils.geometry.Box(.55f,.80f,.50f,
                primflagsbody,apbody));
     
     
     
     
          //t3D for the head= bouge up
          Transform3D T3DHead = new Transform3D();
          T3DHead.set(new Vector3f(0f,1.1f,0f));
     
          //create a tranform group for this t3Dhead
          TransformGroup fortheHead = new TransformGroup();
          fortheHead.setTransform(T3DHead);
     
          //add the box head
          //fortheHead.addChild(new com.sun.j3d.utils.geometry.Box(.20f,.20f,.10f, primflagsbody,apbody));
          fortheHead.addChild(new com.sun.j3d.utils.geometry.Sphere(0.35f,primflagsbodyH,apbodyH));
     
          /* I dont need that anymore it was for putting a flat texture on a face. I chose a sphere instead!
          //transform 3D for the face
          Transform3D T3DFace = new Transform3D();
          T3DFace.set(new Vector3f(0f,0f,.14f));
          
          //create a TransformGroup for this Face
          TransformGroup Face = new TransformGroup();
          Face.setTransform(T3DFace);
          
          //add the child box to the face;
          Face.addChild(new com.sun.j3d.utils.geometry.Box(.20f,.20f,.2f,
                primflagsbodyH,apbodyH));
          
          //add this face to the head as a child
          fortheHead.addChild(Face);
          */
     
     
          //tranform3d left arm
          Transform3D T3DArmL = new Transform3D();
          T3DArmL.set(new Vector3f(-0.79f,0.73f,0f));
     
          //create Tranform Group for the leftarm
          TransformGroup fortheArmL = new TransformGroup();
          fortheArmL.setTransform(T3DArmL);
     
          //add the group for upperarm
     
          TransformGroup ArmL = new TransformGroup();
          ArmL.addChild(new com.sun.j3d.utils.geometry.Box(.25f,.14f,.10f,
               primflagsbody,apbody));
     
          fortheArmL.addChild(ArmL);
     
          //create a transform3D for the forearmleft
          Transform3D T3DForearmL = new Transform3D();
          T3DForearmL.set(new Vector3f(-.51f,0f,0f));
     
     
          //create the tranformgroup for the forearmleft
          TransformGroup ForearmL = new TransformGroup();
          ForearmL.setTransform(T3DForearmL);
     
          //add the child box to forearm
          ForearmL.addChild(new com.sun.j3d.utils.geometry.Box(.20f,.14f,.10f,
                primflagsbody,apbody));
     
          ArmL.addChild(ForearmL);
     
     
          //create transform 3d for the lefthand
          Transform3D T3DHandL = new Transform3D();
          T3DHandL.set(new Vector3f(-.42f,0f,0f));
     
          //create the child tranform group for the box of the hand
          TransformGroup HandL= new TransformGroup();
          HandL.setTransform(T3DHandL);
     
          //add the child hand to the forearm
          ForearmL.addChild(HandL);
     
          //create the box for the handLeft
          HandL.addChild(new com.sun.j3d.utils.geometry.Box(.10f,.140f,.10f,
               primflagsbody,apbody));
     
     
          //Right Arm
          //tranform3d right arm
          Transform3D T3DArmR = new Transform3D();
          T3DArmR.set(new Vector3f(0.79f,0.73f,0f));
     
          //create Tranform Group for the right arm
          TransformGroup fortheArmR = new TransformGroup();
          fortheArmR.setTransform(T3DArmR);
     
          //add the group for upperarm right
     
          TransformGroup ArmR = new TransformGroup();
          ArmR.addChild(new com.sun.j3d.utils.geometry.Box(.25f,.14f,.10f, primflagsbody,apbody));
               //com.sun.j3d.utils.geometry.Box.GENERATE_NORMALS,new Appearance()));
     
     
          fortheArmR.addChild(ArmR);
     
          //create a transform3D for the forearmright
          Transform3D T3DForearmR = new Transform3D();
          T3DForearmR.set(new Vector3f(.51f,0f,0f));
     
     
          //create the tranformgroup for the forearmright
          TransformGroup ForearmR = new TransformGroup();
          ForearmR.setTransform(T3DForearmR);
     
          //add the child box to forearmright
          ForearmR.addChild(new com.sun.j3d.utils.geometry.Box(.20f,.14f,.10f, primflagsbody,apbody));
     
          ArmR.addChild(ForearmR);
     
          //create transform 3d for the righthand
          Transform3D T3DHandR = new Transform3D();
          T3DHandR.set(new Vector3f(.42f,0f,0f));
     
          //create the child tranform group for the box of the hand
          TransformGroup HandR= new TransformGroup();
          HandR.setTransform(T3DHandR);
     
          //add the child hand to the forearmright
          ForearmR.addChild(HandR);
     
          //create the box for the handright
          HandR.addChild(new com.sun.j3d.utils.geometry.Box(.10f,.14f,.10f, primflagsbody,apbody));
     
     
     
          //Left Leg
          //tranform3d left leg
          Transform3D T3DLegL = new Transform3D();
          T3DLegL.set(new Vector3f(0.43f,-1.23f,0f));
     
          //create Tranform Group for the leftleg
          TransformGroup fortheLegL = new TransformGroup();
          fortheLegL.setTransform(T3DLegL);
     
          //add the group for uppeleg
     
          TransformGroup LegL = new TransformGroup();
          LegL.addChild(new com.sun.j3d.utils.geometry.Box(.16f,.35f,.10f, primflagsbody,apbody));
     
          fortheLegL.addChild(LegL);
     
          //create a transform3D for the downlegleft
          Transform3D T3DDownLegL = new Transform3D();
          T3DDownLegL.set(new Vector3f(0f,-.70f,0f));
     
     
          //create the tranformgroup for the downegleft
          TransformGroup DownLegL = new TransformGroup();
          DownLegL.setTransform(T3DDownLegL);
     
          //add the child box to downlegm
          DownLegL.addChild(new com.sun.j3d.utils.geometry.Box(.16f,.25f,.10f, primflagsbody,apbody));
     
          LegL.addChild(DownLegL);
     
          //create transform 3d for the leftfeet
          Transform3D T3DFeetL = new Transform3D();
          T3DFeetL.set(new Vector3f(.0f,-.45f,0f));
     
          //create the child tranform group for the box of thefeet
          TransformGroup FeetL= new TransformGroup();
          FeetL.setTransform(T3DFeetL);
     
          //add the child hand to the downleg
          DownLegL.addChild(FeetL);
     
          //create the box for the feetLeft
          FeetL.addChild(new com.sun.j3d.utils.geometry.Box(.16f,.10f,.15f, primflagsbody,apbody));
     
     
          //Right Leg
          //tranform3dright leg
          Transform3D T3DLegR = new Transform3D();
          T3DLegR.set(new Vector3f(-0.43f,-1.23f,0f));
     
          //create Tranform Group for the righttleg
          TransformGroup fortheLegR = new TransformGroup();
          fortheLegR.setTransform(T3DLegR);
     
          //add the group for uppelegR
     
          TransformGroup LegR = new TransformGroup();
          LegR.addChild(new com.sun.j3d.utils.geometry.Box(.16f,.35f,.10f, primflagsbody,apbody));
     
          fortheLegR.addChild(LegR);
     
          //create a transform3D for the downlegright
          Transform3D T3DDownLegR = new Transform3D();
          T3DDownLegR.set(new Vector3f(0f,-.70f,0f));
     
     
          //create the tranformgroup for the downegright
          TransformGroup DownLegR = new TransformGroup();
          DownLegR.setTransform(T3DDownLegR);
     
          //add the child box to downlegRight
          DownLegR.addChild(new com.sun.j3d.utils.geometry.Box(.16f,.25f,.10f, primflagsbody,apbody));
     
          LegR.addChild(DownLegR);
     
          //create transform 3d for the rightfeet
          Transform3D T3DFeetR = new Transform3D();
          T3DFeetR.set(new Vector3f(.0f,-.45f,0f));
     
          //create the child tranform group for the box of thefeetright
          TransformGroup FeetR= new TransformGroup();
          FeetR.setTransform(T3DFeetR);
     
          //add the child feet right to the downleg
          DownLegR.addChild(FeetR);
     
          //create the box for the feetright
          FeetR.addChild(new com.sun.j3d.utils.geometry.Box(.16f,.10f,.15f, primflagsbody,apbody));
     
          //rajoute la box zetrunk et des fils
          fortheTrunk.addChild(zeTrunk);
          fortheTrunk.addChild(fortheHead);
          fortheTrunk.addChild(fortheArmL);
          fortheTrunk.addChild(fortheArmR);
          fortheTrunk.addChild(fortheLegL);
          fortheTrunk.addChild(fortheLegR);
     
     
     
     
      //DEBUT CUBE
            //beginning of rotation
          TransformGroup objSpin=new TransformGroup();
     
     
          //create transform 3d for box which spin
          Transform3D T3DobjSpin = new Transform3D();
          T3DobjSpin.set(new Vector3f(-2.50f,.45f,0f));
     
          //create the child tranform group for the box which spin
          objSpin.setTransform(T3DobjSpin);
     
          //will allow to modify object while executing
          objSpin.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
     
          //alpha rotation time related
          Alpha rotationAlpha=new Alpha(-1,900);
     
          Alpha transAlpha=new Alpha(-1,900);
     
          //transform 3d trans for the interpolatipon
          Transform3D trans=new Transform3D();
          //matrix for 2positions
          Point3f[] chemin=new Point3f[3];
          chemin[0]=new Point3f(-2.8f,0.40f,1.0f);
          chemin[1]=new Point3f(-0.8f,0.40f,1.0f);         
          chemin[2]=new Point3f(-2.8f,0.40f,1.0f);
          //matrix of floats to make the dots match with timeline
          float[] timePosition={0.0f,0.50f,1.0f};
          PositionPathInterpolator interpol=new PositionPathInterpolator(transAlpha,objSpin,trans,timePosition,chemin);
          BoundingSphere bounds3=new BoundingSphere();
          interpol.setSchedulingBounds(bounds3);
          objSpin.addChild(interpol);
     
          //behviour for our rotation
          RotationInterpolator rotator= new RotationInterpolator(rotationAlpha,objSpin);
     
           // area where rotation will be
          BoundingSphere bounds=new BoundingSphere();
          rotator.setSchedulingBounds(bounds);
          objSpin.addChild(rotator);
     
            //end of rtotation
     
     
          //add transform group objspin to branchgroup humanoid
          Humanoid.addChild(objSpin);
     
     
          //test a cube which heritate of this rotation?
         objSpin.addChild(new ColorCube(0.25));
          //test
     
      //END CUBE
     
      //DEBUT WHOLE BIRD
            //beginning of Rotation for Bird
          TransformGroup Bird=new TransformGroup();
     
          //will allow to modify object while executing
          Bird.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
     
          //alpha rotation time related
          Alpha rotationAlphaBird=new Alpha(-1,400);
          Alpha transAlphaBird=new Alpha(-1,5990);
     
          //transform 3d trans for the interpolatipon
          Transform3D transBird=new Transform3D();
     
              //create transform 3d for the Bird
          transBird.set(new Vector3f(1.90f,-.45f,0.9f));
     
          //create the child tranform group for the Bird Box
          Bird.setTransform(transBird);
     
          //matrix for 2positions
          Point3f[] cheminBird=new Point3f[3];
          cheminBird[0]=new Point3f(1.95f,0.0f,-6.8f);
          cheminBird[1]=new Point3f(1.95f,0.90f,-0.8f);         
          cheminBird[2]=new Point3f(1.95f,0.0f,5.8f);
     
          //matrix of floats to make the dots match with timeline
          float[] timePositionBird={0.00f,0.50f,1.0f};
          PositionPathInterpolator interpolBird=new PositionPathInterpolator(transAlphaBird,Bird,transBird,timePosition,cheminBird);
          BoundingSphere bounds3Bird=new BoundingSphere();
          interpolBird.setSchedulingBounds(bounds3Bird);
          Bird.addChild(interpolBird);
     
          //behviour for our rotation
          RotationInterpolator rotatorBird= new RotationInterpolator(rotationAlphaBird,Bird);
     
           // area where rotation will be
          BoundingSphere boundsBird=new BoundingSphere();
          rotatorBird.setSchedulingBounds(boundsBird);
          Bird.addChild(rotatorBird);
     
            //end of rotation For Bird
     
     
            //add transform group objspin to branchgroup humanoid
          Humanoid.addChild(Bird);
     
     
          //debut test APPARENCE Wing Left
     
    //test textures
    // Configurer les couleurs
     
    Color3f blackx = new Color3f(0.0f, 0.0f, 0.0f);
     
    Color3f whitex = new Color3f(1.0f, 1.0f, 1.0f);
     
    Color3f redx = new Color3f(0.7f, .75f, .75f);
     
    // Configurer la texture
     
    TextureLoader loaderx = new TextureLoader("F:\\java3d\\pois.jpg", "RGB", new Container());
     
    Texture texturex = loaderx.getTexture();
     
    texturex.setBoundaryModeS(Texture.WRAP);
     
    texturex.setBoundaryModeT(Texture.WRAP);
     
    texturex.setBoundaryColor( new Color4f( 0.0f, 1.0f, 0.0f, 0.0f ) );
     
    // Configurer les attributs de la texture
     
    // Paramètres possibles : REPLACE, BLEND ou DECAL (ici, MODULATE)
     
    TextureAttributes texAttrx = new TextureAttributes();
     
    texAttrx.setTextureMode(TextureAttributes.REPLACE);
     
    Appearance apx = new Appearance();
     
    apx.setTexture(texturex);
     
    apx.setTextureAttributes(texAttrx);
     
    //Configurer le matériau
     
    apx.setMaterial(new Material(redx, blackx, redx, blackx, 1.0f));
    int primflagsx = Primitive.GENERATE_NORMALS + Primitive.GENERATE_TEXTURE_COORDS;
     //End test APPARENCE Wing Left
     
          //test a cube which heritate of this rotation?
        // Bird.addChild(new ColorCube(0.8));
     
         //test bird body
        // Bird.addChild(new com.sun.j3d.utils.geometry.Box(.25f,.22f,.45f,
        //       com.sun.j3d.utils.geometry.Box.GENERATE_NORMALS,new Appearance()));
          Bird.addChild(new com.sun.j3d.utils.geometry.Box(.25f,.22f,.45f, primflagsx,apx)); 
     
     
         //test WingRightBird
     
            //create a transform3D for the BirdWIngR
          Transform3D T3DBirdWingR = new Transform3D();
          T3DBirdWingR.set(new Vector3f(0.45f,.0f,-0.35f));
     
         //create the tranformgroup for the BirdWIngR
          TransformGroup BirdWingR = new TransformGroup();
          BirdWingR.setTransform(T3DBirdWingR);
     
     
          //add the child box to  BirdWIngR
        //  BirdWingR.addChild(new com.sun.j3d.utils.geometry.Box(.43f,.07f,.22f,
         //      com.sun.j3d.utils.geometry.Box.GENERATE_NORMALS,new Appearance()));
     
          //End test WingRightBird
     
     
         //beginning of Rotating WINR
          //----------------------début de la création de la rotation--------------------------------
     
        TransformGroup WinRSpin=new TransformGroup();
     
        // permet de modifier l'objet pendant l'execution
        WinRSpin.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
     
        // on crée un fonction de rotation au cours du temps
        Alpha rotationAlphaWinRSpin=new Alpha(-1,2000);
     
         Transform3D rot = new Transform3D();
        // rot.rotX((float)Math.PI/- 2.0f);
        rot.rotX(-45);
     
     
        //rot.rotX(-Math.PI / 4.0);
         //rot.rotY(-Math.PI / 4.0);
        // rot.rotZ(-Math.PI / 4.0);
        // rot.rotY(00);
         //rot.rotZ(45);
        // on crée un comportement qui va appliquer la rotation à l'objet voulu
        RotationInterpolator rotatorWinRSpin=new RotationInterpolator(rotationAlphaWinRSpin,WinRSpin, rot, 0.50f,(float)(2.0*Math.PI));
     
        // on définit la zone sur laquelle va s'appliquer la rotation
        BoundingSphere boundsWinRSpin=new BoundingSphere();
        rotatorWinRSpin.setSchedulingBounds(boundsWinRSpin);
       WinRSpin.addChild(rotatorWinRSpin);
     
    //----------------------début de la création de la rotation--------------------------------
     
    BirdWingR.addChild(WinRSpin);
     
    // on cree un cube qui hérite de la rotation
    //WinRSpin.addChild(new ColorCube(0.5));// de rayon 50 cm
     WinRSpin.addChild(new com.sun.j3d.utils.geometry.Box(.43f,.07f,.22f, primflagsx,apx));
     
          //End of Rotating WINR
     
     
     
     
     
          //test WingLeftBird
     
            //create a transform3D for the BirdWIngL
          Transform3D T3DBirdWingL = new Transform3D();
          T3DBirdWingL.set(new Vector3f(-0.45f,.0f,-0.35f));
     
         //create the tranformgroup for the BirdWIngL
          TransformGroup BirdWingL = new TransformGroup();
          BirdWingL.setTransform(T3DBirdWingL);
     
          //add the child box to BirdWIngL
          BirdWingL.addChild(new com.sun.j3d.utils.geometry.Box(.43f,.07f,.22f, primflagsx,apx));
     
          //End test WingLeftBird
     
     
     
     
          //test bird head
           // Création d'un cone
        Cone birdhead = new Cone (0.23f, 0.45f);
        Transform3D conebirdheadTransformation = new Transform3D ();
        conebirdheadTransformation.setTranslation (new Vector3f (0.0f, 0.0f, .48f));
        TransformGroup BirdHead = new TransformGroup();
     
          //end test bird head
        //test rottation cone head
         Transform3D rotationconehead = new Transform3D ();
        rotationconehead.rotX (Math.PI / 2.0d);
     
        conebirdheadTransformation.mul(rotationconehead);
        //end test rotation cone head
     
        BirdHead.setTransform(conebirdheadTransformation);
        BirdHead.addChild(birdhead);
     
     
     
          //attaching to the bird the wings R and L
          Bird.addChild(BirdWingR);
          Bird.addChild(BirdWingL);
          Bird.addChild(BirdHead);
     
      // END WHOLE BIRD
     
          //Test Lights
     
    //this is where I added twice the colours... as its different angle its ok, its different
    Color3f light1Color = new Color3f(.91f, 0.90f, .01f); // green light
     
    BoundingSphere boundsLight = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
     
    //Vector3f light1Direction = new Vector3f(4.0f, -7.0f, -12.0f);
    Vector3f light1Direction = new Vector3f(0.0f, -0.10f, -0.10f);
    DirectionalLight light1= new DirectionalLight(light1Color, light1Direction);
     
    light1.setInfluencingBounds(boundsLight);
     
    Humanoid.addChild(light1);
     
     
          //End Test Lights
     
    // Régler la lumière ambiante
    BoundingSphere boundsLight2 = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
    Color3f ambientColor = new Color3f(1.0f, 1.0f, 1.0f);
     
    AmbientLight ambientLightNode = new AmbientLight(ambientColor);
     
    ambientLightNode.setInfluencingBounds(boundsLight2);
     
    Humanoid.addChild(ambientLightNode);
     
    //End Regler la Lumiere
     
     
    //test textures
    // Configurer les couleurs
     
    Color3f black = new Color3f(0.0f, 0.0f, 0.0f);
     
    Color3f white = new Color3f(1.0f, 1.0f, 1.0f);
     
    Color3f red = new Color3f(0.7f, .75f, .15f);
     
     
    // Configurer la texture
    //if I want it in Black and white i need to replace RGB by LUMINANCE
    TextureLoader loader = new TextureLoader("F:\\java3d\\basket.jpg", "RGB", new Container());
     
    Texture texture = loader.getTexture();
     
    texture.setBoundaryModeS(Texture.WRAP);
     
    texture.setBoundaryModeT(Texture.WRAP);
     
    texture.setBoundaryColor( new Color4f( 0.0f, 1.0f, 0.0f, 0.0f ) );
     
    // Configurer les attributs de la texture
     
    // Paramètres possibles : REPLACE, BLEND ou DECAL (ici, MODULATE)
     
    TextureAttributes texAttr = new TextureAttributes();
     
    texAttr.setTextureMode(TextureAttributes.MODULATE);
     
    Appearance ap = new Appearance();
     
    ap.setTexture(texture);
     
    ap.setTextureAttributes(texAttr);
     
    //Configurer le matériau
     
    ap.setMaterial(new Material(red, black, red, black, 1.0f));
     
    // Créer une sphère pour y appliquer les textures
     
    int primflags = Primitive.GENERATE_NORMALS + Primitive.GENERATE_TEXTURE_COORDS;
     
    Sphere sphereZ = new Sphere(0.9f, primflags, ap);
     
    TransformGroup TGsphereZ=new TransformGroup();
     
    //create a transform3D for the textured sphereZ
          Transform3D T3DsphereZ = new Transform3D();
          T3DsphereZ.set(new Vector3f(1.5f,-1.0f,2.0f));
     
         //create the tranformgroup for the textured sphereZ
     
           TGsphereZ.addChild(sphereZ);
         Transform3D rotationT3DsphereZ = new Transform3D ();
       // rotationT3DsphereZ.rotX (Math.PI / 4.0d);
       // rotationT3DsphereZ.rotY (Math.PI / 2.0d);
        rotationT3DsphereZ.rotZ (Math.PI / 2.0d);
        T3DsphereZ.mul(rotationT3DsphereZ);
    TGsphereZ.setTransform(T3DsphereZ);
    Humanoid.addChild(TGsphereZ);
     
    //to make it transparent but it does not accept 0.5?? 0=visible=1=invisible
    TransparencyAttributes t_attr = new TransparencyAttributes(TransparencyAttributes.BLENDED,0, TransparencyAttributes.BLEND_SRC_ALPHA, TransparencyAttributes.BLEND_ONE);
     
    ap.setTransparencyAttributes( t_attr );
    //fin test textures
     
     
          return Humanoid;
      }
     
     
    //TEST KEYS
     
     
    public void keyPressed(KeyEvent e) {
     
    //Invoqué lorqu’une touche est appuyée…
     
    if (e.getKeyChar()=='s') {xloc = xloc + .1f;}
     
    if (e.getKeyChar()=='a') {xloc = xloc - .1f;}
     
    }
     
    public void keyReleased(KeyEvent e){
     
    // Invoqué lorsqu’une touche est relâchée
     
    }
     
    public void keyTyped(KeyEvent e){
     
    //Invoqué lorsqu’un touche a été actionnée
     
    }
     
    public void actionPerformed(ActionEvent e ) {
     
    // Démarrer le chrono (timer) lorsqu’une touche est appuyée
     
    if (e.getSource()==go){
     
    if (!timer.isRunning()) {
     
    timer.start();
     
    }
     
    }
     
    else {
     
    height += .1 * sign;
     
    if (Math.abs(height *2) >= 1 ) sign = -1.0f * sign;
     
    if (height<-0.4f) {
     
    transxx.setScale(new Vector3d(-1.1, .8, -1.1));
     
    }
     
    else {
     
    transxx.setScale(new Vector3d(1.0, 1.0, 1.0));
     
    }
     
    transxx.setTranslation(new Vector3f(xloc,height,-3.0f));
     
    objTransxx.setTransform(transxx);
     
    }
     
    }
    //END TEST KEYS
     
     
     
      public static void main(String[] args) {
        Simple3D myCubes = new Simple3D();
        myCubes.setVisible(true);
        //display a text
        System.out.println("Program Started");
     
     
     
      }
    }

  4. #4
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    54
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Décembre 2006
    Messages : 54
    Points : 26
    Points
    26
    Par défaut
    encore une fois je suis casi 100% certain ca marchait!
    et je nai rien changer de ce cote la qui fairait cet erreur!
    Elle apparait aleatoirement des fois et maintenant tout le temps!

    Et mon backup aurait du fonctionner aussi!

    Je me demande si jai changer un nom par megarde, ou si c genre quelquechose qui se change tout seul dans mon code quand je compile!

  5. #5
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    54
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Décembre 2006
    Messages : 54
    Points : 26
    Points
    26
    Par défaut
    Je crois qu'il deraille la il me dit "run:
    Error: could not open `C:\Program Files\Java\jre1.6.0_05\lib\i386\jvm.cfg'
    "
    alors que jai rien toucher moi!!!


  6. #6
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    54
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Décembre 2006
    Messages : 54
    Points : 26
    Points
    26
    Par défaut
    Citation Envoyé par LeXo Voir le message
    que t'as pas instancié un objet

    mais avec le code ça serait plus facile
    wouhou! La ca remarche alors quencore uen fois je n'ai rien toucher au code!

    Jai juste eteind le pc la nuit...

    Je laisse le sujet ouvert au cas ou parceque des fois jai quand meme cet erreur...


    Merci en tout cas de l'aide

  7. #7
    Futur Membre du Club
    Profil pro
    Inscrit en
    Avril 2008
    Messages
    7
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Avril 2008
    Messages : 7
    Points : 9
    Points
    9
    Par défaut
    Je vais marquer comme "resolu"...

    J'avais eu ce probleme un petit nombre de fois, puis tout le temps.
    Mais quand jai eteind puis redemarrer le pc, il a disparu, je pense donc qu'il s'agissait d'un bug...

Discussions similaires

  1. [MySQL] Que veut dire cette erreur
    Par jlb59 dans le forum PHP & Base de données
    Réponses: 6
    Dernier message: 10/09/2011, 15h53
  2. Que veut dire cette erreur ?
    Par Invité dans le forum jQuery
    Réponses: 3
    Dernier message: 04/04/2011, 09h51
  3. [Free Pascal] Que veut dire l'erreur 201 ?
    Par zymohydrolyse dans le forum Free Pascal
    Réponses: 2
    Dernier message: 05/03/2010, 13h56

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo