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 - ppparkje

#1
Support / Re: Too many worlds leads to OOM
September 07, 2012, 02:41:31 AM


I needed a number of separate worlds for some operations including clipping and thought maybe world consumes few memory


... And it's my mistake. :/ I have a lot of things to learn.


Thanks for your support.
#2
Support / Too many worlds leads to OOM
September 06, 2012, 11:30:09 AM
Hi

I have a fatal oom error.

After profiling and inspecting the app I finally guessed that is because of multiple worlds.

Actually, I made a lot of worlds in one app and it always crashed at generating new world.


so I made a test code like this



List<World> w = new ArrayList<World>();
for(int i=0; i<100; i++) {
System.out.println("world " + i);
w.add(new World());
}



It makes just 100 world, but when I execute it, it crashed with OOM around i=47

Is the World class consume that so much memory?
#3
Oh I see... Maybe I must find other ways look similar to it.

Thanks
#4
Hi

I tried to apply texture matrix to object. It worked on opengl renderer, but not on software renderer.

other texture-relating functions (like invertTextureCoords()..) works fine.
#5
Ok.. I solved the problem.

the problem is the Object3D's transparency value. I set the value as 0xff by Object3D.setTransparency function.

When I changed it to 100, it works well.




Thanks for contributing :)
#6
QuoteTry to set Config.useFramebufferWithAlpha=true; before creating the FrameBuffer and see if that helps.

in the code I pasted above,  Config.useFramebufferWithAlpha=true; is set before creation of framebuffer.

did I do something wrong?
#7

Hello.

I'm trying to implement a kind of viewport using multiple worlds and framebuffers.

I got a idea from this forum.(http://www.jpct.net/forum2/index.php/topic,682.msg3606.html#msg3606)

but I had a problem about that. This image doesn't made well.


How did I make viewport is:

1. render viewport to buffer
2. make BufferedImage from buffer
3. make texture from BufferedImage
4. set texture to main world plane

and here is part of my code


public Viewport(int x, int y, int width, int height) {

m_rect.setBounds(x, y, width, height);
m_world = new World();
Camera m_cam = m_world.getCamera();

...

Config.useFramebufferWithAlpha = true;
m_buffer = new FrameBuffer(width, height, FrameBuffer.SAMPLINGMODE_NORMAL);
m_buffer.enableRenderer(IRenderer.RENDERER_SOFTWARE);
}

private Texture toTexture()
{
BufferedImage img = new BufferedImage(m_rect.width, m_rect.height, BufferedImage.TYPE_INT_ARGB);
m_buffer.clear(new Color(0, 0, 0, 0xff));
m_world.renderScene(m_buffer);
m_world.draw(m_buffer);
m_buffer.display(img.getGraphics());

Texture t = new Texture(img, true);
t.setClamping(true);
return t;
}



For test, I drew a diagonal line on it(square viewport).



I expected transparent background viewport with some colored(not transparent) line on it, but interestingly, it blitted transparent line.

it seems that alpha channel affects entire image. when I clear the buffer with alpha 0, the viewport never show as same as line on viewport.

how can i fix this problem?
#8
Hmm.. I tried to remove and change argument, but both didn't work.

However flat shading renders fine only if when i don't use any light except ambient. But this time the cube has no shading.....;

First attached file is screenshot with code you mentioned, and second is coded with no light object.


By the way, Thanks for guiding to new shading. I must learn about composing and compiling shader in jPCT.

[attachment deleted by admin]
#9
Support / Is flat shading works fine on my device?
June 27, 2012, 09:19:20 AM
Hi. I am newbie of 3D graphics programming and now working on some tutorials.

I have a lot to question, but I'll do a few of them.

The first one is, as mentioned above, the shading method.

I think the gouraud shading works fine, but when I switch it to flat shading, it renders like this:



and here is the code.



@Override
public void onDrawFrame(GL10 gl) {
cube.rotateY(m_cam.convertDEGAngleIntoFOV(0.5f));

buffer.clear(colBackground);
m_world.renderScene(buffer);
m_world.draw(buffer);
buffer.display();
}

@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
if(buffer == null) {

Util.LOGD("make framebuffer");
m_world = new World();
m_cam = m_world.getCamera();

m_light = new Light(m_world);
m_light.setIntensity(250, 250, 250);
m_light.setPosition(new SimpleVector(50, -50, 50));

m_world.setAmbientLight(0, 0, 0);

Texture t = new Texture(100, 100, new RGBColor(0, 0xff, 0, 0x7f));
TextureManager.getInstance().addTexture("test", t);
TextureManager.getInstance().addTexture("bottom", new Texture(100, 100, RGBColor.BLUE));
cube = Primitives.getBox(10, 1);
cube.setShadingMode(Object3D.SHADING_FAKED_FLAT);
cube.setEnvmapped(true);
cube.calcTextureWrap();
cube.translate(0, -10, 0);
cube.setTexture("test");
cube.strip();
cube.build();
m_world.addObject(cube);

m_bottomPlane = Primitives.getPlane(20, 300);
m_bottomPlane.translate(SimpleVector.ORIGIN);
m_bottomPlane.setSpecularLighting(true);
m_bottomPlane.calcTextureWrap();
m_bottomPlane.rotateX((float)Math.PI/2f);
m_bottomPlane.setTexture("bottom");
m_bottomPlane.build();
m_world.addObject(m_bottomPlane);

m_cam.setPosition(20, -20, 20);
m_cam.lookAt(cube.getTransformedCenter());

}

if(buffer != null)
buffer.dispose();
buffer = new FrameBuffer(gl, width, height);

MemoryHelper.compact();
}


Can anybody check the code it's right? I wonder it's on my device-specific issue. (I use HTC sensation with ICS)


And the second question is..

I'd like to accomplish a cartoonish rendering. For example, I think it can be simply done to a cube(in the code above) by boldening the edges. But I have no idea of implementing it. Moreover, I even do not know how to draw a line in 3D space. Can I get a hint of that?

Thanks for listening me and sorry for my poor english.