forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

drawing multiple objects with the GU with different colours?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
yimtaka



Joined: 09 Aug 2007
Posts: 8

PostPosted: Fri Aug 10, 2007 5:59 pm    Post subject: drawing multiple objects with the GU with different colours? Reply with quote

Hi all,

this may be a simple question but I have been trying ages to get this to work without any success. The closest I get is being able to draw all the objects but they have the same colour but the colour is not correct, it seems to be a mixture of the colours of both objects.

What I have is:

A list of vertices with colour data which have data to draw a simple square

What I want to do is:

draw multiple copies of vertices but each time with a different colour. Something like

void setColourInVertices(int col)
{
loop through all the vertices and change the color property to 'col'
}

int i;
for(i=0;i<3;i++)
{
setColourInVertices(Red);
drawVerticesAt(i*20,20);
}

for(i=4;i<6;i++)
{
setColourInVertices(blue);
drawVerticesAt(i*20,20);
}

When doing the above is it important where you place the sceGUStart and sceGUFinsih and sceGUsync functions?.

Can someone post a small example of doing this?.

cheers.
Back to top
View user's profile Send private message
yimtaka



Joined: 09 Aug 2007
Posts: 8

PostPosted: Fri Aug 10, 2007 10:55 pm    Post subject: Reply with quote

I know this can be easily done by having 2 objects, each with their own vertices but I need to know if it can be done with one object e.g. draw cube at 10,10 in blue then draw cube at 20,20 in red etc.

please help!
Back to top
View user's profile Send private message
Brunni



Joined: 08 Oct 2005
Posts: 186

PostPosted: Fri Aug 10, 2007 10:57 pm    Post subject: Reply with quote

Maybe you could be playing with light, ambient color or something like this?
_________________
Sorry for my bad english
Oldschool library for PSP - PC version released
Back to top
View user's profile Send private message
yimtaka



Joined: 09 Aug 2007
Posts: 8

PostPosted: Sat Aug 11, 2007 12:53 am    Post subject: Reply with quote

Ok another way of describing the problem is say you needed to draw a grid of tiles 5x5 on the screen, each tile had to be a different color. You had the geometry stored in vertices[] which includes gradient color. How would you do it?
Back to top
View user's profile Send private message
yimtaka



Joined: 09 Aug 2007
Posts: 8

PostPosted: Tue Aug 14, 2007 8:17 pm    Post subject: Reply with quote

OK. I have found the solution.

Because I was manipulating the same vertex data each time before drawing to the screen I had to add the line:

sceKernelDcacheWritebackAll();

I added this line after every time I changed something in the vertex object and now everything works as it should.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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