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.


Messages - Darai

Pages: 1 [2] 3
16
Support / Re: More FrameBuffers in one program
« on: January 28, 2016, 10:38:53 am »
Hello Egon,

Thanks for the quick answer, I love the screenshot you posted.

To summarize this topic:

More FrameBuffers is definitley nogo, since there is only one GLcontext. That means that I have to use the one FrameBuffer I have (?) which means to use the process described in the thread http://www.jpct.net/forum2/index.php/topic,3716.0.html.

The meaning is to temporary (just for the proces of remaking the texture) use the setRenderTarget() and then end with removeRenderTarget() to redirect the main Buffer.

AND:
You suggest to scale the blit according the texture size viz the code snippet you wrote (and reverse its Y axis) and SYNC the Buffer before (?) the manipulation with the texture.

If I misunderstood you, just say so please. :-)
Thanks once again, I am going to try it out.

17
Support / More FrameBuffers in one program
« on: January 27, 2016, 02:39:41 pm »
Hello,

I am trying to test bliting to an existing texture. I know, there is a warning sign don't do it, but I wanted to test it and I found a strange behaviour:

I have the renderer's function onSurfaceChange, creating the world and it's objects. In this function, I create 2 frame buffers, one for the standard rendering and one for the rendering into the texture. BUT once I make a second FrameBuffer with the same GL10 the screen shrinks to the size of the new frame buffer no matter what. So, I should maybe call different GL10? Or how can I create more independent FrameBuffers?

Code: [Select]
FrameBuffer fb;
FrameBuffer toTex;

public void onSurfaceChanged(GL10 gl, int w, int h) {
fb = new FrameBuffer(gl, w, h);
toTex = new FrameBuffer(gl, 256, 256);
...
}

public void onDrawFrame(GL10 gl) {
...
fb.display;
}

And to the larger problem, I would like to blit a text to a texture. I see here 4 ways:
1) blit to screen every frame: Too slow and can't skew the text.
2) create an object with 2 Triangle Sprite for every letter: Fine, but creates a complex Object3D
3) blit to bitmap using Canvas and replace texture in TextureManager: Unrecomended since texture replace(== upload a new texture to GPU), Canvas and Bitmap object is (i expect) much slower than Texture and FrameBuffer operations.
4) blit directly to texture using FrameBuffer.setRenderTarget(): This is unrecomended in the documentation by Egon but I don't know why.

So my question to the larger problem is: Why is the 4th approach not recomended since from this point of view it is probably the fastest one. (For a text which will not change every frame) And what would you pick and why?

Thanks for all advices.

18
Support / Re: blitting text and images
« on: January 20, 2016, 03:03:36 pm »
Thanks a lot,

I just found myself that in the Android forum is a different version. As usually the problem was something trivial on my side.
Well, thanks a million time for the nice work, I will experiment with it and ask if I will need more help.

Cheers,
Darai.

19
Support / Blitting text and images - Still old blit even after 7 years?
« on: January 20, 2016, 02:50:32 pm »
Hello,

I am experimenting with this extremly helpful piece of code, but up until now I had only little luck.
1) I copied the classes GLFont and TexturePack from the first post
2) I solved the class dependency of java.awt by adding Project->Properties->Java Build Path->Add Library->JRE System library

But I am still getting two errors in the TexturePack:
the constructor jpct.Texture(BufferedImage(image), Boolean(useAlpha)) is undefined
the function com.threed.jpct.FrameBuffer.blit is not defined for parameters ...

I expect that this can have something to do with your information from the first post that you used the experimental jpct... but
1) That was 7 years ago
2) Your link for the experimental beta jpct doesn't work any more

So I am intrigued to know - is the "experimental" jpct version of blit and Texture now reachable somewhere else? or did you reprogrammed it for the classic jpct_ae? Or how can I solve this code now in 2016?

Thanks,
Darai.

