Monday, April 28, 2008

POGD review 1






For this week I am going to review on Devil May Cry 4.




The story is about a guy with a demonic hand by the name of Nero living in a secluded village that still worship's Sparda as a god. However the church that advocates Sparda as a god seems to plan something else other than worshipping him.






Gameplay: The control are quite smooth and in DMC4 there is an automatic function that somehow predicts what you want to do to achieve certain combos and helps you to do them. However it seemed to me that that automatic function is a little too helpful as it does some combos which I have never started to press before.

This is an attack combo of Nero's red queen
attack, pause , attack, attack, attack




Graphics : The whole thing is in HD and everything is nice to look at especially the bosses.

Here's a picture of one of the people in the church:






Level Design: On the whole the level design is not bad, however the minimap is a little confusing for me at first, there was once I got stuck in a level for 1 hour due to me seeing a door but there was no door there. Finally i realized that the map shows a top view of the place and that door is being obstructed by something else instead.

Wednesday, January 2, 2008

Practical 12

Today at practical we were asked to apply textures on to objects.

After tinkering around with the code i finally came up with this picture

Here's the code used to do this

glBegin(GL_QUADS);
gTexture.SetTexture();
glTexCoord2f(0,0);
glVertex2f(0,0);
glTexCoord2f(1,0);
glVertex2f(5.5,0);
glTexCoord2f(1,1);
glVertex2f(5.5,5.5);
glTexCoord2f(0,1);
glVertex2f(0,5.5);
//draw quad here
Ok I am going back to finsih up the rest of it edit this post later bye.
glEnd();

Wednesday, December 12, 2007

Practical 9

Currently doing my practical 9 now having some problems on the lighting for some reason when i put in the lighting code the viewport became a 2d view like this:

will post more on this if i managed to finish it.

Practical 8

For this practical we were asked to do our assignment one.
I went on to my assignment which was a robot on wheels playing a keyboard
Why this?
I couldnt think of any idea and so I ended up doing this

Wednesday, November 28, 2007

Practical 7







Today in class we were asked to do some lighting on the objects created.







Here are some pictures






Another one on the cylinder


And one on my robot

Here is the code needed to make it work

