Advertisement

Lesson 14 experimenting ?

Started by September 17, 2000 10:07 AM
4 comments, last by Ryball 24 years, 2 months ago
1. Any way i can have eatch of the chart rotat seperatly without mutch coding . i know i can do it like this ; glTranslatef(0.0,0.0,-15.0f); glRotatef(rot, 1.0f, 0.0f, 0.0f); glPrint("D"); glLoadIdentity(); glTranslatef(1.0,0.0,-15.0f); glRotatef(-rot, 1.0f, 0.0f, 0.0f); glPrint("E"); This is to time consuming. Any way i can make something like this ? if ( i >= strlen(text)) { ---- rotate and translate -- glPrint(text); } 2. and is there a way to center the the txt on the y axis ? glPrint allrdy senters it on the x axis . Thx :-) -------------- --- Ryball --- --------------
----------------- Ryball -----------------
Look at the glPrint code, you will see it takes the left of the screen and right of the screen and divides by two to get the middle of the screen. Do a similar thing with the vertical.

To rotate all of the letters separately you could use that for loop you said... You will have to load the identity matrix in the loop tho...

Don''t you test these things before asking?

S.
Advertisement
Thx :-)

i do thest thise things before i poste but :

char text[256] = "test";

if ( i >= strlen(text))
{
i++;
glPrint(text);
}

i get this compiling error :

error C2664: ''glPrint'' : cannot convert parameter 1 from ''char'' to ''const char *''

pls help :-)



--------------
--- Ryball ---
--------------
----------------- Ryball -----------------
do this...
        char text[256] = "test";// need to declare a second array to hold each letterchar letter[2];for (int count = 0; count < strlen(text); count++){  letter[0] = text[count];  letter[1] = '\0';  glPrint((const char *)letter);}        


That should do it...
S.

Edited by - Strylinys on September 17, 2000 12:47:18 PM
Cool, Thx allot !!!!




--------------
--- Ryball ---
--------------
----------------- Ryball -----------------
// glPrint((const char *)letter);

fyi, bracketing (const char *) is called type casting. very useful in situations where functions are expecting certain types of parameters that your variables are not in. it just converts "letter" to a const char * instead of char so the function/compiler doesn''t complain.

type casting to often is a hack, but in certain situations it may be the only way to accomplish what you need without overloading functions yourself.

you will run into this ALOT when using other people''s code / libraries. maybe you should look into type casting on the msdn or internet, it''s rather basic but is something you really need to know.

This topic is closed to new replies.

Advertisement