20
Support / Re: What to do with Error: Couldn't build()
« on: October 14, 2015, 01:20:52 pm »
Hmm... it is back, and I was so happy yesterday.
So to be sure, the correct order is:

Object3D original = new Object3D();

world.addObject(original);
original.build(false);

Object3D[] copies = new Object3D[5]();
for(c:copies){
c = original.cloneObject();
world.addObject(c);
c.build(false);
}

The original, does it have to be added to the world even though I will never use it in the world?
The clones, do I have to build them even though the original is already built?

21
Support / Re: What to do with Error: Couldn't build()
« on: October 13, 2015, 10:10:22 am »
By copying the object (Object3D newOne = original.cloneObject();)  and it was a simple 2-triangle square.

After that, I am just adding it to the world and building it:
world.addObject(newOne);
newOne.build(false);

But you know what? It stopped... It was yelling that error on me for the whole yesterday and when I reinstalled the game today it is not doing that any more.

Hmm... I came here for your help, because this was a new error for me after I used the same method for introducing new objects into the world over and over again for the last year without any problems. I probably did something differently and just didn't realize the moment I fixed that. It is little bit funky. Since I am using xml files saved in the asset directory I have to sometimes fully uninstall the app from the device and install it again to apply the changes, so maybe the problem was somewhere there in the assets.

If it will return, I'll study it more. But thanks, if you will have any clue, what I could do wrong I would appreciate your hint.

22
Support / Re: What to do with Error: Couldn't build()
« on: October 13, 2015, 08:13:43 am »
Sure there is,
Code: [Select]
10-12 16:14:35.278: W/System.err(18100): java.lang.ArrayIndexOutOfBoundsException: length=14; index=14
10-12 16:14:35.278: W/System.err(18100): at com.threed.jpct.Vectors.addVertex(Vectors.java:85)
10-12 16:14:35.278: W/System.err(18100): at com.threed.jpct.Object3D.setBoundingBox(Object3D.java:2557)
10-12 16:14:35.278: W/System.err(18100): at com.threed.jpct.Object3D.calcBoundingBox(Object3D.java:1208)
10-12 16:14:35.278: W/System.err(18100): at com.threed.jpct.Object3D.build(Object3D.java:1252)
10-12 16:14:35.278: W/System.err(18100): at com.threed.jpct.Object3D.build(Object3D.java:1222)
10-12 16:14:35.278: W/System.err(18100): at com.threed.jpct.World.renderScene(World.java:1045)
10-12 16:14:35.279: W/System.err(18100): at daraisoft.astro3d.renderer.AstroRenderer.onDrawFrame(AstroRenderer.java:62)
10-12 16:14:35.279: W/System.err(18100): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1522)
10-12 16:14:35.279: W/System.err(18100): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)
10-12 16:14:35.279: E/jPCT-AE(18100): [ 1444659275279 ] - ERROR: Couldn't build() object (object1531)! Check if the object is assigned to a world and if the TextureManager has all required textures loaded.
10-12 16:14:35.340: E/AndroidRuntime(18100): FATAL EXCEPTION: GLThread 1297
10-12 16:14:35.340: E/AndroidRuntime(18100): Process: daraisoft.astro3d, PID: 18100
10-12 16:14:35.340: E/AndroidRuntime(18100): java.lang.RuntimeException: [ 1444659275279 ] - ERROR: Couldn't build() object (object1531)! Check if the object is assigned to a world and if the TextureManager has all required textures loaded.
10-12 16:14:35.340: E/AndroidRuntime(18100): at com.threed.jpct.Logger.log(Logger.java:206)
10-12 16:14:35.340: E/AndroidRuntime(18100): at com.threed.jpct.Object3D.build(Object3D.java:1274)
10-12 16:14:35.340: E/AndroidRuntime(18100): at com.threed.jpct.Object3D.build(Object3D.java:1222)
10-12 16:14:35.340: E/AndroidRuntime(18100): at com.threed.jpct.World.renderScene(World.java:1045)
10-12 16:14:35.340: E/AndroidRuntime(18100): at daraisoft.astro3d.renderer.AstroRenderer.onDrawFrame(AstroRenderer.java:62)
10-12 16:14:35.340: E/AndroidRuntime(18100): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1522)
10-12 16:14:35.340: E/AndroidRuntime(18100): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)
Do you know what can cause this?

