Author Topic: just render  (Read 3950 times)

Offline theFALCO

  • byte
  • *
  • Posts: 39
    • View Profile
just render
« on: December 21, 2006, 08:18:34 pm »
I'm currently trying to make everything I did in jPCT before from the beginning but without any ready stuff. What I ended up with is a flickering cube... could anyone please list everything that MUST be set/configured to render successfully with all Config.* settings? Thanks

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
just render
« Reply #1 on: December 21, 2006, 09:26:47 pm »
No Config.*-settings have to be changed for rendering a simple cube. Must be something different. Make sure that your order when drawing is:

Code: [Select]

framebuffer.clear();
world.renderScene(framebuffer);
world.draw(framebuffer);
framebuffer.update();
framebuffer.display(...);

Offline theFALCO

  • byte
  • *
  • Posts: 39
    • View Profile
just render
« Reply #2 on: December 21, 2006, 10:08:37 pm »
so I don't need framebuffer.update()?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
just render
« Reply #3 on: December 21, 2006, 10:12:16 pm »
Opps...my bad. I forgot the update()-call in that list. I've added it.

Offline theFALCO

  • byte
  • *
  • Posts: 39
    • View Profile
just render
« Reply #4 on: December 22, 2006, 03:41:14 pm »
And where sould I put device context operations (like framebuffer.getGraphics().drawString("jPCT", 10, 10); )? before or after update()?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
just render
« Reply #5 on: December 22, 2006, 04:13:18 pm »
After! Because otherwise, it would be overwritten with the rendered image.

Offline theFALCO

  • byte
  • *
  • Posts: 39
    • View Profile
just render
« Reply #6 on: December 22, 2006, 05:21:20 pm »
Code: [Select]
buffer.clear();
theWorld.renderScene(buffer);
theWorld.draw(buffer);
buffer.update();
move();
buffer.getGraphics().setFont(new Font("Default", Font.BOLD, 18));
buffer.getGraphics().setColor(Color.WHITE);
buffer.getGraphics().drawString("jPCT", 10, 10);
display();


what did I miss? I can't see the text

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
just render
« Reply #7 on: December 22, 2006, 07:47:06 pm »
This is the software renderer, right?

Offline theFALCO

  • byte
  • *
  • Posts: 39
    • View Profile
just render
« Reply #8 on: December 22, 2006, 08:44:01 pm »
openGL mode

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
just render
« Reply #9 on: December 23, 2006, 01:58:11 pm »
Well, as the docs for FrameBuffer.getGraphics() state:
 
When using OpenGL support, this value is rather meaningless (but still valid).

This means: You can draw into this graphics context, but you'll never see the result. The OpenGL window is a native window of its own. Its not related to any Java2D-Component, so you can't use a Graphics-context to work with it. The Graphics-context from FrameBuffer acts as a backbuffer for some special purposes when using OpenGL...not more.
If you want to get text done in OpenGL, you have to blit it to screen yourself from a static/dynamic texture.