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

Pages: 1 2 3 [4]
46
Support / Re: How to get a texture from a FrameBuffer?
« on: May 17, 2010, 08:48:58 pm »
So having my "meep.display();" in the onDrawFrame(), and everything else where it is? ('save for meeps declaration of course).
--

Ok, I found what was wrong with just using my method above, the text comes out transparent, and the texture never gets updated even if I use replacetexture :P

47
Support / Re: How to get a texture from a FrameBuffer?
« on: May 17, 2010, 07:02:26 pm »
Wouldn't that recreate the texture each frame :?
Seems a bit wasteful.
The thing I'm doing the texture might be updated but certainly not every frame.
Basically the AddPlacemark(X,Y,"any text goes here") will be triggered a lot as the programs loading, then maybe once or twice after its already loaded.
Mostly the textures will be just like any other texture when created.

Quote
no idea...maybe it just isn't working in the way it should because of some driver issues. It wouldn't be the first thing that is on Android. However, it's better if you can manage to render the text into an int[]-array or at least a Bitmap anyway. With both, you can create (Bitmap) or update (int[] via an ITextureEffect, the prefered way) a texture and use that as texture for your billboard. Raft's GlFont class creates textures with those letters too, so it may help as a starting point.

I must admit I dont have any idea how to use a ITextureEffect.

I did get it working by just using Canvas to make a bitmap;
Code: [Select]
paint.setColor(Color.BLACK);
Bitmap.Config config = Bitmap.Config.ARGB_8888;
FontMetricsInt fontMetrics = paint.getFontMetricsInt();
int fontHeight = fontMetrics.leading - fontMetrics.ascent + fontMetrics.descent;
int baseline = -fontMetrics.top;
int height = fontMetrics.bottom - fontMetrics.top;

Bitmap charImage = Bitmap.createBitmap(closestTwoPower((int)paint.measureText(text)+10), 64, config);

Canvas canvas = new Canvas(charImage);
canvas.drawColor(Color.WHITE);
canvas.drawText(text, 10, baseline, paint); //draw text with a margin of 10

TextureManager tm = TextureManager.getInstance();

Texture testtext = new Texture(charImage);

tm.addTexture("testText2", testtext);

Is there anything specificly wrong with this method? Bad for performance?



48
Thats exactly my goal.

Or, rather, allowing anyone to place messages tied to real locations and share them with anyone else :)

