[Resolved]only render a certain sides of a QUAD
November 05, 2014 03:48PM
Hi, I was wondering if it is possible to only render certain sides of a QUAD(Cube/Block/Voxel using either/both GX(standalone) or/and GRRLIB
Lets say for example that I have this code:
	GRRLIB_SetTexture(TextrueHere,0);
	GRRLIB_ObjectView(x,y,z, 0,0,0, 0.5,0.5,0.5);
	GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
	
	/* Top */
	GX_Position3f32(-1.0f,1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,0.0f);
	GX_Position3f32(1.0f,1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,0.0f);
	GX_Position3f32(1.0f,-1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,1.0f);
	GX_Position3f32(-1.0f,-1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,1.0f);

	/* Bottom */
	GX_Position3f32(1.0f,1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,0.0f);
	GX_Position3f32(-1.0f,1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,0.0f);
	GX_Position3f32(-1.0f,-1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,1.0f);
	GX_Position3f32(1.0f,-1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,1.0f);

	/* Front */
	GX_Position3f32(1.0f,1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,0.0f);
	GX_Position3f32(1.0f,1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,0.0f);
	GX_Position3f32(1.0f,-1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,1.0f);
	GX_Position3f32(1.0f,-1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,1.0f);

	/* Back */
	GX_Position3f32(-1.0f,1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,0.0f);
	GX_Position3f32(-1.0f,1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,0.0f);
	GX_Position3f32(-1.0f,-1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,1.0f);
	GX_Position3f32(-1.0f,-1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,1.0f);

	/* Left */
	GX_Position3f32(-1.0f,1.0f,-1.0f); 
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,0.0f);
	GX_Position3f32(1.0f,1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,0.0f);
	GX_Position3f32(1.0f,1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,1.0f);
	GX_Position3f32(-1.0f,1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,1.0f);

	/* Right */
	GX_Position3f32(1.0f,-1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,0.0f);
	GX_Position3f32(-1.0f,-1.0f,-1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,0.0f);
	GX_Position3f32(-1.0f,-1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(1.0f,1.0f);
	GX_Position3f32(1.0f,-1.0f,1.0f);
	GX_Color1u32(0xFFFFFFFF);
	GX_TexCoord2f32(0.0f,1.0f);
	
	GX_End();
(don't know if the sides are right yet, kinda new to 3D (that counts for everything about anything: GS,GL,GX,DirectX etc) outside unity :P)

Approach 1
was to just remove the code for a side and lower the position count from 24 to 19 (24-5 = 19) which ofc not worked as its no longer a QUAD,

any help would be lovely? Thanks :)



Edited 2 time(s). Last edit at 11/09/2014 11:55AM by filfat.
Re: [Unresolved]only render a certain sides of a QUAD
November 09, 2014 11:55AM
I can't count can I? I needed to remove 4 not 5 well, that resolves the problem, stupid me :/
Re: [Resolved]only render a certain sides of a QUAD
November 15, 2014 04:19PM
just remember that if you start drawing less quads you have to reduce the number that you past to GX_Begin(GX_QUADS, GX_VTXFMT0, 24); if you don't past the right number GX/wii will crash instantly.
Sorry, only registered users may post in this forum.

Click here to login