Main Menu

just render

Started by theFALCO, December 21, 2006, 08:18:34 PM

Previous topic - Next topic

theFALCO

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

EgonOlsen

No Config.*-settings have to be changed for rendering a simple cube. Must be something different. Make sure that your order when drawing is:


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

theFALCO

so I don't need framebuffer.update()?

EgonOlsen

Opps...my bad. I forgot the update()-call in that list. I've added it.

theFALCO

And where sould I put device context operations (like framebuffer.getGraphics().drawString("jPCT", 10, 10); )? before or after update()?

EgonOlsen

After! Because otherwise, it would be overwritten with the rendered image.

theFALCO

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

EgonOlsen

This is the software renderer, right?

theFALCO


EgonOlsen

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.