23
Support / What to do with Error: Couldn't build()
« on: October 12, 2015, 05:00:07 pm »
Hi guys,

I am now writing my code for some time and suddenly I am getting "Error: Couldn't build() ..."

It writes me, that I should check if I have:
1) the object assigned to a world ... which I solve by calling world.addObject(object) right on the previous line
2) if the TextureManager has all the necesary textures loaded ... which I check by calling TextureManager.getInstance().getTextureID(this.texName)

Well I don't know if that is all I can do to check what is wrong. I also don't know if this is all that can cause this error. So, do you have any suggestions what to do next in situation like this?

Thanks,
Martin.

24
Support / Found it
« on: October 25, 2014, 02:16:04 pm »
I found it....

it is following link:
http://www.jpct.net/forum2/index.php/topic,95.msg324.html#msg324

And the short message is: Insets is = wind.getInsets(); where wind is I expet the view or frame or something like that and the Insets object than contains the required values.

25
Support / Re: project 2D to 3D has problem with (full)screen
« on: October 24, 2014, 02:39:05 pm »
Thanks,

I tried to find relevant topics, but had no luck yet... since now I know it is here somewhere I'll try again and more thoroughly.

26
Support / Re: Scrabble tiles in JPCT
« on: October 23, 2014, 06:00:19 pm »
Go ahead, try it out, it is not that hard experiment.

27
Support / Re: Scrabble tiles in JPCT
« on: October 23, 2014, 05:59:20 pm »
Don't worry,

it will work, just use the setTexture method of the Object3D object (Or any other retexturing method).

28
Support / Re: How to dynamic change the texture U V ?
« on: October 23, 2014, 02:06:56 pm »
Well,

onDrawFrame is a good place to do this. I don't know if there is a better way or place to do it, maybe Egon will give you another advise. For me, it works there.

29
Support / Re: How to dynamic change the texture U V ?
« on: October 23, 2014, 01:07:26 pm »
What you need to know is:
  • Use Object3D.build(false) instead of Object3D.build() to tell JPCT that you DONT want static texture
  • Use Object3D.touch() to tell the object that you changed something and he should do again the "lazy transformation".
  • The texture setting is done through "Polygon manager" in following fashion: Object3D.getPolygonManager().setPolygonTexture(TriaID, new TextureInfo(TexID, U1, V1, U2, V2, U3, V3) Where TriaID is the ID of triangle on which you want to change the texture, TexID is the ID of your texture (still the same if you don't want to change the whole thing) and U1 .. V3 are coordinates of the points of the triangle on the texture (U1 - V3 are in range 0 - 1)

30
Support / project 2D to 3D has problem with (full)screen
« on: October 23, 2014, 09:55:01 am »
SOLVED

Hi guys,

To say this in more words, there is a difference in the result I get from Interact2D.reproject2D3DWS() depending on my screen status (with/without the system lines).

In the case I have full screen with full immersive, the resulting vector hits precisely under my touch
In the case I have the system trail and buttons visible, the result is like 5mm down (+y)  from the actual touch point

Do you have the same problem? How do you deal with it?

Thanks for all the help,
Darai.

The solution: Something I found on stackowerflow.com
Code: [Select]
public int getStatusBarHeight() {
            int result = 0;
            int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
            if (resourceId > 0) {
                result = getResources().getDimensionPixelSize(resourceId);
            }
            return result;
        }
Extracts the statusbar height from the applet R file.

Pages: 1 [2] 3