PDA

View Full Version : for loops



jofoxy
03-04-2005, 03:21 AM
hi i wish to create a for loop, with this code information, does anyone know how to do this, i want to colour in certain triangles along a triangle polymesh, i want them to be different colours but they must not repeat a colour.

here is the code from CGPolymesh.cpp

for ((faceIndex!=-1) && m->C[faceIndex].r!=(1.0))
{
//makes a length of red terrain
m -> C [faceIndex].r =(1.0);
m -> C [faceIndex].g =(0.0);
m -> C [faceIndex].b =(0.0);
m -> C [faceIndex].a =(1.0);

faceIndex = nextFace(m, faceIndex, edgeIndex);

//makes a length of red and white triagle strips terrain
m -> C [faceIndex].r =(6.0);
m -> C [faceIndex].g =(6.0);
m -> C [faceIndex].b =(6.0);
m -> C [faceIndex].a =(6.0);

faceIndex = nextFace(m, faceIndex, edgeIndex);
}

in main.cpp the beginning triangle specifed is

faceStrip(&myTerrain, 8, 2);


what am i doing wrong?

thanx

jofoxy

T101
03-04-2005, 03:33 AM
If you copied and pasted that correctly, your for statement is incorrect.

Syntax is:

for(initialisations;condition;loopincrementation)
statement;

rgpc
03-05-2005, 09:28 PM
Bugger me. I accidentally ventured into C for noobs. I hate it when that happened. Can anyone point me to the Advanced Opengl Forum?

jide
03-06-2005, 02:41 AM
Times are changing rgpc ! But don't be so full of hate, and try to be more polite... That way, you just disgust newbies from going on.

You want the advanced opengl forum ? Just have a look at that :p

The most advanced opengl forum (http://www.linuxgraphic.org/forums/viewforum.php?f=11&sid=6ef8a10d14d652416348632980537184)

3k0j
03-06-2005, 11:58 AM
Cant read a merde.

rgpc
03-06-2005, 02:51 PM
Originally posted by jide:
Times are changing rgpc ! But don't be so full of hate, and try to be more polite... That way, you just disgust newbies from going on.

You want the advanced opengl forum ? Just have a look at that :p

The most advanced opengl forum (http://www.linuxgraphic.org/forums/viewforum.php?f=11&sid=6ef8a10d14d652416348632980537184) I'm sorry jide (well I'm not really) but I don't care. I very rarely venture onto this forum now because of the OT posts. And if I discourage just one noob from posting a beginners question in the Advanced forum, good. A Welshman should know enough English to know the meaning of the word Advanced.

SirKnight
03-06-2005, 03:00 PM
I agree with rgpc. I mean common. This is an OPENGL forum for one thing and an ADVANCED one at that. For loop questions have no place here and it should be obvious to anyone w/ an IQ above 10 to know this. Sorry if I'm comming off quite aggressive but damn, ya know? Just b/c this code is part of a GL program doesn't mean it belongs here.

I feel better now.

-SirKnight

plasmonster
03-06-2005, 03:35 PM
I believe the question has already been answered by T101. Why the need to belabor the point?

zed
03-06-2005, 05:09 PM
the problem could be solved simply like i advocated a couple of years ago, create a miscellanous/lounge/rant forum (ie anything goes), if the post isnt 'advanced gl or whatevr' then the moderators can simply move it there,
the excuse 'the poster should know not to post here' doesnt wash

jide
03-07-2005, 02:25 AM
Originally posted by rgpc:

Originally posted by jide:
Times are changing rgpc ! But don't be so full of hate, and try to be more polite... That way, you just disgust newbies from going on.

You want the advanced opengl forum ? Just have a look at that :p

The most advanced opengl forum (http://www.linuxgraphic.org/forums/viewforum.php?f=11&sid=6ef8a10d14d652416348632980537184) I'm sorry jide (well I'm not really) but I don't care. I very rarely venture onto this forum now because of the OT posts. And if I discourage just one noob from posting a beginners question in the Advanced forum, good. A Welshman should know enough English to know the meaning of the word Advanced.I'm not sorry and I don't care just like you. I just find that it's somewhat ridiculous to make a whole book from a newbie post that should have been placed in the other forum.