 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Ghoti
Joined: 31 Dec 2005 Posts: 288
|
Posted: Tue Oct 23, 2007 6:47 am Post subject: Bezier surface (sceGumDrawBezier()) |
|
|
Hi folks,
I was trying to get a bezier surface rendered but I am in need of extra documentation or help.
Since I use the gum matrix function and render functions I also wanted to use the gum version of the bezier function.
here is what I have:
| Code: | int GraphicsObject::RenderExampleBezier() {
sceGuDisable(GU_TEXTURE_2D);
lineVertex* Bezier = (lineVertex*)sceGuGetMemory(4 * sizeof(lineVertex));
Bezier[0].color = 0xffff6b38;
Bezier[0].x = 0.0f;
Bezier[0].y = 20.0f;
Bezier[0].z = 0.0f;
Bezier[1].color = 0xffff6b38;
Bezier[1].x = 0.0f;
Bezier[1].y = 0.0f;
Bezier[1].z = 5.0f;
Bezier[2].color = 0xffff6b38;
Bezier[2].x = 5.0f;
Bezier[2].y = 0.0f;
Bezier[2].z = 5.0f;
Bezier[3].color = 0xffff6b38;
Bezier[3].x = 5.0f;
Bezier[3].y = 0.0f;
Bezier[3].z = 0.0f;
/*for(int i=0; i<3;i++) {
for(int j=0;j<3;j++) {
Bezier[i*3+j].color = 0xffff6b38;
Bezier[i*3+j].x = (float)i * 5.0f;
if(i!=j)
Bezier[i*3+j].y = 0.0f;
else
Bezier[i*3+j].y = 20.0f;
Bezier[i*3+j].z = (float)j * 5.0f;
}
}*/
sceGumMatrixMode(GU_MODEL);
sceGumLoadIdentity();
//sceGuPatchDivide(2,2);
sceGuPatchPrim(GU_TRIANGLE_STRIP);
sceGumDrawBezier(GU_COLOR_8888 | GU_VERTEX_32BITF | GU_TRANSFORM_3D, 2, 2, 0, Bezier);
sceGuEnable(GU_TEXTURE_2D);
return 0;
} |
this does not work :s so I have some questions.
1.) sceGuPatchPrim has no gum variant, in this case does it work with the gum variant of the drawbezier?
2.) The vertices that have to be passed, should they be with a 4x4 bezier field only 16 points? or do I have to match the number of vertices when I should create that field using triangles or trianglestrips?
3.) In the documentation, sceGuPatchPrim only can have 3 primitives, is this correct or are the three just examples of all other primitives as in the drawarray function.
4.) Last but not least, What am i doing wrong? any ideas, suggestions ?
greets ghoti _________________ My PSP games:
Boxy II: http://www.ghoti.nl/boxyii.php
Elementals: http://www.ghoti.nl/Elementals.php |
|
| Back to top |
|
 |
Raphael

Joined: 17 Jan 2006 Posts: 646 Location: Germany
|
Posted: Tue Oct 23, 2007 8:29 am Post subject: Re: Bezier surface (sceGumDrawBezier()) |
|
|
| Ghoti wrote: |
1.) sceGuPatchPrim has no gum variant, in this case does it work with the gum variant of the drawbezier?
|
Yes. gumDraw* is the same as guDraw, just that it updates the matrices before the call.
| Quote: |
3.) In the documentation, sceGuPatchPrim only can have 3 primitives, is this correct or are the three just examples of all other primitives as in the drawarray function.
|
When you think more about it, you should notice that the other primitive types don't make any sense with a bezier patch at all. Non-strip versions because you need a strip to connect the bezier points and the sprite primitive because it's a screen-aligned rect. _________________ <Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki
Alexander Berl |
|
| Back to top |
|
 |
Ghoti
Joined: 31 Dec 2005 Posts: 288
|
Posted: Tue Oct 23, 2007 6:51 pm Post subject: |
|
|
Okay so in that case it is clear that the nine point field I commented out does not work. However as far as I can tell the four pointfiel should. (or is there a minimum?)
1----2
| |
| |
0----3
This is how I create the 2x2 bezier patch, it should work as far as I know.
Do you know what I am doing wrong?
greets ghoti _________________ My PSP games:
Boxy II: http://www.ghoti.nl/boxyii.php
Elementals: http://www.ghoti.nl/Elementals.php |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|