drawWireframe

Started by ghidra, February 07, 2011, 03:03:32 AM

Previous topic - Next topic

ghidra

Hi.

I am new to jPCT. So far I it's been easy to get something basic running. Before I get too deep in, I was looking into rendering a wireframe so I don't have to deal with textures at the moment. I found the method in the docs, but I'm not sure I am applying it right.


framebuffer.clear(back);
world.renderScene(framebuffer);
world.draw(framebuffer);
world.drawWireframe(framebuffer, wirecolor );
framebuffer.display();


wire color set to white 255,255,255 and nothing draws. Even without the the first draw call, the wireframe doesn't draw.

Like I said, I'm new and just getting to digging around. I haven't even gotten into shaders yet, maybe a basic phong or lambert with a color might be good too instead of wireframe. Just looking for some basic drawing to get things figured out. Also, about wireframe, sense I have seen it, is there a type of hidden line removal available?

I'm looking forward to learning more about this library and being around in the community.

EgonOlsen

Wire frames are not supported by the AE-version ATM. I was pretty lazy on this, because no one ever complained about them not working. Do you really need them?

ghidra

I don't necessarily need them. I'll just need to research the shaders, and just make myself something simple. I was hoping to build a project with lo-fi style graphics. But I don't mean to make you implement wireframe, I'm sure there are other things I might use a favour for in the future ;)

EgonOlsen

Which shaders? Shaders aren't supported by jPCT-AE because they are ES 2.0 only and i don't have the hardware and in addition i consider them to be rather pointless on most devices.

ghidra

ah. I apologize for my ignorance. And I thank you for your quick response and help.

So, is the primary option for shaded color on geometry only with an image? And, besides that, is there a way to, say, dial in specular. Or does it all run in kind of a general context?

Again, thanks for your patience. I am going through as much documentation to soak up as much of this as I can.

EgonOlsen

If you don't assign a texture, a default white one will be used. You can set an additional color that will be added to ambient lighting and the light from the light sources. Polygons will be shaded by using gl's standard gouraud shading. You can enable specular lighting as well, but the results usually aren't very impressive.

Darkflame

There are times when I'd have found wireframe usefull - mostly in editing/debugging a scene and wanting to see bits more clearly.

Is it a lot of work to implement in the engine? Or just something you have to copy over or toggle on?

Might be a little retro-thinking of me, but sometimes wireframes can be used nicely in games too. (I've seen it used to add "thin detail" onto objects back when polygon counts were still very restrictive).
But that would be need to be on a per-object base's and not sure how possible that is.

EgonOlsen

It's not a simply copy and paste job. If it were, i would have ported it already. I've to change some things to support it on Android. Nothing really difficult, i just avoided it because there was no real demand. I'll add it, when i find the time.

Darkflame

Ok, not a problem.
Its kinda a bit in the catagory of "lens flares" for me, nice to have as an option but not strictly essential.

luftiguru

It's been a while since the last news on drawWireframe() in jPCT AE.
I'd like to use wireframed 3D overlays in my augmented reality app. Is there any chance, to find the method implemented in jPCT AE soon?
I'd really appreciate any progress in this matter or hints, how to achieve a similar result for my own.
Thanks!  :)

EgonOlsen

It's already implemented. You can choose between points and lines, but there's a drawback: The implementation of lines doesn't create results as you might expect them. That's caused by some design decision on how OpenGL ES does handle line drawing. To fix this, i would have to create a complete new batch of geometry for each object just to render proper lines...and i'm not going to do that. So just give it a try. Depening on the object, it might look good enough. Or maybe point mode is an option.

luftiguru

Thanks for the fast reply. :)
I tried wireframes with the newest version of jPCT AE (July 4, 2013).
First thing, I noticed is the changed API. The method has two additional parameters now:
void com.threed.jpct.World.drawWireframe(FrameBuffer buffer, RGBColor color, int size, boolean pointMode)
BTW... the online documentation still points to the old API version.

Nevertheless, I tried to use the method with various combinations of "size" and "pointMode". Unfortunately, an exception was thrown at every try:

FATAL EXCEPTION: GLThread 1579
java.lang.RuntimeException: Not implemented!
at com.threed.jpct.GL20.glPointSize(GL20.java:1049)
at com.threed.jpct.GLRenderer.drawWireframe(GLRenderer.java:2244)
at com.threed.jpct.World.draw(World.java:1349)
at com.threed.jpct.World.drawWireframe(World.java:1114)
at myapp.MyRenderer.onDrawFrame(MyRenderer.java:70)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1516)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

Any Idea, why this happens? Will a fix be available soon? :)

EgonOlsen

The online documentation is fine. Make sure that you are looking at the version for jPCT-AE, not the one for desktop jPCT. I'll have a look into the other issue...looks like as if i've forgotten to implement some GL 2.0 related stuff... :o

EgonOlsen

OpenGL ES 2.0 obviously doesn't support glPointSize and i haven't added a compatibility layer for this yet. You can try this version: http://jpct.de/download/beta/jpct_ae.jar. It should work (i.e. not crash), but you still can't set a point's in point mode. Points will always be one pixel in size. You can set the width of lines though.

luftiguru

Awesome! Thanks for the great support. :)
It works now. The generated wireframes are rendered correctly and are exactly, what I needed so far.