Skip to main content

Posts

Showing posts with the label 3d to 2D

3D to 2D object Transform source code in c++ with OpenGL

Here is the implementation of 3d to 2d conversion algorithm in c. INPUT:   OUTPUT: SOURCE CODE : #include <windows.h> #include <GL/glut.h> #include <stdlib.h> #include <stdio.h> #include <iostream> #include <math.h> using namespace std; int x,y,z,sx[100],sy[100],sz[100],ex,ey,ez; void drawLine(int x1, int y1,int x2,int y2) {     glBegin(GL_LINES);     glVertex2i(x1,y1);     glVertex2i(x2,y2);     glEnd(); } static void display(void) {     int i,dis,xx[100],yy[100],px,py;     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);     glColor3d(0,255,255);    /* drawLine(100,200,200,100);     drawLine(200,100,300,200);     drawLine(300,200,200,300);     drawLine(100,200,200,300);*/     //glReadPixels(20...