| View previous topic :: View next topic |
| Author |
Message |
yimtaka
Joined: 09 Aug 2007 Posts: 8
|
Posted: Fri Aug 10, 2007 5:59 pm Post subject: drawing multiple objects with the GU with different colours? |
|
|
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 |
|
 |
yimtaka
Joined: 09 Aug 2007 Posts: 8
|
Posted: Fri Aug 10, 2007 10:55 pm Post subject: |
|
|
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 |
|
 |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Fri Aug 10, 2007 10:57 pm Post subject: |
|
|
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 |
|
 |
yimtaka
Joined: 09 Aug 2007 Posts: 8
|
Posted: Sat Aug 11, 2007 12:53 am Post subject: |
|
|
| 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 |
|
 |
yimtaka
Joined: 09 Aug 2007 Posts: 8
|
Posted: Tue Aug 14, 2007 8:17 pm Post subject: |
|
|
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 |
|
 |
|