Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mengumpulkan tugas modul 4 dan 5 #70

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Project: Project6
# Makefile created by Dev-C++ 5.7.1

CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
OBJ = main.o
LINKOBJ = main.o
LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/lib" -static-libstdc++ -static-libgcc -mwindows -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32
INCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include"
CXXINCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include/c++"
BIN = MovementCamera.exe
CXXFLAGS = $(CXXINCS)
CFLAGS = $(INCS) -DGLUT_STATIC
RM = rm.exe -f

.PHONY: all all-before all-after clean clean-custom

all: all-before $(BIN) all-after

clean: clean-custom
${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
$(CPP) $(LINKOBJ) -o $(BIN) $(LIBS)

main.o: main.cpp
$(CPP) -c main.cpp -o main.o $(CXXFLAGS)
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[Project]
FileName=MovementCamera.dev
Name=Project6
Type=0
Ver=2
ObjFiles=
Includes=
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=-DGLUT_STATIC
CppCompiler=
Linker=-lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32
IsCpp=1
Icon=
ExeOutput=
ObjectOutput=
LogOutput=
LogOutputEnabled=0
OverrideOutput=0
OverrideOutputName=
HostApplication=
UseCustomMakefile=0
CustomMakefile=
CommandLine=
Folders=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000000000000000000
UnitCount=1

[VersionInfo]
Major=1
Minor=0
Release=0
Build=0
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
SyncProduct=1

[Unit1]
FileName=main.cpp
CompileCpp=1
Folder=Project6
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Editors]
Focused=0
Order=0
[Editor_0]
Open=1
Top=1
CursorCol=19
CursorRow=14
TopLine=5
LeftChar=1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#include <stdlib.h> // standard definitions
#include <stdio.h> // C I/O (for sprintf)
#include <math.h> // standard definitions
#include <GL/glut.h> // GLUT
double rotAngle = 10; // rotation angle (BEWARE: Global)
double rotAngle1 = 10; // rotation angle (BEWARE: Global)
//------------------------------------------------------------------
// init
// Sets up some default OpenGL values.
//------------------------------------------------------------------
// Variable untuk pencahayaan
const GLfloat light_ambient[] = { 0.5f, 0.5f, 0.5f, 0.0f };
const GLfloat light_diffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f };
const GLfloat light_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };
const GLfloat light_position[] = { 0.0f, 20.0f, 10.0f, 1.0f };
const GLfloat mat_ambient[] = { 0.7f, 0.7f, 0.7f, 1.0f };
const GLfloat mat_diffuse[] = { 0.8f, 0.8f, 0.8f, 1.0f };
const GLfloat mat_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };
const GLfloat high_shininess[] = { 100.0f };
void lighting(){
// Fungsi mengaktifkan pencahayaan
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glEnable(GL_LIGHT0);
glEnable(GL_NORMALIZE);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_LIGHTING);
glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialfv(GL_FRONT, GL_SHININESS, high_shininess);
}
void init(){
glClearColor(0, 0, 0, 0); // background color
glClearDepth(1.0); // background depth value
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60, 1, 1, 1000); // setup a perspective projection
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt( // set up the camera
0.0, 0.0, 5.0, // eye position
0.0, 0.0, 0.0, // lookat position
0.0, 1.0, 0.0); // up direction
}
//------------------------------------------------------------------
// display callback function
// This is called each time application needs to redraw itself.
// Most of the opengl work is done through this function.
//------------------------------------------------------------------
void display()
{
glClear(
GL_COLOR_BUFFER_BIT | // clear the frame buffer (color)
GL_DEPTH_BUFFER_BIT); // clear the depth buffer (depths)
glPushMatrix(); // save the current camera transform
glRotated(rotAngle, 0, 1, 0); // rotate by rotAngle about y-axis
glRotated(rotAngle1, 1, 0, 0); // rotate by rotAngle about y-axis
glEnable(GL_COLOR_MATERIAL); // specify object color
glColor3f(0.4, 1.3, 0.1); // redish
glutSolidTeapot(1); // draw the teapot
glPopMatrix(); // restore the modelview matrix
glFlush(); // force OpenGL to render now
glutSwapBuffers(); // make the image visible
}
//------------------------------------------------------------------
// keyboard callback function
// This is called whenever a keyboard key is hit.
//------------------------------------------------------------------
void keyboard(unsigned char k, int x, int y)
{
switch (k)
{
case 'a':
rotAngle += 5; // increase rotation by 5 degrees
break;
case 'y':
rotAngle1 += 5; // increase rotation by 5 degrees
break;
case 'b':
rotAngle1 -= 5; // increase rotation by 5 degrees
break;
case 'l':
rotAngle -= 5; // decrease rotation by 5 degrees
break;
case 'q':
exit(0); // exit
}
glutPostRedisplay(); // redraw the image now
}
//-----------------------------------------------------------------
// main program
// Where everything begins.
//------------------------------------------------------------------
int main()
{
glutInitDisplayMode( // initialize GLUT
GLUT_DOUBLE | // use double buffering
GLUT_DEPTH | // request memory for z-buffer
GLUT_RGB ); // set RGB color mode
glutInitWindowPosition(100,100);
glutInitWindowSize(720,720);
glutCreateWindow("GLUT Example"); // create the window
glutDisplayFunc(display); // call display() to redraw window
glutKeyboardFunc(keyboard); // call keyboard() when key is hit
lighting();
init(); // our own initializations
glutMainLoop(); // let GLUT take care of everything

}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[Project]
FileName=ImageLoader.dev
Name=Project9
Type=0
Ver=2
ObjFiles=
Includes=
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=-DGLUT_STATIC
CppCompiler=
Linker=-lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32
IsCpp=1
Icon=
ExeOutput=
ObjectOutput=
LogOutput=
LogOutputEnabled=0
OverrideOutput=0
OverrideOutputName=
HostApplication=
UseCustomMakefile=0
CustomMakefile=
CommandLine=
Folders=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000000000000000000
UnitCount=3

[VersionInfo]
Major=1
Minor=0
Release=0
Build=0
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
SyncProduct=1

[Unit1]
FileName=main.cpp
CompileCpp=1
Folder=Project9
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

[Unit3]
FileName=imageoader.cpp
CompileCpp=1
Folder=Project9
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

[Unit2]
FileName=imageoader.h
CompileCpp=1
Folder=Project9
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[Editor_1]
CursorCol=1
CursorRow=3
TopLine=1
LeftChar=1
Open=1
Top=0
[Editors]
Focused=0
Order=0,1,2,-1
[Editor_0]
Open=1
Top=1
CursorCol=29
CursorRow=61
TopLine=40
LeftChar=1
[Editor_2]
Open=1
Top=0
CursorCol=33
CursorRow=127
TopLine=114
LeftChar=1
Loading