نمایش نتایج 1 تا 40 از 376

نام تاپیک: آموزش OpenGL

Threaded View

پست قبلی پست قبلی   پست بعدی پست بعدی
  1. #8

    نقل قول: آموزش OpenGL

    ببخشید میشه بصورت برنامه از اول با #include ها و بقیه چیزایی که واسه اجرا نیازه واسم بگذازید نمیدونم چطوری run کنم
    اگه امکانش هست کمکم کنید.
    خیلییییی مممنووووووون
    هیچ جا opengl بلد نیستن .واقعا جای افتخار داره که یه فروم فعال اینجا دارین
    بازم تشکر
    اینجا دسور tween که اجراش مشکل نداره رو واستون گذاشتم


    Point Tween(Point A, Point B, float t)
    {
    Point P;
    P.x = A.x + (B.x - A.x)*t;
    P.y= A.y + (B.y - A.y)*t;
    return P;
    }


    من میخوام با استفاده از این اکد یه حرف الفبا رو به یه حرف دیگه تبدیل کنم.
    مثلا تبدیل توی عکس پایین رو ببینید

    کل مطلبی که من در این رابطه دارم از کتاب گرافیک کامپیوتری هست
    متن این قسمت رو هم واستون میذارم

    Tweening and lerp
    One often wants to compute the point P(t) that is fraction t of the way along the straight line from point A to point B [the tween (for in-between) at t of points A and B].
    Each component of the resulting point is formed as the lerp() of the corresponding components of A and B.
    A procedure Tween (Point2 A, Point2 B, float t) implements tweening for points A and B, where we have used the new data type Point2 for a 2D point:
    struct Point2
    { float x; float y; };

    Tweening takes 2 polylines and interpolates between them (using lerp) to make one turn into another (or vice versa).
    We are finding here the point P(t) that is a fraction t of the way along the straight line (not drawn) from point A to point B.
    To start, it is easiest if you use 2 polylines with the same number of lines.

    We use polylines A and B, each with n points numbered 0, 1, …, n-1.
    We form the points Pi (t) = (1-t)Ai + tBi, for t = 0.0, 0.1, …, 1.0 (or any other set of t in [0, 1]), and draw the polyline for Pi.


    Code for Tween
    void drawTween(Point2 A[ ], Point2 B[ ], int n, float t)
    { // draw the tween at time t between polylines A and B
    for (int i = 0; i < n; i++)
    { Point2 P;
    P = Tween (A[i], B[i], t);
    if (i ==0) moveTo(P.x, P.y);
    else lineTo(P.x, P.y);
    }
    }



    To allow drawing tweens continuously, use the code below with double buffers.
    for (t = 0.0, delT = 0.1; ; t += delT;) {
    //clear the buffer
    drawTween (A, B, n, t);
    glutSwapBuffers();
    if ((t<=0.0) || (t>=1.0)) delT = -delT;
    }
    آخرین ویرایش به وسیله saturn2200 : سه شنبه 09 خرداد 1391 در 23:25 عصر

برچسب های این تاپیک

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •