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

#1
Support / Re: Drawing an outline around objects
November 26, 2012, 09:27:46 AM
Edit: Got it working! Thank you for guiding me through it all.

Thanks for the quick fix and all you help so far! I've actually stated working on my own shader that I've passed explicitly to my class that implements IRenderHook, just as you've suggested (Now I can use the new method you've added instead, which is more flexible).
I have a few more question though:
1) I what stage repeatRendering() is called? Is it after the object was drawn to the framebuffer or before?
2) If several objects share the same instance of the same IRenderHook, is it guaranteed that each object would execute "beforeRendering()->repeatRendering()->afterRendering()" synchronously, or is it asynchronous, that is, under some conditions is it possible that (for instance) between repeatRendering and afterRendering of object A, object B will call beforeRendering or repeatRendering?

Again, thank you so much for your help.
#2
Support / Re: Drawing an outline around objects
November 25, 2012, 01:11:17 PM
For some reason getShader() always returns null when called from repeatRendering. Any ideas?
#3
Support / Re: Drawing an outline around objects
November 25, 2012, 11:45:46 AM
Great, Thanks!
So I should call it like so to set the model view matrix?
GLSL shader = object.getShader();
shader.setUniform("modelViewMatrix", myModelViewMatrix);
#4
Support / Re: Drawing an outline around objects
November 25, 2012, 11:33:54 AM
I'm sorry, but I see no documentation for "getShader()" in Object3D or anywhere else. Is it available on a newer version of the library?
#5
Support / Re: Drawing an outline around objects
November 25, 2012, 11:17:18 AM
Thanks, I'm looking into it right now, though I've stumble upon a small issue: Right now we're using OpenGL 2 with jPCT, so how can we modify the modelview matrix that is passed to the built-in default shader that jPCT uses?

Again, many thanks for the help.
#6
Support / Drawing an outline around objects
November 22, 2012, 04:15:26 PM
Hello,

We want to draw an outline / silhouette around selected objects in my scene (see the attachment for example). I've already implemented this effect using pure OpenGL on the iOS version of our app, and now I need to implement it on the Android version that is using jPCT.

How I do this on iOS, is draw the object 4 times:
1) Draw the object with 0 alpha, while disabling the update to the depth mask, and replacing the stencil buffer with ones where the object is painted.
2) Draw a scaled up version of the object with a constant color except where the stencil buffer is 1 (that is, where the actual regular object would be).
3) The same as above but with a scaled down version.
4) Draw the regular object normally.

The effect is quite simple and looks good enough for our use on iOS, but I have no idea how I could implement it using jPCT on Android. I have noticed that I could use IRenderHook to modify the stencil buffer, depth mask etc, so that part is easy. The issue is that I need to control the drawing order, so that I could draw using the above sequence, and I've seen now way to achieve that.

Any help would be greatly appreciated.

[attachment deleted by admin]