Skip to content

Commit

Permalink
Without round parts
Browse files Browse the repository at this point in the history
  • Loading branch information
sstoyanova7 committed Nov 20, 2015
1 parent 2f19162 commit 7b60838
Show file tree
Hide file tree
Showing 9 changed files with 298 additions and 60 deletions.
17 changes: 0 additions & 17 deletions .gitattributes

This file was deleted.

43 changes: 0 additions & 43 deletions .gitignore

This file was deleted.

Binary file added bin/Debug/kanji.exe
Binary file not shown.
52 changes: 52 additions & 0 deletions kanji.cbp
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="kanji" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/kanji" prefix_auto="1" extension_auto="1" />
<Option working_dir="D:/Programs/glfw-2.7.bin.WIN32/bin" />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
<Target title="Release">
<Option output="bin/Release/kanji" prefix_auto="1" extension_auto="1" />
<Option working_dir="D:/Programs/glfw-2.7.bin.WIN32/bin" />
<Option object_output="obj/Release/" />
<Option type="0" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
<Add directory="D:/Programs/glfw-2.7.bin.WIN32/include" />
</Compiler>
<Linker>
<Add library="glfw" />
<Add library="opengl32" />
<Add library="glu32" />
<Add library="gdi32" />
<Add directory="D:/Programs/glfw-2.7.bin.WIN32/lib" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
</Extensions>
</Project>
</CodeBlocks_project_file>
1 change: 1 addition & 0 deletions kanji.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

17 changes: 17 additions & 0 deletions kanji.depend
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# depslib dependency file v1.0
1447670124 source:d:\uni\okg\uprajneniq\kanji\main.cpp
<GL/glfw.h>

1447674426 d:\programs\glfw-2.7.bin.win32\include\gl\glfw.h
<OpenGL/gl.h>
<OpenGL/glu.h>
<GL/gl.h>
<GL/glu.h>

1447929786 source:d:\okg\okg\uprajneniq\kanji\main.cpp
<GL/glfw.h>

1447946549 source:d:\okg\uprajneniq\kanji\main.cpp
<GL/glfw.h>
<iostream>

12 changes: 12 additions & 0 deletions kanji.layout
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug" />
<File name="main.cpp" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2221" topLine="54" />
</Cursor>
<Folding>
<Collapse line="70" />
</Folding>
</File>
</CodeBlocks_layout_file>
216 changes: 216 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
#include <GL/glfw.h>

#include <iostream>
using namespace std;


const float originalBrush = 0.4,
brush = originalBrush/2,
depth = 5*originalBrush;


void drawHorizontal(float x, float y, float z, float length)
{
length *= brush;
//glColor3ub(0, 255, 0); //top
glBegin(GL_POLYGON);
glNormal3f(0.0, +1.0, 0.0);
glVertex3f(x-length, y+depth, z+brush);
glVertex3f(x+length, y+depth, z+brush);
glVertex3f(x+length, y+depth, z-brush);
glVertex3f(x-length, y+depth, z-brush);
glEnd();

//glColor3ub(0, 255, 0); //bottom
glBegin(GL_POLYGON);
glNormal3f(0.0, -1.0, 0.0);
glVertex3f(x-length, y-depth, z+brush);
glVertex3f(x+length, y-depth, z+brush);
glVertex3f(x+length, y-depth, z-brush);
glVertex3f(x-length, y-depth, z-brush);
glEnd();

//glColor3ub(0, 0, 255); //left
glBegin(GL_POLYGON);
glNormal3f(-1.0, 0.0, 0.0);
glVertex3f(x-length, y+depth, z+brush);
glVertex3f(x-length, y-depth, z+brush);
glVertex3f(x-length, y-depth, z-brush);
glVertex3f(x-length, y+depth, z-brush);
glEnd();

//glColor3ub(255, 255, 0); //right
glBegin(GL_POLYGON);
glNormal3f(+1.0, 0.0, 0.0);
glVertex3f(x+length, y+depth, z+brush);
glVertex3f(x+length, y-depth, z+brush);
glVertex3f(x+length, y-depth, z-brush);
glVertex3f(x+length, y+depth, z-brush);
glEnd();

//glColor3ub(255, 0, 255); //front
glBegin(GL_POLYGON);
glNormal3f(0.0, 0.0, +1.0);
glVertex3f(x-length, y+depth, z+brush);
glVertex3f(x+length, y+depth, z+brush);
glVertex3f(x+length, y-depth, z+brush);
glVertex3f(x-length, y-depth, z+brush);
glEnd();

//glColor3ub(0, 255, 255); //back
glBegin(GL_POLYGON);
glNormal3f(0.0, 0.0, -1.0);
glVertex3f(x-length, y+depth, z-brush);
glVertex3f(x+length, y+depth, z-brush);
glVertex3f(x+length, y-depth, z-brush);
glVertex3f(x-length, y-depth, z-brush);
glEnd();
}