void init(void)
{
GLfloat ambient[] = { 0.0, 0.0, 0.0, 1.0 };
GLfloat diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat specular[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat position[] = { 0.0, 3.0, 2.0, 0.0 };
GLfloat lmodel_ambient[] = { 0.4, 0.4, 0.4, 1.0 };
glClearColor(0.0, 0.1, 0.1, 0.0);
//Enable Depth test
glShadeModel(GL_SMOOTH);
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
glLightfv(GL_LIGHT0, GL_POSITION, position);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
}
In mydisplay()

GLfloat mat_diffuse[] = { 0.1, 0.5, 0.8, 1.0 };
GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat low_shininess[] = { 5.0 };
//Clear buffer.
glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialfv(GL_FRONT, GL_SHININESS, low_shininess);
In main()
init();


Practical 6

This week we were asked to create an object and code it in such a way that when a certain key is pressed, the object will move in that specific direction

Here's a screenshot of it:

Here is the code used to make this thing move:
In void main
glutKeyboardFunc(Keyboard);
Declared as global are:
int x= 0;
int y=0;
In the KeyboardFunc(Keyboard)

void Keyboard(unsigned char key, int x, int y)
{
switch(key) //check which key is pressed
{
case 'd':
::x++; //add 1 to global x.
break;
case 'a':
::x--; //minus 1 to global x.
break;
case 'w':
::y++;
break;
case 's':
::y--;
break;
}
}
In my display()
glTranslatef(::x,::y,0);

Wednesday, November 21, 2007

Practical 5

On the 5th week of my lab session:



We were asked to do a robot and animate it.

However currently I have only been able to rotate it.

Either way here's a picture of it

Here's a sample code of the creation of the robot

void drawBody()
{
glBegin(GL_QUADS);
glVertex3f(15,5,5);
glVertex3f(15,5,-5);
glVertex3f(15,-20,-5);
glVertex3f(15,-20,5);
glVertex3f(-15,-20,5);
glVertex3f(-15,-20,-5);
glVertex3f(-15,5,-5);
glVertex3f(-15,5,5);
glVertex3f(-15,5,5);
glVertex3f(-15,-20,5);
glVertex3f(15,-20,5);
glVertex3f(15,5,5);
glVertex3f(-15,5,-5);
glVertex3f(-15,-20,-5);
glVertex3f(15,-20,-5);
glVertex3f(15,5,-5);
glVertex3f(-15,5,-5);
glVertex3f(-15,5,5);
glVertex3f(15,5,5);
glVertex3f(15,5,-5);
glVertex3f(-15,-20,-5);
glVertex3f(-15,-20,5);
glVertex3f(15,-20,5);
glVertex3f(15,-20,-5);
glEnd();
}

void head()
{
glutSolidSphere(9,34,23);
}
void drawLimb()
{
glBegin(GL_QUADS);
glVertex3f(5,5,5);
glVertex3f(5,5,-5);
glVertex3f(5,-15,-5);
glVertex3f(5,-15,5);
glVertex3f(5,-15,5);
glVertex3f(5,-15,-5);
glVertex3f(-5,-15,-5);
glVertex3f(-5,-15,5);
glVertex3f(-5,-15,5);
glVertex3f(-5,-15,-5);
glVertex3f(-5,5,-5);
glVertex3f(-5,5,5);
glVertex3f(-5,5,-5);
glVertex3f(-5,5,5);
glVertex3f(5,5,5);
glVertex3f(5,5,-5);
glVertex3f(-5,5,5);
glVertex3f(5,5,5);
glVertex3f(5,-15,5);
glVertex3f(-5,-15,5);
glVertex3f(5,5,5);
glVertex3f(-5,5,5);
glVertex3f(-5,-15,5);
glVertex3f(5,-15,5);
glEnd();
}
void drawRobot()
{
glPushMatrix();
glColor3f(1,0,0);
glTranslatef(-20, 0.0, 0.0);
glRotatef(40.0, 1.0, 0.0, 0.0);
drawLimb(); //draw upper right arm
glPopMatrix();
glPushMatrix();
glColor3f(0,1,0);
glTranslatef(-20, -15.0, -2.0);
glRotatef(-30.0, 1.0, 0.0, 0.0);
drawLimb(); //lower right limb
glPopMatrix();
glPushMatrix();
glColor3f(1,1,1);
glTranslatef(-10, -45.0, 0.0);
glRotatef(0.0, 0.0, 0.0, 0.0);
drawLimb(); // bot left leg
glPopMatrix();
glPushMatrix();
glColor3f(0,1,1);
glTranslatef(10, -45.0, 0.0);
glRotatef(60.0, 1.0, 0.0, 0.0);
drawLimb(); // bot right leg
glPopMatrix();
glPushMatrix();
glColor3f(1,1,1);
glTranslatef(10, -25.0, 0.0);
glRotatef(0.0, 0.0, 0.0, 0.0);
drawLimb(); //top right leg
glPopMatrix();
glPushMatrix();
glColor3f(0,1,1);
glTranslatef(-10, -25.0, 0.0);
glRotatef(0.0, 0.0, 0.0, 0.0);
drawLimb(); //top left leg
glPopMatrix();
glPushMatrix();
//glTranslatef(0, 0.0, 2.5);
glColor3f(0,0,1);
drawBody();
glPopMatrix();
glPushMatrix();
glColor3f(1,0,1);
glTranslatef(0, 12.0, 0.0);
//glTranslatef(20,30.0,20.0);
head();
glPopMatrix();
glPushMatrix();
glColor3f(1,1,0);
glTranslatef(20, 0.0, 0.0);
glRotatef(-40.0, 1.0, 0.0, 0.0);
drawLimb(); //draw upper left arm
glPopMatrix();
glPushMatrix();
glTranslatef(20, -12.5, 7.5);
glRotatef(-90.0, 1.0, 0.0, 0.0);
drawLimb(); //lower left limb
glPopMatrix();
}
And here is code for rotation
In the Display function:
glPushMatrix();
glRotatef(::rot,xx,yy,zz);
drawRobot();
glPopMatrix();

In the KeyboardFunc:

switch(key)
{
case 'x':
if(pressed==0)
{
xx=1;
pressed=1;
}
else if(pressed==1)
{
xx=0;
pressed=0;
}
break;
case 'y':
if(pressed==0)
{
yy=1;
pressed=1;
}
else if(pressed==1)
{
yy=0;
pressed=0;
}
break;
case 'z':
if(pressed==0)
{
zz=1;
pressed=1;
}
else if(pressed==1)
{
zz=0;
pressed=0;
}
break;
}

In my DoMainLoop:

void DoMainLoop()
{
if(::rot>=-90&&::rot<=90&&::set==0) { ::rot++; if(::rot==90) { ::set=1; } } else if(::rot>=-90&&::rot>=-90&&::set==1)
{
::rot--;
if(::rot==-90)
{
::set=0;
}
}
}
Erm i made a mistake on the rotation, somehow i thought it was to rotate the whole body and this code shows that, i will do the rotating of arms later