www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: theFALCO on December 21, 2006, 08:18:34 pm

Title: just render
Post by: theFALCO 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
Title: just render
Post by: EgonOlsen 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(...);
Title: just render
Post by: theFALCO on December 21, 2006, 10:08:37 pm
so I don't need framebuffer.update()?
Title: just render
Post by: EgonOlsen on December 21, 2006, 10:12:16 pm
Opps...my bad. I forgot the update()-call in that list. I've added it.
Title: just render
Post by: theFALCO 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()?
Title: just render
Post by: EgonOlsen on December 22, 2006, 04:13:18 pm
After! Because otherwise, it would be overwritten with the rendered image.
Title: just render
Post by: theFALCO 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
Title: just render
Post by: EgonOlsen on December 22, 2006, 07:47:06 pm
This is the software renderer, right?
Title: just render
Post by: theFALCO on December 22, 2006, 08:44:01 pm
openGL mode
Title: just render
Post by: EgonOlsen 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.