Author Topic: Irgend was tut nich  (Read 6852 times)

Offline Empire

  • byte
  • *
  • Posts: 30
    • View Profile
Irgend was tut nich
« on: May 12, 2011, 05:20:55 pm »
Hi zusammen,
Ich hab ein kleines Programm geschrieben aber irgend was hat nicht gestimmt,
kann ja vorkommen. Ich hab ein weilchen rumprobiert, hab es aber nicht hinbekommen.
Dann hab ich das Hello World Programm fast 1:1 übernommen, aber es hat trotzdem
nicht funktioniert.
Das ist der Code:
Code: [Select]
frame=new JFrame("Hello world");
frame.setSize(800, 600);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);

SSystem = new World();
SSystem.setAmbientLight(0, 255, 0);

Color Braun = new Color(139,0,0);
TextureManager.getInstance().addTexture("pBraun", new Texture(10, 10, Braun));
//TextureManager.getInstance().addTexture("box", new Texture("box.jpg"));

Sonne = Primitives.getBox(13f, 2f);
Sonne.setTexture("pBraun");
Sonne.setEnvmapped(Object3D.ENVMAP_ENABLED);
Sonne.build();
SSystem.addObject(Sonne);

SSystem.getCamera().setPosition(0, 0, 0);
SSystem.getCamera().lookAt(new SimpleVector(0,0,0));

//HelloWorld HelloWorldAWTGL()
//----------------------------------------------------------------------------
                //HeloWorld Loop()

buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_NORMAL);
Canvas canvas=buffer.enableGLCanvasRenderer();
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
frame.add(canvas);
//epScreen.add(canvas);
while (frame.isShowing())
{
Sonne.rotateY(0.01f);
buffer.clear(java.awt.Color.BLUE);
SSystem.renderScene(buffer);
SSystem.draw(buffer);
buffer.update();
buffer.displayGLOnly();
canvas.repaint();
Thread.sleep(10);
}
buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
buffer.dispose();
frame.dispose();
System.exit(0);
Kann mir jemand erklären was ich falsch gemacht habe?

Es erscheint nur ein leeres weißes Fenster.
Fehlermeldungen oder ähnliches gibt es nicht.

mfg
Empire

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Irgend was tut nich
« Reply #1 on: May 12, 2011, 08:26:11 pm »
Also weiß sollte es nicht sein. Bei mir ist ein blau. Sehen kann man dennoch nichts, weil Kamera und "Sonne" beide im Ursprung sitzen und die Kamera durch den lookAt() auf ihre eigene Position nach irgendwo schaut. Nimm mal das lookAt() ersatzlos raus und ergänze ein Sonne.translate(0, 0, 100);

Offline Empire

  • byte
  • *
  • Posts: 30
    • View Profile
Re: Irgend was tut nich
« Reply #2 on: May 12, 2011, 09:54:53 pm »
Danke wenn man zu lange arbeitet sieht man nichts mehr.

Offline Empire

  • byte
  • *
  • Posts: 30
    • View Profile
Re: Irgend was tut nich
« Reply #3 on: May 14, 2011, 07:24:22 pm »
ICh hab jetzt weiter rumprobiert und das Problem umstellt
Code: [Select]
System.out.println("vor add()");
epScreen.add(canvas);
System.out.println(" direckt Vor loop");
Das erste wird noch ausgegeben, das zweite nicht mehr.
epScreen, ist ein EditorPane auf dem ich die Scene ausgeben will.
Was ist das Problem?

mfg
Empire

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Irgend was tut nich
« Reply #4 on: May 15, 2011, 10:42:43 pm »
Scheint dann irgendwie ein Problem der AWTCanvas in Verbindung mit der Editorpane oder deinem System zu sein. Die HelloWorldAWTGL-Variante läuft bei dir?

Offline Empire

  • byte
  • *
  • Posts: 30
    • View Profile
Re: Irgend was tut nich
« Reply #5 on: May 16, 2011, 04:03:26 pm »
Problem los.
Hab heute in der Schule ein zwei Ideen gehabt,
meld mich wenn ich die durch hab.

mfg
Empire

Offline Empire

  • byte
  • *
  • Posts: 30
    • View Profile
Re: Irgend was tut nich
« Reply #6 on: May 17, 2011, 11:08:31 pm »
Langsam bin ich verwirrt.
Ich hab das Bsp Hello World, nochmal zum laufen gebracht.
Dann hab ich GENAU den Code in mein Projekt übernommen (kommplette Klasse).
Und jetzt tut es nicht mehr.
Das Fenster wird geöffnet aber der Hintergrund wird als Inhalt übernommen.
Wenn man das Fenster aus dem Bildschirm schiebt ist es danach weiß.

mfg
Empire

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Irgend was tut nich
« Reply #7 on: May 18, 2011, 10:43:10 am »
Irgendwelche Exceptions gibt es nicht??

Offline Empire

  • byte
  • *
  • Posts: 30
    • View Profile
Re: Irgend was tut nich
« Reply #8 on: May 18, 2011, 05:13:38 pm »
Nein grad nochmal nach geguckt. Hier das Protokol:

Loading Texture...box.jpg
[ Wed May 18 17:12:08 CEST 2011 ] - WARNING: Unsupported Texture width (618)...resizing to a width of 256 pixels!
Java version is: 1.6.0_24
-> support for BufferedImage
Version helper for 1.5+ initialized!
-> using BufferedImage
Software renderer (OpenGL mode) initialized
Using LWJGL's AWTGLCanvas
Software renderer disposed


mfg
Empire

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Irgend was tut nich
« Reply #9 on: May 20, 2011, 08:48:24 pm »
Hmmmm...scheint mir dann eher eine Art Kompatiblitätsproblem von Seiten LWJGL zu sein. Da kann ich nichts machen. Du kannst mal die JOGL-Variante versuchen: http://www.jpct.net/wiki/index.php/The_different_renderers

Offline Empire

  • byte
  • *
  • Posts: 30
    • View Profile
Re: Irgend was tut nich
« Reply #10 on: May 20, 2011, 11:35:40 pm »
Ich muss übers Wochen ende ein Schulprojekt machen.
Danach reis ich das noch mal ab, und versuch es ein letztes mal.
Das wär ja ein Witz wenn man das nicht irgend wie hin bekommt.

mfg
Empire