jPCT-AE - a 3d engine for Android > Support

Rendering on a part of the screen

<< < (2/2)

EgonOlsen:
That's most likely because the render target is square and your screen isn't and the fov adjusts itself accordingly. You can try to play around with the fov settings and/or the virtual dimension settings in FrameBuffer.

Yerst:
To be honest, i have no idea what setVirtualDimensions does. I just set it to my screen size and it doesn't zoom in anymore.
But i have still problems with my render target. I tried rendering a skybox (just to test it) when my render target is set to my texture, but it doesn't show the result it wanted.

--- Code: ---fb.blit(this.submenu_background, 0, 0, 0, 0, 512, 256, width, height, -1, false);
fb.setVirtualDimensions(width,height);
fb.setRenderTarget(preview);
skyBox.render(world, fb);
world.renderScene(fb);
fb.display();
fb.removeRenderTarget();
fb.blit(this.preview, 0, 0, (int)(width/1.72), (int)(height/11), preview_width, preview_height, (int)(width/2.53) , (int)(height/1.5), -1, false);

--- End code ---
Screenshot (i think you know where it should be):

EgonOlsen:
I'm not sure what i'm seeing there...however, i'm missing some clear calls. After setting the render target, shouldn't there be some call to clear to start with an empty texture?

Yerst:
You see the Skybox i rendered in the upper left corner, but it should be on the window at the right.
I did this now:

--- Code: ---fb.setVirtualDimensions(width,height);
fb.setRenderTarget(preview);
fb.clear();
skyBox.render(world, fb);
world.renderScene(fb);
fb.removeRenderTarget();
fb.blit(this.submenu_background, 0, 0, 0, 0, 512, 256, width, height, -1, false);
fb.blit(this.preview, 0, 0, (int)(width/1.72), (int)(height/11), preview_width, preview_height, (int)(width/2.53) , (int)(height/1.5), -1, false);

--- End code ---
And the skybox is gone.
The texture is where it should be, it is just black (like it wouldn't render at the texture at all.
Even if i clear it with another color, it is black...

EgonOlsen:
When using OpenGL ES 1.x, render to texture is done via an indirection. It will be rendered into the framebuffer and then copied into the texture. That's why your skybox appears in the upper left corner. The order should be something like this:


--- Code: ---...
fb.setRenderTarget(preview);
fb.clear();
skyBox.render(world, fb);
fb.removeRenderTarget();
fb.clear();
world.renderScene(fb);
world.draw(fb);
"blit preview"

--- End code ---

Navigation

[0] Message Index

[*] Previous page

Go to full version