Strange problem with objects+sgl

Hi,


i have a very strange problem with my app, i have two 3D objects made with 3DEditor and i want to display it on the screen but for odd reasons i can't display two objects at once...


Here is what i do, i don't think it's wrong, the init part is from the Torus demo (i use SaturnOrbit):


Code:
	slPushMatrix();

	{

		slTranslate(posl[X], posl[Y], posl[Z]);

		slScale(sca[X], sca[Y], sca[Z]);

		slRotX(angl[X]);                                             

		slRotY(angl[Y]);               

		slRotZ(angl[Z]);

		slPutPolygonX((XPDATA *)&gxpdata_0, light);		

	}

	slPopMatrix();

	

	slPushMatrix();

	{

		slTranslate(pos[X], pos[Y], pos[Z]);

		slScale(sca[X], sca[Y], sca[Z]);

		slRotX(ang[X]);                                             

		slRotY(ang[Y]);               

		slRotZ(ang[Z]);

		slPutPolygonX((XPDATA *)&xpdata_0, light);

	}

	slPopMatrix();


If i include only one model at once, it work, if i include two models BUT i don't display one, it simply display a black screen... i wonder if they are limitations on size of 3d objects, my main scene is like 1500polygons (shaded) and max polys is set to 4000. I tried to copy and modify a little the Torus demo but it don't work too when i put two includes.. maybe it's an issue in the emulator i use (Satourne beta 3)


If anyone can help 🙂
 
In the code you posted, you draw the same object with the same transformations twice. The second drawing will just overdraw the first one. No matter what, you will see only one object on screen.

Of course when the number of polygons or number of vertices of an object exceeds MAX_POLYGONS or MAX_VERTICES, then it won't be drawn. Also, when you draw multiple objects, the total number of polygons and vertices must be below that, else the object won't be drawn.

About black screen problems: If your executable is huge (or mallocs a lot of memory) and the heap collides with the workarea set in WORKAREA.c, then the app can freeze, as some SCU-DMA tables can be overwritten by your program. Well, I don't know if that applies to your program.
 
Oh! Thank you... but i have another problem, here is what i got when i display two objects:


renderng7.png



and if i display only one object (textured):


renderokwq7.png



The gouraud shading/textures lists are initialized like this:


Code:
	slInitSystem(TV_352x224, tex_textsintro, 1);

	set_sprite(pic_textsintro, 8, tex_textsintro);


	slInitGouraud(gourRealMax, GOUR_REAL_MAX, GRaddr, vwork);

	slIntFunction(slGouraudTblCopy);
 
Grz- said:
Oh! Thank you... but i have another problem

Possibly the gouraud table (GRaddr) overwrites textures (SpriteVRAM + x). Check the VDP1 VRAM usage. The Yabause Saturn emulator allows you to display textures in VRAM as a debug option.


You may comment out slIntFunction(slGouraudTblCopy); for a quick check.
 
Back
Top