পোস্টগুলি

এপ্রিল, ২০১৬ থেকে পোস্টগুলি দেখানো হচ্ছে

2D Fan design in computer graphics using c++

ছবি
/**Faisal Porag স্বপ্নের প্রতিবিম্ব...  **/ ///Source code : using c++ #include <iostream> #include <stdlib.h> #include <math.h> #include <GL/glut.h> //Initializes 3D rendering void initRendering() { glEnable(GL_DEPTH_TEST); } //Called when the window is resized void handleResize(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0, (double)w / (double)h, 1.0, 200.0); } float _angle = 0.0; float _cameraAngle = 0.0; float _ang_tri = 0.0; //Draws the 3D scene void drawScene() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); //Switch to the drawing perspective glLoadIdentity(); //Reset the drawing perspective glRotatef(-_cameraAngle, 0.0, 1.0, 0.0); //Rotate the camera glTranslatef(0.0, 0.0, -7.0); //Move forward 5 units glPopMatrix(); //Undo the move to the center of the pentagon glPushMatrix(); //Save the current stat

Simple 2D hut design in computer graphics using c++

ছবি
/*Faisal Porag স্বপ্নের প্রতিবিম্ব... */ Source Code: #include <GL/glut.h> void display(void) { /* clear all pixels */ glClear(GL_COLOR_BUFFER_BIT); /* draw white polygon (rectangle) with corners at * (0.25, 0.25, 0.0) and (0.75, 0.75, 0.0) */ glColor3f(0.0, 1.0, 0.0); //glBegin(GL_POLYGON); //glBegin(GL_POINTS); //glBegin(GL_LINES); //glBegin(GL_TRIANGLES); /* glVertex3f(0.25, 0.25, 0.0); glVertex3f(0.75, 0.25, 0.0); glVertex3f(0.75, 0.75, 0.0); glVertex3f(0.25, 0.75, 0.0); */ /* glVertex3f(0.25, 0.25, 0.0); glVertex3f(0.25, 0.75, 0.0); glVertex3f(0.75, 0.25, 0.0); glVertex3f(0.75, 0.75, 0.0); */ //code for one single line /*glVertex3f(0.25, 0.25, 0.0);//starting point glVertex3f(0.75, 0.25, 0.0);//Ending point //code for one single line glVertex3f(0.25, 0.25, 0.0);//starting point glVertex3f(0.50, 0.75, 0.0);//Ending point //code for one single line glVertex3f(0.50, 0.75, 0.0);//starting point glVertex3f(0.75, 0.25, 0.0);//Ending p

Create a Leaf in Computer graphics using c++

ছবি
/*Faisal Porag স্বপ্নের প্রতিবিম্ব... */ //Source code #include <GL/glut.h> #include <math.h> #include <stdio.h> #define CTRL_COUNT 100 int ctrlPointsCount; int ctrlPointsX[CTRL_COUNT], ctrlPointsY[CTRL_COUNT]; int X1[3]={50,40,50}, Y1[3]={35,54,68}; int X2[3]={50,60,50}, Y2[3]={35,48,68}; int X3[3]={50,45,45}, Y3[3]={35,42,32}; void myInit() {     glClearColor(0.4,0.2,0.5,0.0);     glColor3f(0.0,1.0,0.0);     glPointSize(10.0);     glMatrixMode(GL_PROJECTION);     glLoadIdentity();     gluOrtho2D(0.0,128.0,0.0,96.0); } //Main formula  //p(t)=(1-t)^3*p0+3t(1-t)^2*p1+3t^2(1-t)p2+t^3p3 float getNextBezierPointX(float t) { float x=0.0; for(int i=0; i<ctrlPointsCount; i++) { int c; if(i==0 || i==ctrlPointsCount-1) c = 1; else { c = ctrlPointsCount-1; } x +=  c * pow(t, i) * pow(1-t, ctrlPointsCount-1-i) * ctrlPointsX[i]; } return x; } float getNextBezierPointY(float t) { float y=0.0;

3D view in computer graphics using c++

ছবি
/*Faisal Porag স্বপ্নের প্রতিবিম্ব... */ #include <iostream> #include <stdlib.h> #include <math.h> #include <GL/glut.h> void initRendering() { glEnable(GL_DEPTH_TEST); } //Called when the window is resized void handleResize(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0, (double)w / (double)h, 1.0, 200.0); } float _angle = 0.0; float _cameraAngle = 0.0; float _ang_tri = 0.0; float _angle_2 = 90; float i = 0.0f; void drawScene() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // glColor3f(1.0, 0.0, 0.0); glMatrixMode(GL_MODELVIEW); //Switch to the drawing perspective glLoadIdentity(); //Reset the drawing perspective glRotatef(-_cameraAngle, 0.0, 1.0, 0.0); //Rotate the camera glTranslatef(0.0, 0.0, -3.0); //Move forward 5 units // glPushMatrix();     glPushMatrix();     glColor3f(0.0,.9,.8);     glTranslatef(0.6,-0.1,0.0);     glRotatef(_a

Create a solar in computer graphics using c++

ছবি
      #include <iostream> #include <stdlib.h> #include <math.h> #include <GL/glut.h> /*Faisal Porag স্বপ্নের প্রতিবিম্ব... */ //Initializes 3D rendering void initRendering() { glEnable(GL_DEPTH_TEST); } //Called when the window is resized void handleResize(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0, (double)w / (double)h, 1.0, 200.0); } float _angle = 0.0; float _cameraAngle = 0.0; float _ang_tri = 0.0; //Draws the 3D scene void drawScene() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); //Switch to the drawing perspective glLoadIdentity(); //Reset the drawing perspective glRotatef(-_cameraAngle, 0.0, 1.0, 0.0); //Rotate the camera glTranslatef(0.0, 0.0, -7.0); //Move forward 5 units glPushMatrix(); //Save the transformations performed thus far glTranslatef(1.0, 1.0, .85); //Move to the center of the trapez