Skip to main content
gamedev.net
🔒 Locked

projected lines

Started by _WeirdCat_ 2 replies 1.4k views
Original Post
_WeirdCat_
_WeirdCat_

instead of geting three lines as i want (picture on the left - well thrid line is almost not visible)

abug.jpg

i get 1 or two or none at all or even three but not placed properly lines.

heres the code:




float apitch = VALIDUJ(pitch);             //validuj is a funciton that ranged degrees between 0 and 360, so if angle is -10 it'll be 350



   glPushMatrix();
   glLoadIdentity();
 gluLookAt(0,0,5.75,0,0,100,0,1,0);
   glRotatef(-apitch,1.0f,0.0f,0.0f);



glColor3f(0,1,0);
glLineWidth(3.0f);

glGetDoublev(GL_MODELVIEW_MATRIX, mmatrix);
glGetDoublev(GL_PROJECTION_MATRIX, pmatrix);
glGetIntegerv(GL_VIEWPORT, vmatrix);

int npk = int(apitch);

int pupka = npk-npk%10;
       float angel;

glPush2DDrawing();   //activates ortho mode
for (i=pupka-10; i <= pupka+10; i=i+10) {
//angel = VALIDUJ(float(i));
z = 10.0f*cos(float(i)*imopi);
y = 10.0f*sin(float(i)*imopi);
   glhProjectd(1.750f,y,z,mmatrix,pmatrix,vmatrix,resxyz);   //projects from 3d to 2d, its gluproject function see http://www.opengl.org/wiki/GluProject_and_gluUnProject_code

glBegin(GL_LINES);
glVertex2d(328,resxyz[1]);
glVertex2d(428,resxyz[1]);
glEnd();
}

glPop2DDrawing();    //deactivates ortho mode
glPopMatrix();

glWriteTEXT(12,30,"PITCH: "+FloatToStr(apitch));
glWriteTEXT(12,60,"start: "+FloatToStr(pupka-10));
glWriteTEXT(12,90,"stop: "+FloatToStr(pupka+10));

 return;

the thing is i want to draw

plane.jpg

problem occurs when i pitch up /down my nose i cant see other lines, any sugestions?

as you see i do not rotate eye i just rotate these lines and draw only 'the visible ones'

slicer4ever
slicer4ever




float apitch = VALIDUJ(pitch);             //validuj is a funciton that ranged degrees between 0 and 360, so if angle is -10 it'll be 350



   glPushMatrix();
   glLoadIdentity();
 gluLookAt(0,0,5.75,0,0,100,0,1,0);
   glRotatef(-apitch,1.0f,0.0f,0.0f);



glColor3f(0,1,0);
glLineWidth(3.0f);

glGetDoublev(GL_MODELVIEW_MATRIX, mmatrix);
glGetDoublev(GL_PROJECTION_MATRIX, pmatrix);
glGetIntegerv(GL_VIEWPORT, vmatrix);

int npk = int(apitch);

int pupka = npk-npk%10;
       float angel;

glPush2DDrawing();   //activates ortho mode
for (i=pupka-10; i <= pupka+10; i=i+10) {
//angel = VALIDUJ(float(i));
z = 10.0f*cos(float(i)*imopi);
y = 10.0f*sin(float(i)*imopi);
   glhProjectd(1.750f,y,z,mmatrix,pmatrix,vmatrix,resxyz);   //projects from 3d to 2d, its gluproject function see http://www.opengl.org/wiki/GluProject_and_gluUnProject_code

glBegin(GL_LINES);
glVertex2d(328,resxyz[1]);
glVertex2d(428,resxyz[1]);
glEnd();
}



make int pupka = npk-npk%10; into: int pupka = -(npk-npk%10);
Lactose
Lactose

Oh my god I can't believe that worked!

(EDIT: Chat room humour.)

Hello to all my stalkers.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.