A program in c\c++ using Open GL that draws following figure

Posted by 123techguide on October 21, 2013 in C Program, Information, OpenGl / Graph, Program with Comments closed |






#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <glut.h>
#include <stdlib.h>

#define WINW 1000
#define WINL 1000

void setup()
{
glClearColor(0.0f,0.0f,0.0f,0.0f);
glClear(GL_COLOR_BUFFER_BIT);
glutSwapBuffers();
}

float xmap(int x)
{
float fx,halfw;
halfw=(float)WINW/2;
fx=x/halfw;
return fx;
}

float ymap(int y)
{
float fy,halfl;
halfl=(float)WINL/2;
fy= y/halfl;
return fy;
}


void display()
{
int i;
for(i=1;i<=4;i++)
{
glBegin(GL_LINE_STRIP);
glColor3f(0.0f,1.0f,0.0f);
glVertex3f(xmap(0),ymap(0),0.0f);
glVertex3f(xmap(50),ymap(25),0.0f);
glVertex3f(xmap(50),ymap(0),0.0f);
glEnd();
glutSwapBuffers();
glTranslatef(xmap(50),0.0f,0.0f);
}
}

int main(int argc,char * argv[])
{
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(WINW,WINL);
glutCreateWindow("123techguide.blogspot.com");

setup();
glutDisplayFunc(display);

glutMainLoop();

getch();

return 0;
}

Setting up Alliance broadband in Ubuntu 13.04

Posted by 123techguide on July 18, 2013 in Blogger, browser, Free, social network with Comments closed |

Manually set network settings

If your network doesn't automatically assign network settings to your computer, you may have to manually enter the settings yourself. This topic assumes that you already know the correct settings to use. If not, you may need to ask your network administrator or look at the settings of your router or network switch.



To manually set your network settings:


  • Click the network menu on the menu bar and click Edit Connections.


  • Add Ethernet connection and create


  • Then Go Ethernet tab and choose  Device Mac address.



  • Go to the IPv4 Settings tab and change the Method to Manual.

Click Add and type the IP addressnetwork mask and default gateway IP address into the corresponding columns of theAddresses list. Press Enter or Tab after typing each address.
These three addresses must be IP addresses; that is, they must be four numbers separated by periods (e.g. 123.45.6.78).

Address : IP Address
Netmask : Subnet Mask
Gateway : Default Gateway
DNS Server : Preferred DNS server
Search Domain : Alternate DNS Server




  • Click Save


Write a Program in c/c++ using Open GL that draws Digital Signal/Wave

Posted by 123techguide on May 24, 2013 in C Program, Information, OpenGl / Graph, Program with Comments closed |





#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <stdlib.h>
#include <glut.h>


#define WINW 800
#define WINL 600

float xmap(int x)
{
float halfw,fx;
halfw = (float)WINW/2;
fx = (x)/halfw;
return fx;
}

float ymap(int y)
{
float halfy,fy;
halfy = (float)WINL/2;
fy = (y)/halfy;
return fy;
}


void setup()
{
glClearColor(0.0f,0.0f,0.0f,0.0f);
glClear(GL_COLOR_BUFFER_BIT);
glutSwapBuffers();
}


void display()
{
int i;

for(i=1;i<=3;i++)
{
glBegin(GL_LINE_STRIP);
glColor3f(1.0f,1.0f,1.0f);

glVertex3f(xmap(0),ymap(0),0.0f);
glVertex3f(xmap(0),ymap(100),0.0f);
glVertex3f(xmap(50),ymap(100),0.0f);
glVertex3f(xmap(50),ymap(0),0.0f);
glVertex3f(xmap(150),ymap(0),0.0f);
glEnd();
glutSwapBuffers();
glTranslatef(xmap(150),0.0f,0.0f);
}
}


int main(int argc,char * argv[])
{
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
glutInitWindowSize(WINW,WINL);
glutCreateWindow("123techguide.blogspot.com");

setup();
glutDisplayFunc(display);

glutMainLoop();
getch();

return 0;
}

Open GL : Geometric Primitive Names and Meanings

Posted by suvasis dutta on May 24, 2013 in C Program, Information, Mobile Trick, OpenGl / Graph with Comments closed |

Geometric Primitive Names and Meanings
Value
Meaning
  • GL_POINTS

Individual points
  • GL_LINES
Pairs of vertices interpreted as individual line segments
  • GL_LINE_STRIP

Series of connected line segments
  • GL_LINE_LOOP

Same as above, with a segment added between last and first vertices
  • GL_TRIANGLES

Triples of vertices interpreted as triangles
  • GL_TRIANGLE_STRIP

Linked strip of triangles
  • GL_TRIANGLE_FAN

Linked fan of triangles
  • GL_QUADS

Quadruples of vertices interpreted as four-sided polygons
  • GL_QUAD_STRIP

Linked strip of quadrilaterals
  • GL_POLYGON

Boundary of a simple, convex polygon






void glTranslatef ( GLfloat x,   GLfloat y,   GLfloat z )PARAMETERS x, y, z
 Specify the x, y, and z coordinates of a translation vector.

