source code of go back n arq on opengl
#1

Yes...i need code for go back n arq in opengl..
Reply
#2
go back n arq source code is given below :



Code:
001
#include<stdio.h>
002
#include<GL/glut.h>
003
void send();
004
void ack();
005
int i,n,m;
006
void drawrect()
007
{
008
   int x1=100,x2=200,x3=300,x4=400,y1=200,y2=300,y3=400,y4=500;
009
   glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
010
   glColor3f(1.0,0.0,0.0);
011
   for(i=0;i<(3*100);i+=100)
012
   {
013
        glBegin(GL_POLYGON);
014
        glVertex2d(x1,y1+i);
015
        glVertex2d(x2,y2+i);
016
        glVertex2d(x2,y3+i);
017
        glVertex2d(x1,y4+i);
018
     glEnd();
019
   }
020
   for(i=0;i<(3*100);i+=100)
021
   {
022
        glBegin(GL_POLYGON);
023
        glVertex2d(x3,y1+i);
024
        glVertex2d(x4,y2+i);
025
        glVertex2d(x4,y3+i);
026
        glVertex2d(x3,y4+i);
027
     glEnd();
028
   }
029
glFlush();
030
glutSwapBuffers();
031
}
032
static void (*draw)(void) = send;
033
void init()
034
{
035
   glClearColor(1.0,1.0,1.0,1.0);
036
   glMatrixMode(GL_PROJECTION);
037
   glLoadIdentity();
038
   gluOrtho2D(0.0,599.0,0.0,599.0);
039
}
040
void display()
041
{
042
   glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
043
   glColor3f(1.0,0.0,0.0);
044
   glBegin(GL_LINES);
045
     glVertex2d(150,100);
046
     glVertex2d(150,400);
047
   glEnd();
048
   glBegin(GL_LINES);
049
     glVertex2d(400,100);
050
     glVertex2d(400,400);
051
   glEnd();
052
   glRasterPos(75,450);
053
   glutBitmapCharacter(GLUT_BITMAP_8_BY_13,'S');
054
   send();
055
   ack();
056
   if(m=n)
057
       printf("data delivered succesfully\n");
058
   glFlush();
059
glutSwapBuffers();
060
}
061
void send()
062
{
063
   int x1=150,y1=375,x2=400,y2=325;
064
   glColor3f(0.0,0.0,0.0);
065
   for(i=0;i<(n*20);i+=20)
066
   {
067
       glBegin(GL_LINES);
068
        glVertex2i(x1,y1-i);
069
        glVertex2i(x2,y2-i);
070
       glEnd();
071
   
072
   
073
   }
074
printf("DATA SENT\n");
075
}
076
void ack()
077
{
078
   int x3=150,y3=275,x4=400,y4=325;
079
   glColor3f(0.0,1.0,0.0);
080
   for(i=0;i<(m * 20);i+=20)
081
   {
082
       glBegin(GL_LINES);
083
        glVertex2i(x3,y3-i);
084
        glVertex2i(x4,y4-i);
085
       glEnd();
086
   
087

088
   }
089
printf("ACKNOWLEDGEMENT RECIEVED\n");
090
}
091
void main(int argc,char **argv)
092
{
093
   printf("enter the no of data to be sent\n");
094
   scanf_s("%d",&n);
095
   printf("enter the no of acknowledgements to be recieved\n");
096
   scanf_s("%d",&m);
097
    glutInit(&argc,argv);
098
    glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
099
    glutCreateWindow("GO BACK N ARQ");
100
    glutInitWindowSize(600,600);
101
    glutDisplayFunc(display);
102
     
103
    glutCreateWindow("ARQ DIAGRAM");
104
    glutInitWindowSize(500,500);
105
    glutDisplayFunc(drawrect);
106

107
    init();
108
    glutMainLoop();
109
}
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Tagged Pages: selective repeat arq open gl source code,
Popular Searches: for selective repeat arq opengl source code description, ns2 code for selective repeat arq, source code for stop and wait arq in open gl, selective repeat arq code in java, selective repeat arq code in c, arq source code, free selective repeat arq opengl code,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  free download source code of online college magazine 5 17,817 29-06-2018, 10:09 AM
Last Post: Guest
  opengl source code for butterfly 3 3,259 14-05-2018, 08:57 AM
Last Post: Akshatha k
  ice cream parlour management system in vb source code 4 5,288 04-04-2018, 11:58 PM
Last Post: vprk77
  source code in php for online training and placement cell management 1 6,686 23-03-2018, 09:06 AM
Last Post: ritzi
  free download college website project in html with source code 2 4,621 24-02-2018, 10:46 AM
Last Post: Guest
  source code for hospital management system in jsp 4 1,951 13-01-2018, 10:51 AM
Last Post: dhanabhagya
  source code in c for dna cryptography in computer sc ppt 1 1,533 09-01-2018, 09:59 PM
Last Post: harshavarshinib
  java programmings for bus ticket reservation source code 1 6,221 09-11-2017, 11:28 PM
Last Post: Ayushi Nagar
  location alarm android tutorial and source code 1 1,457 14-10-2017, 02:53 PM
Last Post: shakil19944
  source code in matlab for fuzzy based traffic light controll system 2 1,329 08-10-2017, 02:12 PM
Last Post: nomanamjad143

Forum Jump: