gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > 3D problem with wireframe

#98925 - xexamedes - Fri Aug 18, 2006 3:39 pm

Hi! I pretty new to DS development but have been coding C and java since the earily ninties.

I am trying to port an existing 2d physics library (wiht opengl demos) to DS and so far things are going great. I've scaled things to avoid to be bitten by the 16x16x16 max monster, et.c.

My problem now is that I really need a wireframe look on mu stuff, but no matter which bits I set, I still get every quad filled in white.

N.B. that I don't have a real DS to develop for (yet), but run everything i the Ideas emulator.

My question is whether anyone know if there's a bug in this emu concerning filling, et.c. or if it is a known 'feature' of the DS?

I think I've seen someone post a picture of a wireframe cone somwhere, but I have no ide how it was done.

Thanks for any help,
PS

#98935 - ecurtz - Fri Aug 18, 2006 4:35 pm

You get wireframe by setting the opacity value of your polygons to 0.

No idea if it works in any emulators.

#99022 - walaber - Sat Aug 19, 2006 2:43 am

Code:
glPolyFmt( POLY_ALPHA(0) | POLY_CULL_NONE );


that should do it.

I'm working on some simple 2D physics on the DS as well... I look forward to seeing your work!
_________________
Go Go Gadget NDS!

#99048 - xexamedes - Sat Aug 19, 2006 6:55 am

Thanks! I tried it, and it didn't work :) But I've been googling a bit for this also, and the zeroed alpha value pops up again and again, so I'm sure you're right.

Is there any other specific info on how to use this? Have you set something in the environment gl setup first? etc.

But I'm leaning towards that the ideas emulator has only implemented textured polys, and just fill non-textured as white. I'll have to wait for my DS to know for sure

If I succeed (when! be positive! :) my intention is to make a PALib module out of the physics so that you can just drop stuff into a world and have then roll all over each other. We'll see.

Br,
PS

#99053 - Mighty Max - Sat Aug 19, 2006 8:30 am

Afaik Dualis doesnt do transperency correct on 3D

I.e. the ? signs in this:
[Images not permitted - Click here to view it]
are surrounded by transparence, not as dualis shows them white.
_________________
GBAMP Multiboot

#99056 - Normmatt - Sat Aug 19, 2006 9:40 am

Mighty Max wrote:
Afaik Dualis doesnt do transperency correct on 3D

I.e. the ? signs in this:
[Images not permitted - Click here to view it]
are surrounded by transparence, not as dualis shows them white.


Actually they are supposed to have the white around them, as they do on hardware aswell

#99098 - walaber - Sat Aug 19, 2006 3:26 pm

that code will definately work on the hardware... I don't think Dualis likes it though :)

not sure adout Ideas...
_________________
Go Go Gadget NDS!

#99530 - xexamedes - Tue Aug 22, 2006 9:13 am

I am using the ideas emulator (since it's the only one support 3d atm).

If I understand you correctly, you mean that even though ideas fills my quads, they will be "empty", i.e. wireframed on a real DS ?

My code goes something like this;

<init>
PA_Init();
PA_InitVBL(); // Initializes a standard VBL
PA_Init3D();
PA_InitText(1,3);
</init>
<main loop>
PA_Init3DDrawing(0.0,0.0,0.7,0.0,0.0,Z);
glColor3f(1, 1, 1);
glMatrixMode(GL_MODELVIEW);
glLight(0, RGB15(90, 30, 250), 2, 0, -2);
glPushMatrix();
render();
glPopMatrix(1);
glFlush();
</main loop>
<render>
glEnable(GL_OUTLINE);
glBegin(GL_QUAD);

glPolyFmt(POLY_ALPHA(31)|POLY_FORMAT_LIGHT0|POLY_CULL_NONE);

PA_Vertex3D(v1.x,v1.y, Z);
PA_Vertex3D(v2.x,v2.y, Z);
PA_Vertex3D(v3.x,v3.y, Z);
PA_Vertex3D(v4.x,v4.y, Z);
glEnd();
</render>

And I know that it shouldn't use PA for serious gl work, but everything _else_ work great, and from time to time I've tried to copy stuff from some NeHe demo and end up the same way; Stuff move and fall about correctly, but filled instead of wireframe.

I've begun fiddling with lightning and outlines, but nothing really helps.
Oh, outlines makes it different; Then only collisions are drawn between objects but everything else is invisible :|

Does anyone spot some glaring mistake??

BR,
PS

#99537 - Lick - Tue Aug 22, 2006 10:01 am

You need normals (per quad/per triangle/per vertex, I don't know). Normals point at a direction and allow the GL Lighting system to calculate the lit-color based on that direction.
You'll also need to give the polygons a material to define the way it reflects light.

Those are the key elements to lighting your objects.

(Actually, I'm not really sure if DSGL works that way, but Direct3D does and OpenGL on PC also.)
_________________
http://licklick.wordpress.com

#99573 - ecurtz - Tue Aug 22, 2006 2:30 pm

Code:

// This does something else, not enable wireframe, and there may be issues with glEnable, so I'd drop it for now
//glEnable(GL_OUTLINE);

// move this before glBegin() and change alpha from 31 to 0 to get wireframe mode
glPolyFmt(POLY_ALPHA(0)|POLY_FORMAT_LIGHT0|POLY_CULL_NONE);

glBegin(GL_QUAD);



You don't need to do normals if you don't care about the lighting.