Skip to main content

Posts

Showing posts from May, 2011

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...

Client Server MineSweeper source code in Java with remote method invocation

First Create a project with these 3 class. 1.game.java 2.RmiClient.java 3.ReceiveMessageInterface.java /**  * @(#)game.java  *  *  * @author sharma  * @version 1.00 2011/5/5  */  import java.rmi.*; import java.awt.BorderLayout; import java.awt.Color; import javax.swing.JFrame; import javax.swing.JTabbedPane; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JButton; import javax.swing.SwingConstants; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.Transparency; import javax.swing.event.*; import java.sql.*; import java.util.*; import java.net.URL; import javax.imageio.ImageIO; import java.lang.*; import java.io.*; import javax.swing.BoxLayout; public class game extends JFrame {         RmiClient rm;     JLabel name = new JLabel();     JPanel jPanel1 = new JPanel();     JLabel ...

Image Downloader source code in Java and Manga downloader

import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.URL; public class ImagesDownloader {     public static void main(String[] args) throws IOException {         getImages();     }         private static void getImages() throws IOException {         String imagesRootPath = "http://somemanga.com/images2/";               // http://somemanga.com/images2/13342848.jpg             // http://i999.mangareader.net/naruto/538/naruto-2251381.jpg             for (int i = 13342848; i <= 13342848+9; i++) {            ...

Object Transformation source code in c++ with Glut/opengl

In this algorithm one rectangle has been transformed 30-degree angle and it also move from the current object by x 100 and y 100. Here the white rectangle is input and red one is output.         INPUT:             OUTPUT:       #include <windows.h> #include <GL/glut.h> #include <stdlib.h> #include <iostream> #include <string> #include <string> #include <ctype.h> #include <math.h> #include <stdio.h> #include <map> #include <vector> using namespace std; int trans_x,trans_y; #define pi 2.0*acos(0) long x_min,x_max,y_min,y_max; vector <int>x_cor; vector <int>y_cor; long draw_line(long x_start , long y_start , long x_end, long y_end) {     glBegin(GL_LINES);     glVertex2f(x_start,y_start); //start points     glVertex2f(x_end,y_end); // end...

Line Clipping or Liang Bersky Algorithm source code in c++ with openGL

#include <windows.h> #include <GL/glut.h> #include <stdlib.h> #include <iostream> #include <string> #include <string> #include <ctype.h> #include <math.h> #include <stdio.h> #include <map> #include <vector> double xmin=50,ymin=50,xmax=100,ymax=100; double xvmin=150,yvmin=150,xvmax=400,yvmax=400; double x2,y2,x3,y3; int test(double p,double q,double *t1,double *t2) {     double t=q/p;     if(p<0.0)     {         if(t> *t1) *t1=t;         if(t> *t2) return(false);     }     else if(p>0.0)     {         if(t< *t2) *t2=t;         if(t< *t1) return(false);     }     else if(p==0.0)     {    ...