Met a girl in the parking lot And all I did was say hello Her pepper spray made it rather hard For me to walk her home But I guess that's the way it goes Tell me again was it love at first sight When I walked by and you caught my eye Wouldn't you know love could shine this bright Well smile because you're the deer in the headlights Met a girl with a graceful charm But when beauty met the beast he froze Got the sense I was not her type By black eye and bloody nose But I guess that's the way it goes Tell me again was it love at first sight When I walked by and you caught my eye Wouldn't you know love could shine this bright Well smile because you're the deer in the headlights It's suffocating to say, but the female mystique take my breath away So give me a smile or give me a sneer Cause i'm trying to guess here Tell me again was it love at first sight When I walked by and you caught my eye Wouldn't you know love could shine this bright Well smile because you're the deer in the headlights Tell me again was it love at first sight When I walked by and you caught my eye Wouldn't you know love could shine this bright If life was a game you would never play nice If love was a beam you'd be blind in both eyes Put your sunglasses 'cause you are the deer in the headlights Well smile because you're the deer in the headlights You're the deer in the headlights You're the deer in the headlights
dodious blog. Powered by Blogger.

Wednesday, November 24, 2010

membuat robot dengan Pelles C

#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glfw.h>
#include <math.h>
#define pi 3.1415
void mulaiOpenGL(void);
int main(void)
{
//
// mRunning = TRUE, aplikasi masih berjalan
// mRunning = FALSE, ??? :p
GLuint mRunning = GL_TRUE;
//
// inisialisasi GLFW
if( glfwInit() == GL_FALSE )
{
MessageBox( NULL, “ERROR :: gagal menginisialisasi GLFW”, “Error!”, MB_OK);
return(0);
}
//
// buat sebuah window yang akan digunakan untuk menggambar.
if( glfwOpenWindow( 640, 480, 0, 0, 0, 0, 24, 0, GLFW_WINDOW ) == GL_FALSE )
{
MessageBox( NULL, “ERROR :: gagal membuat window”, “Error!”, MB_OK );
glfwTerminate();
return(0);
}
//
// Set judul yang ada di window dan Swap interval.
glfwSetWindowTitle( “Praktikum Grafik Komputer LabTI” );
glfwSwapInterval( 1 );
//
// mulai OpenGL (melakukan setting awal OpenGL)
mulaiOpenGL();
//
// mulai looping utama program
while( mRunning )
{
//
// bersihkan layar dan depth buffer
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glLoadIdentity();
//
// lakukan penggambaran di sini
//————————————————————————————
gluLookAt(0.0,0.0,20.0,0.0,0.0,0.0,0.0,1.0,0.0);
float x, y, sudut;
for (sudut = 0.0f;sudut <=2.0 * pi ; sudut +=0.001f)
{x=2.0f * sin (sudut);
y= 2.0f * cos (sudut);
glBegin (GL_POINTS);
glVertex3f (x, y, 5);
glEnd();
}
glBegin (GL_QUADS);
//persegi pnjg
glVertex2f(-1.0f,-2.5f);
glVertex2f(1.0f,-2.5f);
glVertex2f(1.0f,-7.5f);
glVertex2f(-1.0f,-7.5f);
glColor3f(1.0f,0.0f,1.0f);
//persegi
glVertex2f(-2.0f,-7.5f);
glVertex2f(2.0f,-7.5f);
glVertex2f(2.0f,-11.0f);
glVertex2f(-2.0f,-11.0f);
glColor3f(0.0f,1.0f,0.0f);
glEnd();
//topi
glBegin(GL_TRIANGLES);
glVertex2f(3.0f,2.65f);
glVertex2f(-3.0f,2.65f);
glVertex2f(0.0f,6.0f);
glEnd();
//tangan
glBegin(GL_LINES);
glVertex2f(-1.0f,-2.5f);
glVertex2f(-4.25f,-5.0f);
glVertex2f(1.0f,-2.5f);
glVertex2f(4.25f,-5.0f);
//tangkai
glVertex2f(-4.25f,-6.0f);
glVertex2f(-4.25f,-1.5f);
glEnd();
//bunga
glBegin(GL_POLYGON);
glColor3f(1.0f,0.0f,0.0f);
glVertex2f(-3.75f,-1.5f);
glVertex2f(-4.75f,-1.5f);
glVertex2f(-4.75f,-0.5f);
glVertex2f(-4.5f,-1.0f);
glVertex2f(-4.25f,-0.5f);
glVertex2f(-4.0f,-1.0f);
glVertex2f(-3.75f,-0.5f);
glEnd();
//————————————————————————————
//
// tampilkan ke layar (swap double buffer)
glfwSwapBuffers();
//
// check input , apakah tombol esc ditekan atau tombol “close” diclick
mRunning = !glfwGetKey( GLFW_KEY_ESC ) && glfwGetWindowParam( GLFW_OPENED );
}
glfwTerminate();
return(0);
}
void mulaiOpenGL(void)
{
//
// Set viewport ke resolusi 640×480 viewport bisa diibaratkan
// layar monitor anda
glViewport( 0, 0, 640, 480 );
//
// Set mode OpenGL ke mode pryeksi (Projection) dan set proyeksi
// menggunakan proyeksi perspective, dengan sudut pandang (Field Of
// View) 60 derajat
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective( 60.0f, 640.0f/480.0f, 0.1f, 1000.0f );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
//
// Set mode gradasi warna halus (Smooth)
glShadeModel( GL_SMOOTH );
//
// warna yang digunakan untuk membersihkan layar
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
//
// nilai untuk membersihkan depth buffer.
glClearDepth( 1.0f );
//
// Depth test digunakan untuk menghindari polygon yang
// tumpang tindih.
glEnable( GL_DEPTH_TEST );
glDepthFunc( GL_LEQUAL );
//
// beritahu OpenGL untuk menggunakan perhitungan perspective
// yang terbaik (perhitungan ini tidak bisa selalu 100% akurat)
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
}



0 comments:

Post a Comment