21 Oct 2012
24 Aug 2012
OPENGL C++
Demonstrates basic use of GLUT toolkit for CS248 video game assignment: theLink
glutTimerFunc(): LINK
glutGet(GLUT_ELAPSED_TIME): LINK 1
glutGet(GLUT_ELAPSED_TIME) @ gamedev.net
glutTimerFunc(): LINK
glutGet(GLUT_ELAPSED_TIME): LINK 1
glutGet(GLUT_ELAPSED_TIME) @ gamedev.net
23 Aug 2012
3 Aug 2012
Right Click Menu
//-------------------------------------------------------------------------
// Draw skybox
//-------------------------------------------------------------------------
#include < ::iostream >
#include "myengine.h"
#include "GL/glut.h"
#include "GL/freeglut.h"
#include < ::windows.h > // WinApi header
#include < ::mmsystem.h>
/* process menu option 'op' */
void menu(int op)
{
switch(op) {
case 'Q':
case 'q':
exit(0);
break;
default:
break;
}
}
/* executed when a regular key is pressed */
void keyboardDown(unsigned char key, int x, int y)
{
switch(key) {
case 'Y':
case 'y':
PlaySound(TEXT("tada.wav"), NULL, SND_ASYNC | SND_LOOP); // music
break;
case 'N':
case 'n':
PlaySound(NULL, 0, 0); // stop music
break;
case 'Q':
case 'q':
case 27: // ESC
exit(0);
break;
}
}
/* executed when a special key is pressed */
void keyboardSpecialDown(int k, int x, int y) {
}
/* reshaped window */
void reshape(int width, int height) {
GLfloat fieldOfView = 90.0f;
glViewport (0, 0, (GLsizei) width, (GLsizei) height);
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
gluPerspective(fieldOfView, (GLfloat) width/(GLfloat) height, 0.1, 1000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
/* executed when button 'button' is put into state 'state' at screen position ('x', 'y') */
void mouseClick(int button, int state, int x, int y) {
}
/* executed when the mouse moves to position ('x', 'y') */
void mouseMotion(int x, int y) {
}
/* render the scene */
void RenderScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearDepth( 1.0 );
glEnable( GL_DEPTH_TEST );
glDepthFunc( GL_LESS );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
/* render the scene here */
glColor3f(0.8f,0.0f,1.0f);
glBegin(GL_QUADS); // draw background quad
glVertex3f(-2.0f, 1.0f, -8.0f);
glVertex3f( 1.0f, 1.0f, -8.0f);
glVertex3f( 1.0f,-1.0f, -8.0f);
glVertex3f(-2.0f,-1.0f, -8.0f);
glEnd();
glFlush();
glDisable( GL_DEPTH_TEST );
glutSwapBuffers();
}
/* executed when program is idle */
void idle() {
}
/* initialize OpenGL settings */
void initGL(int width, int height)
{
//reshape(width, height);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glShadeModel( GL_SMOOTH );
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
glDepthFunc(GL_LEQUAL);
}
/* initialize GLUT settings, register callbacks, enter main loop */
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize( 800, 600 );
glutInitWindowPosition(100, 100);
glutCreateWindow("Perspective's GLUT Template");
// register glut call backs
glutKeyboardFunc( keyboardDown );
glutSpecialFunc( keyboardSpecialDown );
glutMouseFunc( mouseClick );
glutMotionFunc( mouseMotion );
glutReshapeFunc( reshape);
glutDisplayFunc( RenderScene );
glutIdleFunc( idle );
glutIgnoreKeyRepeat(true); // ignore keys held down
// create a sub menu
int subMenu = glutCreateMenu(menu);
glutAddMenuEntry("No", 0);
glutAddMenuEntry("Yes", 'q');
// create main "right click" menu
glutCreateMenu(menu);
glutAddSubMenu("Quit?", subMenu);
//glutAddMenuEntry("Quit", 'q');
glutAttachMenu(GLUT_RIGHT_BUTTON);
initGL(800, 600);
glutMainLoop();
return 0;
}
// Draw skybox
//-------------------------------------------------------------------------
#include < ::iostream >
#include "myengine.h"
#include "GL/glut.h"
#include "GL/freeglut.h"
#include < ::windows.h > // WinApi header
#include < ::mmsystem.h>
/* process menu option 'op' */
void menu(int op)
{
switch(op) {
case 'Q':
case 'q':
exit(0);
break;
default:
break;
}
}
/* executed when a regular key is pressed */
void keyboardDown(unsigned char key, int x, int y)
{
switch(key) {
case 'Y':
case 'y':
PlaySound(TEXT("tada.wav"), NULL, SND_ASYNC | SND_LOOP); // music
break;
case 'N':
case 'n':
PlaySound(NULL, 0, 0); // stop music
break;
case 'Q':
case 'q':
case 27: // ESC
exit(0);
break;
}
}
/* executed when a special key is pressed */
void keyboardSpecialDown(int k, int x, int y) {
}
/* reshaped window */
void reshape(int width, int height) {
GLfloat fieldOfView = 90.0f;
glViewport (0, 0, (GLsizei) width, (GLsizei) height);
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
gluPerspective(fieldOfView, (GLfloat) width/(GLfloat) height, 0.1, 1000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
/* executed when button 'button' is put into state 'state' at screen position ('x', 'y') */
void mouseClick(int button, int state, int x, int y) {
}
/* executed when the mouse moves to position ('x', 'y') */
void mouseMotion(int x, int y) {
}
/* render the scene */
void RenderScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearDepth( 1.0 );
glEnable( GL_DEPTH_TEST );
glDepthFunc( GL_LESS );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
/* render the scene here */
glColor3f(0.8f,0.0f,1.0f);
glBegin(GL_QUADS); // draw background quad
glVertex3f(-2.0f, 1.0f, -8.0f);
glVertex3f( 1.0f, 1.0f, -8.0f);
glVertex3f( 1.0f,-1.0f, -8.0f);
glVertex3f(-2.0f,-1.0f, -8.0f);
glEnd();
glFlush();
glDisable( GL_DEPTH_TEST );
glutSwapBuffers();
}
/* executed when program is idle */
void idle() {
}
/* initialize OpenGL settings */
void initGL(int width, int height)
{
//reshape(width, height);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glShadeModel( GL_SMOOTH );
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
glDepthFunc(GL_LEQUAL);
}
/* initialize GLUT settings, register callbacks, enter main loop */
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize( 800, 600 );
glutInitWindowPosition(100, 100);
glutCreateWindow("Perspective's GLUT Template");
// register glut call backs
glutKeyboardFunc( keyboardDown );
glutSpecialFunc( keyboardSpecialDown );
glutMouseFunc( mouseClick );
glutMotionFunc( mouseMotion );
glutReshapeFunc( reshape);
glutDisplayFunc( RenderScene );
glutIdleFunc( idle );
glutIgnoreKeyRepeat(true); // ignore keys held down
// create a sub menu
int subMenu = glutCreateMenu(menu);
glutAddMenuEntry("No", 0);
glutAddMenuEntry("Yes", 'q');
// create main "right click" menu
glutCreateMenu(menu);
glutAddSubMenu("Quit?", subMenu);
//glutAddMenuEntry("Quit", 'q');
glutAttachMenu(GLUT_RIGHT_BUTTON);
initGL(800, 600);
glutMainLoop();
return 0;
}
24 Jun 2012
28 May 2012
26 Mar 2012
The first chunk of numbers gives you "I <3 YOU" and the second chunk of numbers will give you "THE GAME". Cool huh?
669966666669999996669999996669966669966669999666669966669966
669966666699999999699999999669966669966699669966669966669966
669966666669999999999999996669966669966996666996669966669966
669966666666699999999999966666699996666996666996669966669966
669966666666666999999996666666669966666996666996669966669966
669966666666666669999666666666669966666699669966669966669966
669966666666666666996666666666669966666669999666666999999666
6655555556566656555556665555565555565666665655555666
6666656666566656566666665666665666565656565656666666
6666656666555556555556665655565555565665665655555666
6666656666566656566666665666565666565666665656666666
6666656666566656555556665555565666565666665655555666
Step 1: highlight one paragraph above.
Step 2: press f3 on you keyboard
669966666669999996669999996669966669966669999666669966669966
669966666699999999699999999669966669966699669966669966669966
669966666669999999999999996669966669966996666996669966669966
669966666666699999999999966666699996666996666996669966669966
669966666666666999999996666666669966666996666996669966669966
669966666666666669999666666666669966666699669966669966669966
669966666666666666996666666666669966666669999666666999999666
6655555556566656555556665555565555565666665655555666
6666656666566656566666665666665666565656565656666666
6666656666555556555556665655565555565665665655555666
6666656666566656566666665666565666565666665656666666
6666656666566656555556665555565666565666665655555666
Step 1: highlight one paragraph above.
Step 2: press f3 on you keyboard
25 Mar 2012
6 Mar 2012
4 Mar 2012
DNSEA Skill
15 Jan 2012
8 Jan 2012
21 Dec 2011

Venue: Auditorium Lobby and Function Room (NYP)
Time: 19, 20 Dec 2011 (Monday, Tuesday), 9 - 6pm
A big thank you to Absorbent Mind for teaching me how to speak confidently. The Facilitators are in green-tees, and Mr. Tony is in orange. Yuen Ting and Stanley (not sure whether spelt correctly) guided me in this workshop. I loved playing the "Boom Boom, Chuckie" game. This was the game which I started playing since Sec 3. This workshop made me think what is my dream/vision and start working towards it. Just paid $15 and this is what I receive. I will not forget this memory, that is why I wrote it down on this blog.
Credits (picture): Jacky
19 Dec 2011
4 Dec 2011
1 Dec 2011
Subscribe to:
Posts (Atom)






















