jPCT-AE - a 3d engine for Android > Support
Rendering on a part of the screen
Yerst:
Hey!
Is there a way of rendering only on a part of the screen?
I have a blitted game menu and i would like to show a preview of the current selected item (in 3D) on it.
EgonOlsen:
You could render it into a texture and blit that.
Yerst:
So, this is the code i'm using:
--- Code: ---fb.blit(this.submenu_background, 0, 0, 0, 0, 512, 256, width, height, -1, false);
fb.blit(this.preview, 0, 0, 300, 50, preview_width, preview_height, preview_width, preview_height, -1, false);
fb.setRenderTarget(preview);
fb.display();
fb.removeRenderTarget();
--- End code ---
It works for a size of 512*256, but at 512*257 i get a "Can't render into a texture larger than the current framebuffer!" exception.
I tried resizing the framebuffer without success.
Where should i render the world?
EgonOlsen:
512*257 isn't a valid texture size anyway. You seem to be using OpenGL ES 1.x, which is limited when it some to render targets. Consider to switch to ES 2.0 and maximum size restrictions will go away (they still should be powers of two unless you are using NPOTTexture, which i would try to avoid if possible).
Yerst:
How do i switch to OpenGL ES 2.0 ?
//EDIT: Ok, i think i will just use a 128*128 Texture and scale it up to my needs.
But i have still problems with rendering the world.
When i render it after i set the render target, everything gets bigger. Looks like it would zoom in.
--- Code: ---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);
fb.setRenderTarget(preview);
//world.renderScene(fb); When i enable this, everything gets bigger
fb.display();
fb.removeRenderTarget();
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version