Mzsmunna
10/16/2019 - 3:16 PM

matcg


#include <stdio.h>
#include<GL/gl.h>
#include <GL/glut.h>

void myDisplay(void);
void myInit(void);
 main(int argc, char** argv)
{
glutInit(&argc, argv); //DISPLAY INITIALIZE THROUGH GLUT!
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); // USED 1 BUFFER HERE, IN ANIMATION USED 2 BUFFER | DISPLAY COLOR MODE
glutInitWindowSize (640, 480); // Display Size
glutInitWindowPosition (200, 150); // where Window will pop up measuring from left top as 0,0 but in all other case measured from left bottom
glutCreateWindow ("Hello World"); // Windows Form name
glutDisplayFunc(myDisplay); //calling myDisplay from glutDisplayFunc as delegate!
myInit (); //Initialize
glutMainLoop(); //continuous calling main() so that program don't close
}
void myDisplay(void)
{
int mat[2][4]={10,20,30,40,15,25,35,45};
int hg[3][3]={1,0,0,0,1,0,0,0,1};
int trip[3][3]={20,50,50,20,20,50};
int trans[2][1]={-20,20};

int Tv

mat[0][0]+=trans[0][0];
mat[0][1]+=trans[0][0];
mat[0][2]+=trans[0][0];
mat[0][3]+=trans[0][0];
mat[1][0]+=trans[0][1];
mat[1][1]+=trans[0][1];
mat[1][2]+=trans[0][1];
mat[1][3]+=trans[0][1];

glClear (GL_COLOR_BUFFER_BIT); //clear color data from buffer string
glColor3f (1.0, 0.0, 0.0); //RGB or glColor3ub(255,0,0)
glPointSize(5.0); // 1PX = 5PX;
glBegin(GL_POINTS); //Start from here.... [GL_TRIANGLE, GL_POLYGON]
//Put point in anti clock (right to left) wise to draw shape as you want!
glVertex2i(mat[0][0], mat[1][0]);
glVertex2i(mat[0][1], mat[1][1]);
glVertex2i(mat[0][2], mat[1][2]);
glVertex2i(mat[0][3], mat[1][3]);
glEnd();

//void matmult(int arr[][], )

/*for(int i=0;i<2;i++)
{
    for(int j=0;j<4;j++)
    {

    }
}*/



glFlush (); //show in display [ Raster! will do work before Rasterization! ]
}
void myInit (void)
{
glClearColor(1.0, 1.0, 1.0, 0.0); //What Ever color is available on window clear it with a RGBA color
glMatrixMode(GL_MODELVIEW); // Another model view is GL_PROJECTION to view object from different angle!
glLoadIdentity(); //matrix pattern like 3x3,2x2..... etc!
gluOrtho2D(0.0, 640.0, 0.0, 480.0); //how we will draw inside the graph/display
//........(left,right,bottom,top)
//for Responsive use % , where 0 = 0% and 1 = 100% or actual display size / initialized windows size!
//
}