This is why I'm using Wave-servers as a back-end, it lets people have a kinda "social" AR. They can share their posts with either individuals, groups, or the public at large.
I already got the system working on PC's with a google map style client;
http://arwave.org/ (see video)
That was more or less to prove the concept. (though as its made in qt, porting later to nokia phones shouldn't be too hard).

Now I want to make a full AR one.

49
Support / getObjectByName crash's if no object with name exists?
« on: May 16, 2010, 04:10:52 pm »
getObjectByName() seems to crash if it cant find the object named....shouldn't it just return null?
Its easy enough to work around this,but I thought Id mention it as it seems to be a bug.

50
Support / Re: How to get a texture from a FrameBuffer?
« on: May 16, 2010, 02:19:04 pm »
  • The render-to-texture code of jPCT-AE is totally untested. It's a straight port from the desktop version, so it should work if Android's drivers work correctly...but as we all know, they don't. So there is a chance that it won't work even if everything else is correct.
  • Make sure that your texture has a power of two size that's smaller than the framebuffers. 60*60 isn't a good size, use 64*64 instead.

Done.
I noticed I couldnt have textures of 90x90 early because it got a
"- ERROR: Can't render into a texture larger than the current framebuffer!"
error. (despite the fact the framebuffer  is specified as 100,100)
Was this because it was rounding up internally to 128x128?

Quote
  • Make sure to remove the render target before using the texture in the actual rendering.
  • There's still a little ugliness in jPCT (both versions) when is comes to blitting: It requires that a world has been rendered at least once into the buffer to blit into. Any world will do. Try something like:

Code: [Select]
                        Texture textTexture = new Texture(64,64, RGBColor.BLACK);
FrameBuffer meep = new FrameBuffer(gl, 100, 100);
                        World tw=new World();
                        tw.renderScene(meep);
                        tw.draw(meep);
                        meep.display();

meep.setRenderTarget(textTexture);
meep.clear(RGBColor.BLACK);
glFont.blitString(meep, " test test test! ",
5, 5, 10, RGBColor.WHITE);
meep.display();

Thanks for your help, but I gave that a go and still nothing/transparent. :(
Not sure where to put that meep.removeRenderTarget(); though. Is it rendered into the texture on that ".display()", and thus any time after will do?

Quote
Where are you calling this? In onDrawFrame()?

No, onSurfaceCreate() at the moment.
What I really want to do is create a texture based on some text at any point though.

My goal is to effectively make a "add marker here" function. Which, given some text, and a position, will display a billboard with the text on at that position.
So far Ive made the billboard, complete with my own rectangle object...


Now I'm trying to assign a custom texture at that point.


[attachment deleted by admin]

51
Support / Re: blitting text and images
« on: May 15, 2010, 08:45:15 pm »
Thats fantastic, cheers :)

52
Support / How to get a texture from a FrameBuffer?
« on: May 15, 2010, 08:43:06 pm »
Trying to get a texture from a framebuffer but its coming out totally transparent/unset :?

Code: [Select]
//set up font
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setTypeface(Typeface.create((String)null, Typeface.BOLD));
paint.setTextSize(16);
glFont = new GLFont(paint);


//created a new framebuffer to render the texture too
Texture textTexture = new Texture(60,60, RGBColor.BLACK);
FrameBuffer meep = new FrameBuffer(gl, 100, 100);

meep.setRenderTarget(textTexture);
meep.clear(RGBColor.BLACK);
glFont.blitString(meep, " test test test! ",
5, 5, 10, RGBColor.WHITE);
meep.display();

(that texture is then applied to a mesh, but it doesn't show up)

Probably something I'm not understanding about the process here.

53
Support / Re: blitting text and images
« on: May 15, 2010, 04:50:19 pm »
The class's look really handy.

I'm working on a AR Browser and need on-the-fly generated text bubbles, so this seems appropriate.

One thing; What license do you consider this under? Though we are developing a free, open source, browser ourself (http://arwave.org/), we want people to be able to re-use and adapt our code for their own projects, even if their commercial. So we need to know any code we use if allowed for that :P


54
You'll need a specific library for that as its quite complex work.
If you google around you should be able to find some open source projects for it though. Theres a lot of rapid AR development at the moment, there's tones of open source projects.
---

Anyone know a good way to sycn camera angle in the code to the real camera's angle on the phone?

I know how to read the sensors and get (rough) angles in the x/y/z from both magnetic and gravitational sensors.

Not sure how to turn this into a SimpleVector for my camera though.
I'm guessing maths is involved :P

55
Thanks for the help, I'm sure this will be usefull to a few others as well.

The vital bit I needed was...


      mGLView.getHolder().setFormat(PixelFormat.TRANSLUCENT);

and to change my;

Code: [Select]
            mGLView.setEGLConfigChooser(new GLSurfaceView.EGLConfigChooser() {
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
// Ensure that we get a 16bit framebuffer. Otherwise, we'll fall
// back to Pixelflinger on some device (read: Samsung I7500)
int[] attributes = new int[] { EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_NONE };
EGLConfig[] configs = new EGLConfig[1];
int[] result = new int[1];
egl.eglChooseConfig(display, attributes, configs, 1, result);
return configs[0];
}
});

to

Code: [Select]
mGLView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
      
Only thing is, thats clearly a fixed solution. Id be worried about other device compatibility.



Pages: 1 2 3 [4]