void drawVertical(float x, float y, float z, float length)
{
length *= brush;

//glColor3ub(255, 0, 0); //top
glBegin(GL_POLYGON);
glNormal3f(0.0, +1.0, 0.0);
glVertex3f(x-brush, y+depth, z+length);
glVertex3f(x+brush, y+depth, z+length);
glVertex3f(x+brush, y+depth, z-length);
glVertex3f(x-brush, y+depth, z-length);
glEnd();

//glColor3ub(0, 255, 0); //bottom
glBegin(GL_POLYGON);
glNormal3f(0.0, -1.0, 0.0);
glVertex3f(x-brush, y-depth, z+length);
glVertex3f(x+brush, y-depth, z+length);
glVertex3f(x+brush, y-depth, z-length);
glVertex3f(x-brush, y-depth, z-length);
glEnd();

//glColor3ub(0, 0, 255); //left
glBegin(GL_POLYGON);
glNormal3f(-1.0, 0.0, 0.0);
glVertex3f(x-brush, y+depth, z+length);
glVertex3f(x-brush, y-depth, z+length);
glVertex3f(x-brush, y-depth, z-length);
glVertex3f(x-brush, y+depth, z-length);
glEnd();

//glColor3ub(255, 255, 0); //right
glBegin(GL_POLYGON);
glNormal3f(+1.0, 0.0, 0.0);
glVertex3f(x+brush, y+depth, z+length);
glVertex3f(x+brush, y-depth, z+length);
glVertex3f(x+brush, y-depth, z-length);
glVertex3f(x+brush, y+depth, z-length);
glEnd();

//glColor3ub(255, 0, 255); //front
glBegin(GL_POLYGON);
glNormal3f(0.0, 0.0, +1.0);
glVertex3f(x-brush, y+depth, z+length);
glVertex3f(x+brush, y+depth, z+length);
glVertex3f(x+brush, y-depth, z+length);
glVertex3f(x-brush, y-depth, z+length);
glEnd();

//glColor3ub(0, 255, 255); //back
glBegin(GL_POLYGON);
glNormal3f(0.0, 0.0, -1.0);
glVertex3f(x-brush, y+depth, z-length);
glVertex3f(x+brush, y+depth, z-length);
glVertex3f(x+brush, y-depth, z-length);
glVertex3f(x-brush, y-depth, z-length);
glEnd();
}

void drawLeftPart(float x, float y, float z)
{
drawVertical( x - 2.3*originalBrush + brush, y, z, 7.2);
drawHorizontal(x, y, z + 3.6*originalBrush - brush, 2.6);
drawVertical( x + 2.3*originalBrush - brush, y, z+0.6*originalBrush, 6.0);
drawHorizontal(x, y, z + 1.2*originalBrush - brush, 2.6);
drawHorizontal(x, y, z - 2.4*originalBrush + brush, 2.6);
}

void drawRightPart(float x, float y, float z)
{
drawVertical( x - 2.85*originalBrush + brush, y, z + 0.35*originalBrush, 5.6);
drawHorizontal(x, y, z + 3.15*originalBrush - brush, 3.7);
drawVertical( x + 2.85*originalBrush - brush, y, z, 6.3);
drawHorizontal(x, y, z + 0.85*originalBrush - brush, 3.7);
drawHorizontal(x, y, z - 2.45*originalBrush + brush, 3.7);
}

void drawBottomPart(float x, float y, float z)
{
drawVertical( x - 4*originalBrush - brush, y, z, 2);
drawHorizontal(x, y, z + 1*originalBrush + brush, 10);
drawVertical( x + 4*originalBrush + brush, y, z, 2);
drawVertical( x - 1*originalBrush - brush, y, z, 2);
drawVertical( x + 1*originalBrush + brush, y, z, 2);
drawHorizontal(x, y, z - 1*originalBrush - brush, 13);
}


void init()
{
int width, height;

glfwInit();
if( !glfwOpenWindow( 640, 480, 0, 0, 0, 0, 8, 0, GLFW_WINDOW ) ) return;

glfwGetWindowSize( &width, &height );
height = height > 0 ? height : 1;

glViewport( 0, 0, width, height );
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );

glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective( 65.0f, (GLfloat)width/(GLfloat)height, 1.0f, 100.0f );

glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
gluLookAt(0.0f, -10.0f, 0.0f,
0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f );
}

int main()
{
bool running = 1;

/* glfwInit();
if(!glfwOpenWindow(512, 512, 0, 0, 0, 0, 8, 0, GLFW_WINDOW))
{
glfwTerminate();
return 0;
}
*/
init();
glfwSetWindowTitle("Kanji");

glEnable( GL_DEPTH_TEST );
glEnable( GL_LIGHTING );
glEnable( GL_COLOR_MATERIAL );
glEnable( GL_LIGHT0 );

while(running)
{
glClear(GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT);
glRotatef( 0.005, 0.4, -0.2, 0.7);
glRotatef( 0.04, 0.6, -0.2, 0.7);

drawLeftPart(-3.4*originalBrush, 0 , 1.5*originalBrush);
drawRightPart(3.5*originalBrush,0,2.5*originalBrush);
drawBottomPart(0,0,-5*originalBrush);
glfwSwapBuffers();
running = !glfwGetKey(GLFW_KEY_ESC) && glfwGetWindowParam(GLFW_OPENED);
}
glfwTerminate();
return 0;
}
Binary file added obj/Debug/main.o
Binary file not shown.

0 comments on commit 7b60838

Please sign in to comment.