Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Yerst

#1
Support / Re: Rendering on a part of the screen
August 19, 2013, 01:33:32 PM
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:

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);

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...
#2
Support / Re: Rendering on a part of the screen
August 18, 2013, 12:38:57 PM
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.

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);

Screenshot (i think you know where it should be):
#3
Support / Re: Unsupported texture width
August 17, 2013, 10:25:28 PM
You could change the name of the textures in the TextureManager to something like "RackForFlowers0", "RackForFlowers1",... and just call temp.setTexture("RackForFlowers" + Integer.toString(i));
#4
Support / Re: How to do the profiling in jPCT-AE?
August 17, 2013, 12:56:36 PM
@kiffa:
Could you tell me how you got your memory profiling values?
I'm only familiar with this 3:

android.os.Debug.getNativeHeapSize()
android.os.Debug.getNativeHeapFreeSize()
android.os.Debug.getNativeHeapAllocatedSize()

How do you get values like the app memory limit?
#5
Support / Re: Unsupported texture width
August 17, 2013, 11:56:25 AM
You need to assign the texture to the Object.
It doesn't matter how you name the texture, it just needs to be the same name you called it in the TextureManager.
yourBallModel.setTexture("ballTexture");
Or for your Current Name:
yourBallModel.setTexture("main_product_133750009413897300.jpg");
#6
Support / Re: Unsupported texture width
August 16, 2013, 06:16:27 PM
Your texture sizes need to be a power of two. (2^n)
So just scale your texture to 512*512 for example, and it should work.
#7
Support / Re: Rendering on a part of the screen
August 16, 2013, 06:14:33 PM
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.

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();
#8
sry, i forgot about the resources.
You need the application context to get the resources.
You can get the application Context by calling this.getApplicationContext() in your (Main)Activity.
I hand over the Context to every class where i need it, not only the Resources, because they cannont access the assets folder.
To get the Resources do the following just call Resources res = context.getResources() in your class.

P.S.: If you didn't already know, just press Strg+Shift+O and eclipse will import everything you need.
#9
Support / Re: Rendering on a part of the screen
August 15, 2013, 12:42:32 PM
So, this is the code i'm using:
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();

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?
#10
Support / Rendering on a part of the screen
August 14, 2013, 05:57:00 PM
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.
#11
This is what you need to load a .3ds file (in res/raw):


Object3D model = Object3D.mergeAll(Loader.load3DS(res.openRawResource(R.raw.model), scale));
world.addObject(model);

It it has a Texture:
Textures aren't packed in a .3ds file. You need to save the Texture (as a .png for example) and copy it in the assets or res/raw.
This should work then:

TextureManager tm = TextureManager.getInstance();
Object3D model = Object3D.mergeAll(Loader.load3DS(res.openRawResource(R.raw.model), scale));
tm.addTexture("model_texture",new Texture(res.openRawResource(R.raw.model_texture)));
model.setTexture("model_texture");
world.addObject(model);
#12
Forget about this topic, i already found my fault.
It's just to embarrassing to talk about...
#13
Hey!
I'm currently stuck at a weird problem.
This works and show exactly what i wan't:

else
{
fb.blit(this.background, 0, 0, 0, 0, 512, 256, width, height, -1, false);
}

But when i call this in another class it doesn't:

else
{
csssm.update(fb,this.background);
}

csssm.update():

public void update(FrameBuffer fb,Texture texture)
{
fb.blit(texture, 0, 0, 0, 0, 512, 256, width, height, -1, false);
}

There is just a blank image then...
#14
@Thomas.: What were you using to do this?
#15
Support / Re: How to lock translations?
July 30, 2013, 11:09:55 PM
Thx, but how do i also do this with rotations?