DESCRIPTION:
 glTranslate produces a translation by (x,y,z).  The current matrix (seeglMatrixMode)  is multiplied by this translation matrix, with the product replacing the current matrix, as if glMultMatrix were  called  with
 the following matrix for its argument:

                                       1 0 0 x
                                       0 1 0 y
                                       0 0 1 z
                                       0 0 0 1





Open GL Setup

Posted by suvasis dutta on April 20, 2013 in Free, Information, OpenGl / Graph with Comments closed |

  1. Copy OPENGL folder to  C:\
  2.   dynamically-linked libraries (place in the \Windows\System32) subdirectory

  opengl32.dll ,   glu32.dll , glut32.dll , glut.dll

3. Open Microsoft Visual C++

  • Create a new project:
  • Choose File | New from the File Menu
  • Select the Projects tab
  • Choose Win32 Console Application
  • Fill in your Project name






  • Ok , Finish , OK
  • Click on Tools- Options – Directories
  • Add Include and Library Directories









  • Now the Library and include directories are mentioned.

  • Then Click on PROJECT – Settings – Link
  •  Then place the cursor on Object / Library Modules
  • Press End which will place the cursor at end.

  • And paste this:

            GLAUX.LIB GLU32.LIB glut32.lib glut.lib OPENGL32.LIB

              And press OK. Now you are ready to use it.







Draw a Filled Polygon : OpenGL / Graph Programme

Posted by suvasis dutta on January 17, 2013 in OpenGl / Graph with Comments closed |






#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <stdlib.h>
#include <glut.h>

void myInit(void)
{
glClearColor(1.0,1.0,1.0,0.0);
glColor3f(1.0f,0.0f,0.0f);
glPointSize(4.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,800.0,0.0,600.0);
}

void myDisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glVertex2i(100,100);
glVertex2i(100,300);
glVertex2i(400,300);
glVertex2i(600,150);
glVertex2i(400,100);
glEnd();
glFlush();
}
int main(int argc,char * argv[])
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(800,600);
glutInitWindowPosition(100,100);
glutCreateWindow("opengl Window");
glutDisplayFunc(myDisplay);
myInit();
glutMainLoop();
getch();
return 0;
}


Print The Number Following Patttern

Posted by suvasis dutta on July 18, 2012 in Linux, Shell Script with Comments closed |
Shell script print the number following pattern


1
2 2
3 3 3
4 4 4 4
5 5 5 5 5


#!/bin/bash
clear
i=1
while [ $i -le 5 ]
do
n=1
while [ $n -le $i ]
do
echo " $i \c "
n=`expr $n + 1 `
done
echo "\n"
i=`expr $i + 1 `
done


Shell Script–Character Replace By Next Character

Posted by suvasis dutta on July 16, 2012 in C Program, Information, Linux, Shell Script with Comments closed |

Write a shell script to encrypt the content of a file using logic .

 (i) Replace a character by just next character in the cycle for example A by B ( or a by b), B by C (or b   by c), Y by Z (or y by z), Z by A ( or z by a).


(ii) Leave numbers and any other symbols unchanged.


#!/bin/bash
str=""
echo " enter a file name "
read str
cat $str | tr '[abcdefghijklmnopqrstuvwxyz]' '[bcdefghijklmnopqrstuvwxyza]' | tr '[ABCDEFGHIJKLMNOPQRSTUVWXUZ]' '[BCDEFGHIJKLMNOPQRSTUVWXUZA]' >output.txt
cat output.txt

   

Print Message According to System’s Time –Shell Script

Posted by suvasis dutta on July 16, 2012 in Linux, Shell Script with Comments closed |


Write a shell script that prints the message "Good Morning", "Good After Noon", "Good Evening", or " Good night " according to the system's time.


#!/bin/bash
t=""
t=`echo $(date +"%H") `
if [ $t -le 10 -a $t -ge 6 ]
then
echo " Good morning "
elif [ $t -gt 10 -a $t -le 16 ]
then
echo " good after noon"
elif [ $t -gt 16 -a $t -le 20 ]
then
echo "good evening "
elif [ $t -gt 20 -a $t -le 5 ]
then
echo " good night "
fi



Test Your Anti-Virus Using Notepad

Posted by suvasis dutta on July 11, 2012 in Notepad, Trick, windows, Windows 7 with Comments closed |
You can easily test your Anti-virus program with a simple notepad trick.You can test your Anti-virus effectiveness using a simple notepad code.Follow the steps below :-

  1. Open notepad.
  2. Copy and paste the code below in notepad .
  3. X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*  
  4. Save file as check-antivirus.bat (*.bat).
After sometime scan your file with your antivirus .If your anti-virus program detect the file a virus,then you sure that your anti-virus program is working properly.
    If not detect the file a virus , this is a right time change your anti-virus .

    Copyright © 2011-2016 Internet Services Such as Hosting Web Design All rights reserved.
    This site is using the Desk Mess Mirrored theme, v2.5, from BuyNowShop.com.