Tuesday, May 5, 2009

Final Project

For my final project, I created a 3B boids system.

Screenshots:




http://www.heathersanimations.com

Sunday, April 5, 2009

Project #2

OpenGL based .obj viewer! Here are a few object files that I was able to load.












..Picture from an obj exported from maya of a pyramid!!


I found the cow.obj here.

After several different tries, I was unable to successfully load a file exported from Maya. I followed the given instructions but my program crashed every time.

I give lighthouse3d credit for their awesome tutorials. They especially helped me with this camera function that uses the keyboard.

Monday, March 23, 2009

Web Exercise in lieu of Friday, March 20

Example 3.1 from the OpenGL Programming Guide draws a cube that's scaled by a modeling transformation. The viewing transformation, gluLookAt(), positions and aims the camera towards where the cube is drawn. Here is Example 3.1 running!

Thursday, March 19, 2009

Web Exercise in lieu of Friday, March 6

When using the Open Graphics Library with Processing, the OpenGL accelerated graphics card's speed is utilized. With this, drawing more to the screen and creating larger windows is allowed. OpenGL ES is used across many platforms including consoles, phones, appliances, and vehicles. The flexible and powerful low-level interface between software and graphics acceleration provides enhanced functionality, improved image quality and optimizations to increase performance while reducing memory bandwidth usage to save power! It is an absolute pleasure to work with.

.................................................


1.) Here is my 'lstrips' modification! I basically took the code from the bezier curve assignment in Processing and changed it up just a little to work with OpenGL.



2.) For the perspect example, lighting and shading code is found in the setup function that we haven't seen yet. The perspective projection performs perspective division to shorten and shrink objects that are farther away from the viewer. An object of the same logical dimensions appears larger at the front of the viewport than if it were drawn at the back. I removed the quad-based faces and put triangles in the place of them.

Tuesday, March 3, 2009

I found some really awesome pictures in the UNCW SHARED Departmental Folder and decided to use them as central images in my project. Twisted around these central images are random interesting images from Flickr. My code allows me to search Flickr with a keyword and a count of images to grab. It then downloads them into an array that is then appended to my canvas. The first image that I created uses a picture of a sunrise at Johnny Mercer 's Pier and does a search in Flickr for clouds. The twirl and bumpdistortion filter effects are added. I really like how it turned out. The next image uses a picture of the Cultural Arts Building at night. I did a search for "art" in Flickr and applied a twirl and kaleidoscope filter (which you can see in the upper left hand corner). The next image uses a picture of sun down in Downtown Wilmington, right on the Cape Fear River. I applied a filter of kaleidoscope, bloom, and twirl and did a search for "nightlife" in Flickr. It turned out really colorful! The final image that I created uses a picture taken somewhere on campus of some pretty flowers. I did a Flickr search for "garden" and used the twirl, bloom, and starshine effect. My inspiration for the project came from the Twisted World example by Tom De Smedt. Used his code as a reference for mine!

http://nodebox.net/code/index.php/Twisted_world









Sunday, March 1, 2009

Thank goodness for Michael's post. I was about to go crazy! Why do we have to change those headers? I don't understand why the original source code we downloaded doesn't compile. Here it is:


Wednesday, February 18, 2009

Homework 4

Part one: Triangle Rotation



Part two: Rotating a triangle more than once to create a cool picture



Part three: Interesting rotating square







float[][] matrixRotation = new float[2][2];
int x1,y1,x2,y2,x3,y3;
int originX, originY;
float angle, cosine, sine, jitter;

void setup(){
size(720,480);
background(0);
//noLoop();
//noFill();
smooth();

}



void draw(){

fill(random(255),random(255),random(255));
stroke(247,26,141);


crazyBox();
pushMatrix();
popMatrix();

//
//x1 = int(random(520));
//y1 = int(random(360));
//x2 = int(random(520));
//y2 = int(random(360));
//x3 = int(random(520));
//y3 = int(random(360));

//code to rotate the triangle many times to create a cool picture
//for(float a=0; a < 2; a += .067){
//triangleRotation(x1,y1,x2,y2,x3,y3,(a*PI));
//}

//code to rotate the triangle once
//for(float f=0; f < 2; f+=1){
//triangleRotation(x1,y1,x2,y2,x3,y3,(f*PI));
//stroke(255,255,0);
//}



}

void crazyBox() {

fill(random(255),random(255),random(255));
stroke(247,26,141);
stroke(0);
if(second()%2 == 0) {
jitter = (random(-0.20, 1));
}
angle = angle + jitter;
cosine = cos(angle);
sine = sin(angle);

translate(120, 200);
rotate(cosine);
rectMode(CENTER);
rect(10,10,150,150);

}
void anotherCrazyBox() {



}

void rotateTheMatrix(float p){
matrixRotation[0][0] = cos(p);
matrixRotation[0][1] = -sin(p);
matrixRotation[1][0] = sin(p);
matrixRotation[1][1] = cos(p);
}


void triangleRotation(int x0, int y0, int x1, int y1, int x2, int y2, float p){

rotateTheMatrix(p);
originX = (x0+x1+x2)/3;
originY = (y0+y1+y2)/3;

float[][] theOrigin = {{x0-originX,y0-originY},{x1-originX,y1-originY},{x2-originX,y2-originY}};
theOrigin = multiplyMatrices(theOrigin,matrixRotation);

for(int a=0; a < theOrigin.length; a++){
for(int b=0; b < theOrigin[0].length; b++){
if(b==0){
theOrigin[a][b] += originX;
}else
theOrigin[a][b] += originY;
}
}
triangle(theOrigin[0][0],theOrigin[0][1],theOrigin[1][0],theOrigin[1][1],theOrigin[2][0],theOrigin[2][1]);
}



float[][] multiplyMatrices(float[][] matrix1, float[][] matrix2){
float[][] matrix3 = new float[matrix1.length][matrix2[0].length];
for(int i=0; i < matrix1.length; i++) {
for(int j=0; j < matrix2[0].length; j++) {
for(int k=0; k < matrix1[0].length; k++) {
matrix3[i][j] += matrix1[i][k] * matrix2[k][j];
}
}
}
return matrix3;
}

void drawTriangle(int x0, int y0, int x1, int y1, int x2, int y2){
line(x0,y0,x1,y1);
line(x1,y1,x2,y2);
line(x2,y2,x0,y0);
}