41 Commits
Author SHA1 Message Date
kennyboy55 8c9b39983b More heightmaps 2016-05-24 09:58:28 +02:00
kennyboy55 28d5c06c7f Increase scale to massive 2016-05-23 20:50:30 +02:00
kennyboy55 24a9ccd7fa Fixed texture rendering 2016-05-23 15:34:11 +02:00
kennyboy55 8bd092c9e9 Added heightmap loading 2016-05-23 14:51:04 +02:00
kennyboy55 66cc034b4a Added missing project files 2016-05-23 10:38:31 +02:00
kennyboy55 48847f8598 Add OpenGL4 to existing project. Added stbi 2016-05-23 10:36:26 +02:00
kennyboy55 1c8ad334d5 Added OpenGL4 2016-05-23 10:09:10 +02:00
kennyboy55 881f90d816 Added object files 2016-05-09 12:29:30 +02:00
kennyboy55 7ef4292825 Added Object and Texture loading 2016-05-09 12:20:36 +02:00
kennyboy55 a08328981c Added height, water, flowers and music 2016-05-08 21:48:12 +02:00
Bluepr1nt 51f87c205e Nog wat geprutst aan vormgeving boom 2016-05-08 18:55:03 +02:00
kennyboy55 44efe9ff4a Added cool tree stuff 2016-04-26 12:12:36 +02:00
Bluepr1nt 1768f9370c Random bOOOOOOMEN 2016-04-26 11:48:57 +02:00
Bluepr1nt 01c36b8412 Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	OpenGL2/Main.cpp
2016-04-26 11:23:49 +02:00
Bluepr1nt b931bbd9a6 world tree fix 2016-04-26 11:21:55 +02:00
kennyboy55 b6536f4499 Added generateTree protoype 2016-04-26 11:21:04 +02:00
kennyboy55 6ea03a050b Fixed world generation, added speed control 2016-04-26 10:57:51 +02:00
kennyboy55 a6a38717c5 Tried fixing heigth generating 2016-04-26 10:32:16 +02:00
kennyboy55 3112ce0960 Attempt at hight map generation 2016-04-25 23:21:25 +02:00
kennyboy55 0df47eac6b World rendering from array 2016-04-25 17:35:49 +02:00
Bluepr1nt 34a17d143c Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	OpenGL2/Main.cpp
2016-04-25 13:35:04 +02:00
Bluepr1nt c9996934b5 Merge remote-tracking branch 'refs/remotes/origin/boomtest' into dev 2016-04-25 13:33:50 +02:00
Bluepr1nt fa9482d092 boom merge 2016-04-25 13:32:39 +02:00
Bluepr1nt e03c33d622 boom 2016-04-25 13:31:41 +02:00
kennyboy55 9b143eca97 Alpha + textures 2016-04-25 13:31:25 +02:00
kennyboy55 46e5f4ec57 Show single texture 2016-04-25 12:21:57 +02:00
kennyboy55 68da0178ec load textures 2016-04-25 11:27:21 +02:00
kennyboy55 fda7845f5f Added OpenGL2 2016-04-25 11:03:39 +02:00
kennyboy55 3acb2b9370 Added camera zoom 2016-04-21 15:23:32 +02:00
Bluepr1nt ce99f3eb08 verplaatsen kubus 2016-04-21 15:05:24 +02:00
kennyboy55 27d337ab5c Added FPS counter 2016-04-21 15:01:11 +02:00
kennyboy55 c6e027db17 Added a lot of cool stuff 2016-04-21 14:44:43 +02:00
kennyboy55 a04d26f2c5 Added 3 new cubes and color changing 2016-04-21 13:19:50 +02:00
Bluepr1nt 302b795e89 Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	OpenGL1/Main.cpp
2016-04-21 12:29:16 +02:00
Bluepr1nt 48abe06965 nog een cube 2016-04-21 12:27:46 +02:00
kennyboy55 42b148bb3b Added the best cube (obvious) 2016-04-21 12:27:01 +02:00
kennyboy55 fef2e0ed74 Added flag thingy 2016-04-21 11:46:33 +02:00
kennyboy55 4f4200effe Working freeglut window 2016-04-21 11:25:17 +02:00
Bluepr1nt ba3fd3e7b8 window 2016-04-21 10:56:32 +02:00
kennyboy55 973cb61659 Freeglut working 2016-04-21 10:49:59 +02:00
kennyboy55 833cd13d9c Added freeglut files 2016-04-21 10:43:29 +02:00
110 changed files with 45751 additions and 1 deletions
+1 -1
View File
@@ -48,7 +48,6 @@ artifacts/
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
@@ -234,3 +233,4 @@ _Pvt_Extensions
# FAKE - F# Make
.fake/
*.zip
BIN
View File
Binary file not shown.
+34
View File
@@ -7,6 +7,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenGL1", "OpenGL1\OpenGL1.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rasterizer", "Rasterizer\Rasterizer.csproj", "{ED0523E4-4D43-4F82-AA49-E878B53A0631}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenGL2", "OpenGL2\OpenGL2.vcxproj", "{A48AE72D-7CD7-4525-8917-81A5B2F50E2B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenGL3", "OpenGL3\OpenGL.vcxproj", "{7FE0B211-D231-442F-BEDA-60613B8B1F9D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenGL4", "OpenGL4\OpenGL4.vcxproj", "{ADE3B882-A837-4B44-8B2F-645FE22BBB39}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -39,6 +45,34 @@ Global
{ED0523E4-4D43-4F82-AA49-E878B53A0631}.Release|x64.Build.0 = Release|Any CPU
{ED0523E4-4D43-4F82-AA49-E878B53A0631}.Release|x86.ActiveCfg = Release|Any CPU
{ED0523E4-4D43-4F82-AA49-E878B53A0631}.Release|x86.Build.0 = Release|Any CPU
{A48AE72D-7CD7-4525-8917-81A5B2F50E2B}.Debug|Any CPU.ActiveCfg = Debug|Win32
{A48AE72D-7CD7-4525-8917-81A5B2F50E2B}.Debug|x64.ActiveCfg = Debug|x64
{A48AE72D-7CD7-4525-8917-81A5B2F50E2B}.Debug|x64.Build.0 = Debug|x64
{A48AE72D-7CD7-4525-8917-81A5B2F50E2B}.Debug|x86.ActiveCfg = Debug|Win32
{A48AE72D-7CD7-4525-8917-81A5B2F50E2B}.Debug|x86.Build.0 = Debug|Win32
{A48AE72D-7CD7-4525-8917-81A5B2F50E2B}.Release|Any CPU.ActiveCfg = Release|Win32
{A48AE72D-7CD7-4525-8917-81A5B2F50E2B}.Release|x64.ActiveCfg = Release|x64
{A48AE72D-7CD7-4525-8917-81A5B2F50E2B}.Release|x64.Build.0 = Release|x64
{A48AE72D-7CD7-4525-8917-81A5B2F50E2B}.Release|x86.ActiveCfg = Release|Win32
{A48AE72D-7CD7-4525-8917-81A5B2F50E2B}.Release|x86.Build.0 = Release|Win32
{7FE0B211-D231-442F-BEDA-60613B8B1F9D}.Debug|Any CPU.ActiveCfg = Debug|Win32
{7FE0B211-D231-442F-BEDA-60613B8B1F9D}.Debug|x64.ActiveCfg = Debug|Win32
{7FE0B211-D231-442F-BEDA-60613B8B1F9D}.Debug|x86.ActiveCfg = Debug|Win32
{7FE0B211-D231-442F-BEDA-60613B8B1F9D}.Debug|x86.Build.0 = Debug|Win32
{7FE0B211-D231-442F-BEDA-60613B8B1F9D}.Release|Any CPU.ActiveCfg = Release|Win32
{7FE0B211-D231-442F-BEDA-60613B8B1F9D}.Release|x64.ActiveCfg = Release|Win32
{7FE0B211-D231-442F-BEDA-60613B8B1F9D}.Release|x86.ActiveCfg = Release|Win32
{7FE0B211-D231-442F-BEDA-60613B8B1F9D}.Release|x86.Build.0 = Release|Win32
{ADE3B882-A837-4B44-8B2F-645FE22BBB39}.Debug|Any CPU.ActiveCfg = Debug|Win32
{ADE3B882-A837-4B44-8B2F-645FE22BBB39}.Debug|x64.ActiveCfg = Debug|x64
{ADE3B882-A837-4B44-8B2F-645FE22BBB39}.Debug|x64.Build.0 = Debug|x64
{ADE3B882-A837-4B44-8B2F-645FE22BBB39}.Debug|x86.ActiveCfg = Debug|Win32
{ADE3B882-A837-4B44-8B2F-645FE22BBB39}.Debug|x86.Build.0 = Debug|Win32
{ADE3B882-A837-4B44-8B2F-645FE22BBB39}.Release|Any CPU.ActiveCfg = Release|Win32
{ADE3B882-A837-4B44-8B2F-645FE22BBB39}.Release|x64.ActiveCfg = Release|x64
{ADE3B882-A837-4B44-8B2F-645FE22BBB39}.Release|x64.Build.0 = Release|x64
{ADE3B882-A837-4B44-8B2F-645FE22BBB39}.Release|x86.ActiveCfg = Release|Win32
{ADE3B882-A837-4B44-8B2F-645FE22BBB39}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+403
View File
@@ -0,0 +1,403 @@
#include <iostream>
#include <string>
#include <GL/freeglut.h>
/* Prototypes */
void obj_flag(void);
void obj_cube(float clr);
void obj_cube2(void);
void set_view(int);
void draw_string(std::string, int, int);
void calculateFPS(void);
/* Variables */
float rotation = 0;
float keyrotationx = 0;
float keyrotationy = 0;
float changelocation = 0;
float camerazoom = 5;
float color = 0;
int width = 800;
int height = 600;
bool wireframe = false;
bool persp = true;
bool rotatec = true;
int frameCount = 0;
int currentTime = 0;
int previousTime = 0;
int fps = 0;
float cameraRot = 0;
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(1.0, 0.7, 0.0, 1.0);
set_view(0);
if(rotatec)
cameraRot += 0.001f;
//Cube 2
glTranslatef(3.0f, 0, 0);
glRotatef(rotation / 2, 0, 0, 1);
obj_cube(1.0f);
glRotatef(rotation / 2, 0, 0, -1);
glTranslatef(-3.0, 0, 0);
//Cube 3
glTranslatef(-3.0f, 0, 0);
glRotatef(rotation / 2, 1, 0, 0);
obj_cube(1.0f);
glRotatef(rotation / 2, -1, 0, 0);
glTranslatef(3.0f, 0, 0);
//Cube 4
glTranslatef(0, 0, 3.0f);
glRotatef(rotation / 2, 1, 1, 0);
obj_cube(color);
glRotatef(rotation / 2, -1, -1, 0);
glTranslatef(0, 0, -3.0f);
//Cube 1
float tempx = keyrotationx;
float tempy = keyrotationy;
glTranslatef(changelocation, 0, 0);
glRotatef(tempy, 1, 0, 0);
glRotatef(tempx, 0, 1, 0);
obj_cube(1.0f);
glTranslatef(0, 0, changelocation);
glRotatef(tempy, -1, 0, 0);
glRotatef(tempx, 0, -1, 0);
//overlay
set_view(1);
std::string str0 = "FPS: " + std::to_string(fps);
std::string str1 = "Wireframe: " + std::string(wireframe ? "On" : "Off") + " (L)";
std::string str2 = "Projectie: " + std::string(persp ? "Perspective" : "Ortho") + " (SPC)";
std::string str3 = "Rotation: " + std::string(rotatec ? "On" : "Off") + " (R)";
std::string str4 = "Zoom: " + std::to_string(camerazoom) + " (+/-)";
draw_string(str0, 10, 30);
draw_string(str1, 10, 60);
draw_string(str2, 10, 90);
draw_string(str3, 10, 120);
draw_string(str4, 10, 150);
frameCount++;
glutSwapBuffers();
}
void draw_string(std::string s, int x, int y)
{
glColor3f(0.0f, 0.0f, 0.0f);
glRasterPos3f(x, y, 0);
glutBitmapString(GLUT_BITMAP_HELVETICA_18, (const unsigned char*)s.c_str());
}
void set_view(int view)
{
if (view == 0)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (persp)
gluPerspective(90, (float)width / height, 0.5f, 20.0f);
else
glOrtho(-8, 8, -8, 8, 0.5f, 20.0f);
if (wireframe)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
else
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(cos(cameraRot) * camerazoom, camerazoom, sin(cameraRot) * camerazoom,
0, 0, 0,
0, 1, 0);
}
else
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, width, height, 0, -0.5f, 20.0f);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
}
void idle()
{
rotation += 0.1f;
glutPostRedisplay();
calculateFPS();
}
void keyboard(unsigned char key, int x, int y)
{
if (key == 27)
exit(0);
else if (key == 32)
persp = !persp;
else if (key == 114)
rotatec = !rotatec;
else if (key == 108)
wireframe = !wireframe;
else if (key == 119)
keyrotationy += 6.0f;
else if (key == 115)
keyrotationy -= 6.0f;
else if (key == 97)
keyrotationx -= 6.0f;
else if (key == 100)
keyrotationx += 6.0f;
else if (key == 113)
changelocation += 2.0f;
else if (key == 101)
changelocation -= 2.0f;
else if (key == 43)
camerazoom -= (camerazoom <= 1.7f ? 0 : 0.2f);
else if (key == 45)
camerazoom += (camerazoom >= 9.9f ? 0 : 0.2f);
}
void specialkeyboard(int key, int x, int y)
{
switch (key)
{
case GLUT_KEY_UP:
keyrotationy += 2.0f;
break;
case GLUT_KEY_DOWN:
keyrotationy -= 2.0f;
break;
case GLUT_KEY_LEFT:
keyrotationx -= 2.0f;
break;
case GLUT_KEY_RIGHT:
keyrotationx += 2.0f;
break;
}
}
void mousemoved(int x, int y)
{
color = (x / 100);
}
void resize(int w, int h)
{
width = w;
height = w;
}
void calculateFPS()
{
currentTime = glutGet(GLUT_ELAPSED_TIME);
int timeInterval = currentTime - previousTime;
if (timeInterval > 1000)
{
fps = frameCount / (timeInterval / 1000.0f);
previousTime = currentTime;
frameCount = 0;
}
}
int main(int argc, char *argv[])
{
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(width, height);
glutInit(&argc, argv);
glutCreateWindow("Cubes");
glEnable(GL_DEPTH_TEST);
glutDisplayFunc(display);
glutIdleFunc(idle);
glutKeyboardFunc(keyboard);
glutSpecialFunc(specialkeyboard);
glutPassiveMotionFunc(mousemoved);
glutReshapeFunc(resize);
glutMainLoop();
return 0;
}
void obj_cube2()
{
glBegin(GL_TRIANGLES);
glColor3f(1.0f, 0.7f, 1.0f);
glVertex3f(0, 0, 0);
glColor3f(0.5, 1, 0.1);
glVertex3f(0, 1, 0);
glVertex3f(1, 1, 0);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(0.1, 1, 0.1);
glVertex3f(0, 0, 0);
glVertex3f(1, 1, 0);
glColor3f(0.1, 1, 0.1);
glVertex3f(1, 0, 0);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(0.1, 0.5, 0.1);
glVertex3f(1, 1, 0);
glVertex3f(1, 0, 0);
glVertex3f(1, 1, 1);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(0.1, 0.5, 0.5);
glVertex3f(1, 0, 1);
glVertex3f(1, 0, 0);
glVertex3f(1, 1, 1);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(0.1, 0.1, 0.1);
glVertex3f(0, 0, 0);
glVertex3f(1, 0, 0);
glVertex3f(1, 0, 1);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(0.5, 0.1, 0.1);
glVertex3f(0, 0, 0);
glVertex3f(0, 0, 1);
glVertex3f(1, 0, 1);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(0.5, 0.1, 0.5);
glVertex3f(0, 0, 0);
glVertex3f(0, 1, 0);
glVertex3f(0, 1, 1);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(0.5, 0.5, 0.5);
glVertex3f(0, 0, 0);
glVertex3f(0, 0, 1);
glVertex3f(0, 1, 1);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(0.5, 1, 0.5);
glVertex3f(1, 1, 1);
glVertex3f(0, 0, 1);
glVertex3f(0, 1, 1);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(1, 1, 0.5);
glVertex3f(1, 1, 1);
glVertex3f(0, 1, 0);
glVertex3f(0, 1, 1);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(1, 1, 1);
glVertex3f(1, 1, 1);
glVertex3f(1, 1, 0);
glVertex3f(0, 1, 0);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(1, 0.3, 0.8);
glVertex3f(1, 1, 1);
glVertex3f(0, 0, 1);
glVertex3f(1, 0, 1);
glEnd();
}
void obj_cube(float clr)
{
//Side 1 : Green
glBegin(GL_QUADS);
glColor3f(0.0f, 1.0f / clr, 0.0f);
glVertex3f(-1, -1, -1);
glVertex3f(-1, 1, -1);
glColor3f(0.5f, 1.0f / clr, 0.5f);
glVertex3f(1, 1, -1);
glVertex3f(1, -1, -1);
glEnd();
//Side 2 : Red
glBegin(GL_QUADS);
glColor3f(1.0f / clr, 0.0f, 0.0f);
glVertex3f(-1, -1, 1);
glVertex3f(-1, 1, 1);
glColor3f(1.0f / clr, 0.5f, 0.5f);
glVertex3f(1, 1, 1);
glVertex3f(1, -1, 1);
glEnd();
//Side 3 : Blue
glBegin(GL_QUADS);
glColor3f(0.0f, 0.0f, 1.0f / clr);
glVertex3f(-1, -1, -1);
glVertex3f(-1, -1, 1);
glColor3f(0.5f, 0.5f, 1.0f / clr);
glVertex3f(-1, 1, 1);
glVertex3f(-1, 1, -1);
glEnd();
//Side 4 : Yellow
glBegin(GL_QUADS);
glColor3f(1.0f / clr, 1.0f / clr, 0.0f);
glVertex3f(1, -1, -1);
glVertex3f(1, -1, 1);
glColor3f(1.0f / clr, 1.0f / clr, 0.5f);
glVertex3f(1, 1, 1);
glVertex3f(1, 1, -1);
glEnd();
//Side 5 : Purple
glBegin(GL_QUADS);
glColor3f(1.0f / clr, 0.0f, 1.0f / clr);
glVertex3f(-1, -1, -1);
glVertex3f(-1, -1, 1);
glColor3f(1.0f / clr, 0.5f, 1.0f / clr);
glVertex3f(1, -1, 1);
glVertex3f(1, -1, -1);
glEnd();
//Side 6 : Light blue
glBegin(GL_QUADS);
glColor3f(0.0f, 1.0f / clr, 1.0f / clr);
glVertex3f(-1, 1, -1);
glVertex3f(-1, 1, 1);
glColor3f(0.5f, 1.0f / clr, 1.0f / clr);
glVertex3f(1, 1, 1);
glVertex3f(1, 1, -1);
glEnd();
}
void obj_flag()
{
glBegin(GL_TRIANGLES);
glColor3f(1.0f, 0.7f, 1.0f);
glVertex3f(0, 0, 0);
glVertex3f(0, 1, 0);
glVertex3f(1, 1, 0);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(0.1, 1, 0.1);
glVertex3f(0, 0, 0);
glVertex3f(1, 1, 0);
glVertex3f(1, 0, 0);
glEnd();
}
+13
View File
@@ -88,10 +88,13 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>freeglut/include</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>freeglut/lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -101,10 +104,13 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>freeglut/include</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>freeglut/lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -116,12 +122,15 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>freeglut/include</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>freeglut/lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -133,15 +142,19 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>freeglut/include</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>freeglut/lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
+5
View File
@@ -14,4 +14,9 @@
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
Binary file not shown.
+27
View File
@@ -0,0 +1,27 @@
Freeglut Copyright
------------------
Freeglut code without an explicit copyright is covered by the following
copyright:
Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Pawel W. Olszta shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from Pawel W. Olszta.
+106
View File
@@ -0,0 +1,106 @@
freeglut 3.0.0-1.mp for MSVC
This package contains freeglut import libraries, headers, and Windows DLLs.
These allow 32 and 64 bit GLUT applications to be compiled on Windows using
Microsoft Visual C++.
For more information on freeglut, visit http://freeglut.sourceforge.net/.
Installation
Create a folder on your PC which is readable by all users, for example
“C:\Program Files\Common Files\MSVC\freeglut\” on a typical Windows system. Copy
the “lib\” and “include\” folders from this zip archive to that location.
The appropriate freeglut DLL can either be placed in the same folder as your
application, or can be installed in a system-wide folder which appears in your
%PATH% environment variable. Be careful not to mix the 32 bit DLL up with the 64
bit DLL, as they are not interchangeable.
Compiling 32 bit Applications
To create a 32 bit freeglut application, create a new Win32 C++ project in MSVC.
From the “Win32 Application Wizard”, choose a “Windows application”, check the
“Empty project” box, and submit.
Youll now need to configure the compiler and linker settings. Open up the
project properties, and select “All Configurations” (this is necessary to ensure
our changes are applied for both debug and release builds). Open up the
“general” section under “C/C++”, and configure the “include\” folder you created
above as an “Additional Include Directory”. If you have more than one GLUT
package which contains a “glut.h” file, its important to ensure that the
freeglut include folder appears above all other GLUT include folders.
Now open up the “general” section under “Linker”, and configure the “lib\”
folder you created above as an “Additional Library Directory”. A freeglut
application depends on the import libraries “freeglut.lib” and “opengl32.lib”,
which can be configured under the “Input” section. However, it shouldnt be
necessary to explicitly state these dependencies, since the freeglut headers
handle this for you. Now open the “Advanced” section, and enter “mainCRTStartup”
as the “Entry Point” for your application. This is necessary because GLUT
applications use “main” as the application entry point, not “WinMain”—without it
youll get an undefined reference when you try to link your application.
Thats all of your project properties configured, so you can now add source
files to your project and build the application. If you want your application to
be compatible with GLUT, you should “#include <GL/glut.h>”. If you want to use
freeglut specific extensions, you should “#include <GL/freeglut.h>” instead.
Dont forget to either include the freeglut DLL when distributing applications,
or provide your users with some method of obtaining it if they dont already
have it!
Compiling 64 bit Applications
Building 64 bit applications is almost identical to building 32 bit applications.
When you use the configuration manager to add the x64 platform, its easiest to
copy the settings from the Win32 platform. If you do so, its then only necessary
to change the “Additional Library Directories” configuration so that it
references the directory containing the 64 bit import library rather
than the 32 bit one.
Problems?
If you have problems using this package (compiler / linker errors etc.), please
check that you have followed all of the steps in this readme file correctly.
Almost all of the problems which are reported with these packages are due to
missing a step or not doing it correctly, for example trying to build a 32 bit
app against the 64 bit import library. If you have followed all of the steps
correctly but your application still fails to build, try building a very simple
but functional program (the example at
http://www.transmissionzero.co.uk/computing/using-glut-with-mingw/ works fine
with MSVC). A lot of people try to build very complex applications after
installing these packages, and often the error is with the application code or
other library dependencies rather than freeglut.
If you still cant get it working after trying to compile a simple application,
then please get in touch via http://www.transmissionzero.co.uk/contact/,
providing as much detail as you can. Please dont complain to the freeglut guys
unless youre sure its a freeglut bug, and have reproduced the issue after
compiling freeglut from the latest SVN version—if thats still the case, Im
sure they would appreciate a bug report or a patch.
Changelog
20150722: Release 3.0.0-2.mp
• Modified the freeglut_std.h file so that it doesnt try to link against the
freeglutd.lib import library.
20150315: Release 3.0.0-1.mp
• First 3.0.0 MSVC release. Ive built the package using Visual Studio 2013,
and the only change Ive made is to the DLL version resource—Ive changed
the description so that my MinGW and MSVC builds are distinguishable from
each other (and other builds) using Windows Explorer.
Transmission Zero
20150722
http://www.transmissionzero.co.uk/
+22
View File
@@ -0,0 +1,22 @@
#ifndef __FREEGLUT_H__
#define __FREEGLUT_H__
/*
* freeglut.h
*
* The freeglut library include file
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "freeglut_std.h"
#include "freeglut_ext.h"
/*** END OF FILE ***/
#endif /* __FREEGLUT_H__ */
+271
View File
@@ -0,0 +1,271 @@
#ifndef __FREEGLUT_EXT_H__
#define __FREEGLUT_EXT_H__
/*
* freeglut_ext.h
*
* The non-GLUT-compatible extensions to the freeglut library include file
*
* Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
* Written by Pawel W. Olszta, <olszta@sourceforge.net>
* Creation date: Thu Dec 2 1999
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Additional GLUT Key definitions for the Special key function
*/
#define GLUT_KEY_NUM_LOCK 0x006D
#define GLUT_KEY_BEGIN 0x006E
#define GLUT_KEY_DELETE 0x006F
#define GLUT_KEY_SHIFT_L 0x0070
#define GLUT_KEY_SHIFT_R 0x0071
#define GLUT_KEY_CTRL_L 0x0072
#define GLUT_KEY_CTRL_R 0x0073
#define GLUT_KEY_ALT_L 0x0074
#define GLUT_KEY_ALT_R 0x0075
/*
* GLUT API Extension macro definitions -- behaviour when the user clicks on an "x" to close a window
*/
#define GLUT_ACTION_EXIT 0
#define GLUT_ACTION_GLUTMAINLOOP_RETURNS 1
#define GLUT_ACTION_CONTINUE_EXECUTION 2
/*
* Create a new rendering context when the user opens a new window?
*/
#define GLUT_CREATE_NEW_CONTEXT 0
#define GLUT_USE_CURRENT_CONTEXT 1
/*
* Direct/Indirect rendering context options (has meaning only in Unix/X11)
*/
#define GLUT_FORCE_INDIRECT_CONTEXT 0
#define GLUT_ALLOW_DIRECT_CONTEXT 1
#define GLUT_TRY_DIRECT_CONTEXT 2
#define GLUT_FORCE_DIRECT_CONTEXT 3
/*
* GLUT API Extension macro definitions -- the glutGet parameters
*/
#define GLUT_INIT_STATE 0x007C
#define GLUT_ACTION_ON_WINDOW_CLOSE 0x01F9
#define GLUT_WINDOW_BORDER_WIDTH 0x01FA
#define GLUT_WINDOW_BORDER_HEIGHT 0x01FB
#define GLUT_WINDOW_HEADER_HEIGHT 0x01FB /* Docs say it should always have been GLUT_WINDOW_BORDER_HEIGHT, keep this for backward compatibility */
#define GLUT_VERSION 0x01FC
#define GLUT_RENDERING_CONTEXT 0x01FD
#define GLUT_DIRECT_RENDERING 0x01FE
#define GLUT_FULL_SCREEN 0x01FF
#define GLUT_SKIP_STALE_MOTION_EVENTS 0x0204
#define GLUT_GEOMETRY_VISUALIZE_NORMALS 0x0205
#define GLUT_STROKE_FONT_DRAW_JOIN_DOTS 0x0206 /* Draw dots between line segments of stroke fonts? */
/*
* New tokens for glutInitDisplayMode.
* Only one GLUT_AUXn bit may be used at a time.
* Value 0x0400 is defined in OpenGLUT.
*/
#define GLUT_AUX 0x1000
#define GLUT_AUX1 0x1000
#define GLUT_AUX2 0x2000
#define GLUT_AUX3 0x4000
#define GLUT_AUX4 0x8000
/*
* Context-related flags, see fg_state.c
* Set the requested OpenGL version
*/
#define GLUT_INIT_MAJOR_VERSION 0x0200
#define GLUT_INIT_MINOR_VERSION 0x0201
#define GLUT_INIT_FLAGS 0x0202
#define GLUT_INIT_PROFILE 0x0203
/*
* Flags for glutInitContextFlags, see fg_init.c
*/
#define GLUT_DEBUG 0x0001
#define GLUT_FORWARD_COMPATIBLE 0x0002
/*
* Flags for glutInitContextProfile, see fg_init.c
*/
#define GLUT_CORE_PROFILE 0x0001
#define GLUT_COMPATIBILITY_PROFILE 0x0002
/*
* Process loop function, see fg_main.c
*/
FGAPI void FGAPIENTRY glutMainLoopEvent( void );
FGAPI void FGAPIENTRY glutLeaveMainLoop( void );
FGAPI void FGAPIENTRY glutExit ( void );
/*
* Window management functions, see fg_window.c
*/
FGAPI void FGAPIENTRY glutFullScreenToggle( void );
FGAPI void FGAPIENTRY glutLeaveFullScreen( void );
/*
* Menu functions
*/
FGAPI void FGAPIENTRY glutSetMenuFont( int menuID, void* font );
/*
* Window-specific callback functions, see fg_callbacks.c
*/
FGAPI void FGAPIENTRY glutMouseWheelFunc( void (* callback)( int, int, int, int ) );
FGAPI void FGAPIENTRY glutPositionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutCloseFunc( void (* callback)( void ) );
FGAPI void FGAPIENTRY glutWMCloseFunc( void (* callback)( void ) );
/* And also a destruction callback for menus */
FGAPI void FGAPIENTRY glutMenuDestroyFunc( void (* callback)( void ) );
/*
* State setting and retrieval functions, see fg_state.c
*/
FGAPI void FGAPIENTRY glutSetOption ( GLenum option_flag, int value );
FGAPI int * FGAPIENTRY glutGetModeValues(GLenum mode, int * size);
/* A.Donev: User-data manipulation */
FGAPI void* FGAPIENTRY glutGetWindowData( void );
FGAPI void FGAPIENTRY glutSetWindowData(void* data);
FGAPI void* FGAPIENTRY glutGetMenuData( void );
FGAPI void FGAPIENTRY glutSetMenuData(void* data);
/*
* Font stuff, see fg_font.c
*/
FGAPI int FGAPIENTRY glutBitmapHeight( void* font );
FGAPI GLfloat FGAPIENTRY glutStrokeHeight( void* font );
FGAPI void FGAPIENTRY glutBitmapString( void* font, const unsigned char *string );
FGAPI void FGAPIENTRY glutStrokeString( void* font, const unsigned char *string );
/*
* Geometry functions, see fg_geometry.c
*/
FGAPI void FGAPIENTRY glutWireRhombicDodecahedron( void );
FGAPI void FGAPIENTRY glutSolidRhombicDodecahedron( void );
FGAPI void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, double offset[3], double scale );
FGAPI void FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, double offset[3], double scale );
FGAPI void FGAPIENTRY glutWireCylinder( double radius, double height, GLint slices, GLint stacks);
FGAPI void FGAPIENTRY glutSolidCylinder( double radius, double height, GLint slices, GLint stacks);
/*
* Rest of functions for rendering Newell's teaset, found in fg_teapot.c
* NB: front facing polygons have clockwise winding, not counter clockwise
*/
FGAPI void FGAPIENTRY glutWireTeacup( double size );
FGAPI void FGAPIENTRY glutSolidTeacup( double size );
FGAPI void FGAPIENTRY glutWireTeaspoon( double size );
FGAPI void FGAPIENTRY glutSolidTeaspoon( double size );
/*
* Extension functions, see fg_ext.c
*/
typedef void (*GLUTproc)();
FGAPI GLUTproc FGAPIENTRY glutGetProcAddress( const char *procName );
/*
* Multi-touch/multi-pointer extensions
*/
#define GLUT_HAS_MULTI 1
/* TODO: add device_id parameter,
cf. http://sourceforge.net/mailarchive/forum.php?thread_name=20120518071314.GA28061%40perso.beuc.net&forum_name=freeglut-developer */
FGAPI void FGAPIENTRY glutMultiEntryFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutMultiButtonFunc( void (* callback)( int, int, int, int, int ) );
FGAPI void FGAPIENTRY glutMultiMotionFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutMultiPassiveFunc( void (* callback)( int, int, int ) );
/*
* Joystick functions, see fg_joystick.c
*/
/* USE OF THESE FUNCTIONS IS DEPRECATED !!!!! */
/* If you have a serious need for these functions in your application, please either
* contact the "freeglut" developer community at freeglut-developer@lists.sourceforge.net,
* switch to the OpenGLUT library, or else port your joystick functionality over to PLIB's
* "js" library.
*/
int glutJoystickGetNumAxes( int ident );
int glutJoystickGetNumButtons( int ident );
int glutJoystickNotWorking( int ident );
float glutJoystickGetDeadBand( int ident, int axis );
void glutJoystickSetDeadBand( int ident, int axis, float db );
float glutJoystickGetSaturation( int ident, int axis );
void glutJoystickSetSaturation( int ident, int axis, float st );
void glutJoystickSetMinRange( int ident, float *axes );
void glutJoystickSetMaxRange( int ident, float *axes );
void glutJoystickSetCenter( int ident, float *axes );
void glutJoystickGetMinRange( int ident, float *axes );
void glutJoystickGetMaxRange( int ident, float *axes );
void glutJoystickGetCenter( int ident, float *axes );
/*
* Initialization functions, see fg_init.c
*/
/* to get the typedef for va_list */
#include <stdarg.h>
FGAPI void FGAPIENTRY glutInitContextVersion( int majorVersion, int minorVersion );
FGAPI void FGAPIENTRY glutInitContextFlags( int flags );
FGAPI void FGAPIENTRY glutInitContextProfile( int profile );
FGAPI void FGAPIENTRY glutInitErrorFunc( void (* callback)( const char *fmt, va_list ap ) );
FGAPI void FGAPIENTRY glutInitWarningFunc( void (* callback)( const char *fmt, va_list ap ) );
/* OpenGL >= 2.0 support */
FGAPI void FGAPIENTRY glutSetVertexAttribCoord3(GLint attrib);
FGAPI void FGAPIENTRY glutSetVertexAttribNormal(GLint attrib);
FGAPI void FGAPIENTRY glutSetVertexAttribTexCoord2(GLint attrib);
/* Mobile platforms lifecycle */
FGAPI void FGAPIENTRY glutInitContextFunc(void (* callback)());
FGAPI void FGAPIENTRY glutAppStatusFunc(void (* callback)(int));
/* state flags that can be passed to callback set by glutAppStatusFunc */
#define GLUT_APPSTATUS_PAUSE 0x0001
#define GLUT_APPSTATUS_RESUME 0x0002
/*
* GLUT API macro definitions -- the display mode definitions
*/
#define GLUT_CAPTIONLESS 0x0400
#define GLUT_BORDERLESS 0x0800
#define GLUT_SRGB 0x1000
#ifdef __cplusplus
}
#endif
/*** END OF FILE ***/
#endif /* __FREEGLUT_EXT_H__ */
+638
View File
@@ -0,0 +1,638 @@
#ifndef __FREEGLUT_STD_H__
#define __FREEGLUT_STD_H__
/*
* freeglut_std.h
*
* The GLUT-compatible part of the freeglut library include file
*
* Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
* Written by Pawel W. Olszta, <olszta@sourceforge.net>
* Creation date: Thu Dec 2 1999
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Under windows, we have to differentiate between static and dynamic libraries
*/
#ifdef _WIN32
/* #pragma may not be supported by some compilers.
* Discussion by FreeGLUT developers suggests that
* Visual C++ specific code involving pragmas may
* need to move to a separate header. 24th Dec 2003
*/
/* Define FREEGLUT_LIB_PRAGMAS to 1 to include library
* pragmas or to 0 to exclude library pragmas.
* The default behavior depends on the compiler/platform.
*/
# ifndef FREEGLUT_LIB_PRAGMAS
# if ( defined(_MSC_VER) || defined(__WATCOMC__) ) && !defined(_WIN32_WCE)
# define FREEGLUT_LIB_PRAGMAS 1
# else
# define FREEGLUT_LIB_PRAGMAS 0
# endif
# endif
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN 1
# endif
# ifndef NOMINMAX
# define NOMINMAX
# endif
# include <windows.h>
/* Windows static library */
# ifdef FREEGLUT_STATIC
#error Static linking is not supported with this build. Please remove the FREEGLUT_STATIC preprocessor directive, or download the source code from http://freeglut.sf.net/ and build against that.
/* Windows shared library (DLL) */
# else
# define FGAPIENTRY __stdcall
# if defined(FREEGLUT_EXPORTS)
# define FGAPI __declspec(dllexport)
# else
# define FGAPI __declspec(dllimport)
/* Link with Win32 shared freeglut lib */
# if FREEGLUT_LIB_PRAGMAS
# pragma comment (lib, "freeglut.lib")
# endif
# endif
# endif
/* Drag in other Windows libraries as required by FreeGLUT */
# if FREEGLUT_LIB_PRAGMAS
# pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */
# pragma comment (lib, "opengl32.lib") /* link Microsoft OpenGL lib */
# pragma comment (lib, "gdi32.lib") /* link Windows GDI lib */
# pragma comment (lib, "winmm.lib") /* link Windows MultiMedia lib */
# pragma comment (lib, "user32.lib") /* link Windows user lib */
# endif
#else
/* Non-Windows definition of FGAPI and FGAPIENTRY */
# define FGAPI
# define FGAPIENTRY
#endif
/*
* The freeglut and GLUT API versions
*/
#define FREEGLUT 1
#define GLUT_API_VERSION 4
#define GLUT_XLIB_IMPLEMENTATION 13
/* Deprecated:
cf. http://sourceforge.net/mailarchive/forum.php?thread_name=CABcAi1hw7cr4xtigckaGXB5X8wddLfMcbA_rZ3NAuwMrX_zmsw%40mail.gmail.com&forum_name=freeglut-developer */
#define FREEGLUT_VERSION_2_0 1
/*
* Always include OpenGL and GLU headers
*/
/* Note: FREEGLUT_GLES is only used to cleanly bootstrap headers
inclusion here; use GLES constants directly
(e.g. GL_ES_VERSION_2_0) for all other needs */
#ifdef FREEGLUT_GLES
# include <EGL/egl.h>
# include <GLES/gl.h>
# include <GLES2/gl2.h>
#elif __APPLE__
# include <OpenGL/gl.h>
# include <OpenGL/glu.h>
#else
# include <GL/gl.h>
# include <GL/glu.h>
#endif
/*
* GLUT API macro definitions -- the special key codes:
*/
#define GLUT_KEY_F1 0x0001
#define GLUT_KEY_F2 0x0002
#define GLUT_KEY_F3 0x0003
#define GLUT_KEY_F4 0x0004
#define GLUT_KEY_F5 0x0005
#define GLUT_KEY_F6 0x0006
#define GLUT_KEY_F7 0x0007
#define GLUT_KEY_F8 0x0008
#define GLUT_KEY_F9 0x0009
#define GLUT_KEY_F10 0x000A
#define GLUT_KEY_F11 0x000B
#define GLUT_KEY_F12 0x000C
#define GLUT_KEY_LEFT 0x0064
#define GLUT_KEY_UP 0x0065
#define GLUT_KEY_RIGHT 0x0066
#define GLUT_KEY_DOWN 0x0067
#define GLUT_KEY_PAGE_UP 0x0068
#define GLUT_KEY_PAGE_DOWN 0x0069
#define GLUT_KEY_HOME 0x006A
#define GLUT_KEY_END 0x006B
#define GLUT_KEY_INSERT 0x006C
/*
* GLUT API macro definitions -- mouse state definitions
*/
#define GLUT_LEFT_BUTTON 0x0000
#define GLUT_MIDDLE_BUTTON 0x0001
#define GLUT_RIGHT_BUTTON 0x0002
#define GLUT_DOWN 0x0000
#define GLUT_UP 0x0001
#define GLUT_LEFT 0x0000
#define GLUT_ENTERED 0x0001
/*
* GLUT API macro definitions -- the display mode definitions
*/
#define GLUT_RGB 0x0000
#define GLUT_RGBA 0x0000
#define GLUT_INDEX 0x0001
#define GLUT_SINGLE 0x0000
#define GLUT_DOUBLE 0x0002
#define GLUT_ACCUM 0x0004
#define GLUT_ALPHA 0x0008
#define GLUT_DEPTH 0x0010
#define GLUT_STENCIL 0x0020
#define GLUT_MULTISAMPLE 0x0080
#define GLUT_STEREO 0x0100
#define GLUT_LUMINANCE 0x0200
/*
* GLUT API macro definitions -- windows and menu related definitions
*/
#define GLUT_MENU_NOT_IN_USE 0x0000
#define GLUT_MENU_IN_USE 0x0001
#define GLUT_NOT_VISIBLE 0x0000
#define GLUT_VISIBLE 0x0001
#define GLUT_HIDDEN 0x0000
#define GLUT_FULLY_RETAINED 0x0001
#define GLUT_PARTIALLY_RETAINED 0x0002
#define GLUT_FULLY_COVERED 0x0003
/*
* GLUT API macro definitions -- fonts definitions
*
* Steve Baker suggested to make it binary compatible with GLUT:
*/
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__WATCOMC__)
# define GLUT_STROKE_ROMAN ((void *)0x0000)
# define GLUT_STROKE_MONO_ROMAN ((void *)0x0001)
# define GLUT_BITMAP_9_BY_15 ((void *)0x0002)
# define GLUT_BITMAP_8_BY_13 ((void *)0x0003)
# define GLUT_BITMAP_TIMES_ROMAN_10 ((void *)0x0004)
# define GLUT_BITMAP_TIMES_ROMAN_24 ((void *)0x0005)
# define GLUT_BITMAP_HELVETICA_10 ((void *)0x0006)
# define GLUT_BITMAP_HELVETICA_12 ((void *)0x0007)
# define GLUT_BITMAP_HELVETICA_18 ((void *)0x0008)
#else
/*
* I don't really know if it's a good idea... But here it goes:
*/
extern void* glutStrokeRoman;
extern void* glutStrokeMonoRoman;
extern void* glutBitmap9By15;
extern void* glutBitmap8By13;
extern void* glutBitmapTimesRoman10;
extern void* glutBitmapTimesRoman24;
extern void* glutBitmapHelvetica10;
extern void* glutBitmapHelvetica12;
extern void* glutBitmapHelvetica18;
/*
* Those pointers will be used by following definitions:
*/
# define GLUT_STROKE_ROMAN ((void *) &glutStrokeRoman)
# define GLUT_STROKE_MONO_ROMAN ((void *) &glutStrokeMonoRoman)
# define GLUT_BITMAP_9_BY_15 ((void *) &glutBitmap9By15)
# define GLUT_BITMAP_8_BY_13 ((void *) &glutBitmap8By13)
# define GLUT_BITMAP_TIMES_ROMAN_10 ((void *) &glutBitmapTimesRoman10)
# define GLUT_BITMAP_TIMES_ROMAN_24 ((void *) &glutBitmapTimesRoman24)
# define GLUT_BITMAP_HELVETICA_10 ((void *) &glutBitmapHelvetica10)
# define GLUT_BITMAP_HELVETICA_12 ((void *) &glutBitmapHelvetica12)
# define GLUT_BITMAP_HELVETICA_18 ((void *) &glutBitmapHelvetica18)
#endif
/*
* GLUT API macro definitions -- the glutGet parameters
*/
#define GLUT_WINDOW_X 0x0064
#define GLUT_WINDOW_Y 0x0065
#define GLUT_WINDOW_WIDTH 0x0066
#define GLUT_WINDOW_HEIGHT 0x0067
#define GLUT_WINDOW_BUFFER_SIZE 0x0068
#define GLUT_WINDOW_STENCIL_SIZE 0x0069
#define GLUT_WINDOW_DEPTH_SIZE 0x006A
#define GLUT_WINDOW_RED_SIZE 0x006B
#define GLUT_WINDOW_GREEN_SIZE 0x006C
#define GLUT_WINDOW_BLUE_SIZE 0x006D
#define GLUT_WINDOW_ALPHA_SIZE 0x006E
#define GLUT_WINDOW_ACCUM_RED_SIZE 0x006F
#define GLUT_WINDOW_ACCUM_GREEN_SIZE 0x0070
#define GLUT_WINDOW_ACCUM_BLUE_SIZE 0x0071
#define GLUT_WINDOW_ACCUM_ALPHA_SIZE 0x0072
#define GLUT_WINDOW_DOUBLEBUFFER 0x0073
#define GLUT_WINDOW_RGBA 0x0074
#define GLUT_WINDOW_PARENT 0x0075
#define GLUT_WINDOW_NUM_CHILDREN 0x0076
#define GLUT_WINDOW_COLORMAP_SIZE 0x0077
#define GLUT_WINDOW_NUM_SAMPLES 0x0078
#define GLUT_WINDOW_STEREO 0x0079
#define GLUT_WINDOW_CURSOR 0x007A
#define GLUT_SCREEN_WIDTH 0x00C8
#define GLUT_SCREEN_HEIGHT 0x00C9
#define GLUT_SCREEN_WIDTH_MM 0x00CA
#define GLUT_SCREEN_HEIGHT_MM 0x00CB
#define GLUT_MENU_NUM_ITEMS 0x012C
#define GLUT_DISPLAY_MODE_POSSIBLE 0x0190
#define GLUT_INIT_WINDOW_X 0x01F4
#define GLUT_INIT_WINDOW_Y 0x01F5
#define GLUT_INIT_WINDOW_WIDTH 0x01F6
#define GLUT_INIT_WINDOW_HEIGHT 0x01F7
#define GLUT_INIT_DISPLAY_MODE 0x01F8
#define GLUT_ELAPSED_TIME 0x02BC
#define GLUT_WINDOW_FORMAT_ID 0x007B
/*
* GLUT API macro definitions -- the glutDeviceGet parameters
*/
#define GLUT_HAS_KEYBOARD 0x0258
#define GLUT_HAS_MOUSE 0x0259
#define GLUT_HAS_SPACEBALL 0x025A
#define GLUT_HAS_DIAL_AND_BUTTON_BOX 0x025B
#define GLUT_HAS_TABLET 0x025C
#define GLUT_NUM_MOUSE_BUTTONS 0x025D
#define GLUT_NUM_SPACEBALL_BUTTONS 0x025E
#define GLUT_NUM_BUTTON_BOX_BUTTONS 0x025F
#define GLUT_NUM_DIALS 0x0260
#define GLUT_NUM_TABLET_BUTTONS 0x0261
#define GLUT_DEVICE_IGNORE_KEY_REPEAT 0x0262
#define GLUT_DEVICE_KEY_REPEAT 0x0263
#define GLUT_HAS_JOYSTICK 0x0264
#define GLUT_OWNS_JOYSTICK 0x0265
#define GLUT_JOYSTICK_BUTTONS 0x0266
#define GLUT_JOYSTICK_AXES 0x0267
#define GLUT_JOYSTICK_POLL_RATE 0x0268
/*
* GLUT API macro definitions -- the glutLayerGet parameters
*/
#define GLUT_OVERLAY_POSSIBLE 0x0320
#define GLUT_LAYER_IN_USE 0x0321
#define GLUT_HAS_OVERLAY 0x0322
#define GLUT_TRANSPARENT_INDEX 0x0323
#define GLUT_NORMAL_DAMAGED 0x0324
#define GLUT_OVERLAY_DAMAGED 0x0325
/*
* GLUT API macro definitions -- the glutVideoResizeGet parameters
*/
#define GLUT_VIDEO_RESIZE_POSSIBLE 0x0384
#define GLUT_VIDEO_RESIZE_IN_USE 0x0385
#define GLUT_VIDEO_RESIZE_X_DELTA 0x0386
#define GLUT_VIDEO_RESIZE_Y_DELTA 0x0387
#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 0x0388
#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 0x0389
#define GLUT_VIDEO_RESIZE_X 0x038A
#define GLUT_VIDEO_RESIZE_Y 0x038B
#define GLUT_VIDEO_RESIZE_WIDTH 0x038C
#define GLUT_VIDEO_RESIZE_HEIGHT 0x038D
/*
* GLUT API macro definitions -- the glutUseLayer parameters
*/
#define GLUT_NORMAL 0x0000
#define GLUT_OVERLAY 0x0001
/*
* GLUT API macro definitions -- the glutGetModifiers parameters
*/
#define GLUT_ACTIVE_SHIFT 0x0001
#define GLUT_ACTIVE_CTRL 0x0002
#define GLUT_ACTIVE_ALT 0x0004
/*
* GLUT API macro definitions -- the glutSetCursor parameters
*/
#define GLUT_CURSOR_RIGHT_ARROW 0x0000
#define GLUT_CURSOR_LEFT_ARROW 0x0001
#define GLUT_CURSOR_INFO 0x0002
#define GLUT_CURSOR_DESTROY 0x0003
#define GLUT_CURSOR_HELP 0x0004
#define GLUT_CURSOR_CYCLE 0x0005
#define GLUT_CURSOR_SPRAY 0x0006
#define GLUT_CURSOR_WAIT 0x0007
#define GLUT_CURSOR_TEXT 0x0008
#define GLUT_CURSOR_CROSSHAIR 0x0009
#define GLUT_CURSOR_UP_DOWN 0x000A
#define GLUT_CURSOR_LEFT_RIGHT 0x000B
#define GLUT_CURSOR_TOP_SIDE 0x000C
#define GLUT_CURSOR_BOTTOM_SIDE 0x000D
#define GLUT_CURSOR_LEFT_SIDE 0x000E
#define GLUT_CURSOR_RIGHT_SIDE 0x000F
#define GLUT_CURSOR_TOP_LEFT_CORNER 0x0010
#define GLUT_CURSOR_TOP_RIGHT_CORNER 0x0011
#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 0x0012
#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 0x0013
#define GLUT_CURSOR_INHERIT 0x0064
#define GLUT_CURSOR_NONE 0x0065
#define GLUT_CURSOR_FULL_CROSSHAIR 0x0066
/*
* GLUT API macro definitions -- RGB color component specification definitions
*/
#define GLUT_RED 0x0000
#define GLUT_GREEN 0x0001
#define GLUT_BLUE 0x0002
/*
* GLUT API macro definitions -- additional keyboard and joystick definitions
*/
#define GLUT_KEY_REPEAT_OFF 0x0000
#define GLUT_KEY_REPEAT_ON 0x0001
#define GLUT_KEY_REPEAT_DEFAULT 0x0002
#define GLUT_JOYSTICK_BUTTON_A 0x0001
#define GLUT_JOYSTICK_BUTTON_B 0x0002
#define GLUT_JOYSTICK_BUTTON_C 0x0004
#define GLUT_JOYSTICK_BUTTON_D 0x0008
/*
* GLUT API macro definitions -- game mode definitions
*/
#define GLUT_GAME_MODE_ACTIVE 0x0000
#define GLUT_GAME_MODE_POSSIBLE 0x0001
#define GLUT_GAME_MODE_WIDTH 0x0002
#define GLUT_GAME_MODE_HEIGHT 0x0003
#define GLUT_GAME_MODE_PIXEL_DEPTH 0x0004
#define GLUT_GAME_MODE_REFRESH_RATE 0x0005
#define GLUT_GAME_MODE_DISPLAY_CHANGED 0x0006
/*
* Initialization functions, see fglut_init.c
*/
FGAPI void FGAPIENTRY glutInit( int* pargc, char** argv );
FGAPI void FGAPIENTRY glutInitWindowPosition( int x, int y );
FGAPI void FGAPIENTRY glutInitWindowSize( int width, int height );
FGAPI void FGAPIENTRY glutInitDisplayMode( unsigned int displayMode );
FGAPI void FGAPIENTRY glutInitDisplayString( const char* displayMode );
/*
* Process loop function, see fg_main.c
*/
FGAPI void FGAPIENTRY glutMainLoop( void );
/*
* Window management functions, see fg_window.c
*/
FGAPI int FGAPIENTRY glutCreateWindow( const char* title );
FGAPI int FGAPIENTRY glutCreateSubWindow( int window, int x, int y, int width, int height );
FGAPI void FGAPIENTRY glutDestroyWindow( int window );
FGAPI void FGAPIENTRY glutSetWindow( int window );
FGAPI int FGAPIENTRY glutGetWindow( void );
FGAPI void FGAPIENTRY glutSetWindowTitle( const char* title );
FGAPI void FGAPIENTRY glutSetIconTitle( const char* title );
FGAPI void FGAPIENTRY glutReshapeWindow( int width, int height );
FGAPI void FGAPIENTRY glutPositionWindow( int x, int y );
FGAPI void FGAPIENTRY glutShowWindow( void );
FGAPI void FGAPIENTRY glutHideWindow( void );
FGAPI void FGAPIENTRY glutIconifyWindow( void );
FGAPI void FGAPIENTRY glutPushWindow( void );
FGAPI void FGAPIENTRY glutPopWindow( void );
FGAPI void FGAPIENTRY glutFullScreen( void );
/*
* Display-related functions, see fg_display.c
*/
FGAPI void FGAPIENTRY glutPostWindowRedisplay( int window );
FGAPI void FGAPIENTRY glutPostRedisplay( void );
FGAPI void FGAPIENTRY glutSwapBuffers( void );
/*
* Mouse cursor functions, see fg_cursor.c
*/
FGAPI void FGAPIENTRY glutWarpPointer( int x, int y );
FGAPI void FGAPIENTRY glutSetCursor( int cursor );
/*
* Overlay stuff, see fg_overlay.c
*/
FGAPI void FGAPIENTRY glutEstablishOverlay( void );
FGAPI void FGAPIENTRY glutRemoveOverlay( void );
FGAPI void FGAPIENTRY glutUseLayer( GLenum layer );
FGAPI void FGAPIENTRY glutPostOverlayRedisplay( void );
FGAPI void FGAPIENTRY glutPostWindowOverlayRedisplay( int window );
FGAPI void FGAPIENTRY glutShowOverlay( void );
FGAPI void FGAPIENTRY glutHideOverlay( void );
/*
* Menu stuff, see fg_menu.c
*/
FGAPI int FGAPIENTRY glutCreateMenu( void (* callback)( int menu ) );
FGAPI void FGAPIENTRY glutDestroyMenu( int menu );
FGAPI int FGAPIENTRY glutGetMenu( void );
FGAPI void FGAPIENTRY glutSetMenu( int menu );
FGAPI void FGAPIENTRY glutAddMenuEntry( const char* label, int value );
FGAPI void FGAPIENTRY glutAddSubMenu( const char* label, int subMenu );
FGAPI void FGAPIENTRY glutChangeToMenuEntry( int item, const char* label, int value );
FGAPI void FGAPIENTRY glutChangeToSubMenu( int item, const char* label, int value );
FGAPI void FGAPIENTRY glutRemoveMenuItem( int item );
FGAPI void FGAPIENTRY glutAttachMenu( int button );
FGAPI void FGAPIENTRY glutDetachMenu( int button );
/*
* Global callback functions, see fg_callbacks.c
*/
FGAPI void FGAPIENTRY glutTimerFunc( unsigned int time, void (* callback)( int ), int value );
FGAPI void FGAPIENTRY glutIdleFunc( void (* callback)( void ) );
/*
* Window-specific callback functions, see fg_callbacks.c
*/
FGAPI void FGAPIENTRY glutKeyboardFunc( void (* callback)( unsigned char, int, int ) );
FGAPI void FGAPIENTRY glutSpecialFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutReshapeFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutVisibilityFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutDisplayFunc( void (* callback)( void ) );
FGAPI void FGAPIENTRY glutMouseFunc( void (* callback)( int, int, int, int ) );
FGAPI void FGAPIENTRY glutMotionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutPassiveMotionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutEntryFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutKeyboardUpFunc( void (* callback)( unsigned char, int, int ) );
FGAPI void FGAPIENTRY glutSpecialUpFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutJoystickFunc( void (* callback)( unsigned int, int, int, int ), int pollInterval );
FGAPI void FGAPIENTRY glutMenuStateFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutMenuStatusFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutOverlayDisplayFunc( void (* callback)( void ) );
FGAPI void FGAPIENTRY glutWindowStatusFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutSpaceballMotionFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutSpaceballRotateFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutSpaceballButtonFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutButtonBoxFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutDialsFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutTabletMotionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutTabletButtonFunc( void (* callback)( int, int, int, int ) );
/*
* State setting and retrieval functions, see fg_state.c
*/
FGAPI int FGAPIENTRY glutGet( GLenum query );
FGAPI int FGAPIENTRY glutDeviceGet( GLenum query );
FGAPI int FGAPIENTRY glutGetModifiers( void );
FGAPI int FGAPIENTRY glutLayerGet( GLenum query );
/*
* Font stuff, see fg_font.c
*/
FGAPI void FGAPIENTRY glutBitmapCharacter( void* font, int character );
FGAPI int FGAPIENTRY glutBitmapWidth( void* font, int character );
FGAPI void FGAPIENTRY glutStrokeCharacter( void* font, int character );
FGAPI int FGAPIENTRY glutStrokeWidth( void* font, int character );
FGAPI GLfloat FGAPIENTRY glutStrokeWidthf( void* font, int character ); /* GLUT 3.8 */
FGAPI int FGAPIENTRY glutBitmapLength( void* font, const unsigned char* string );
FGAPI int FGAPIENTRY glutStrokeLength( void* font, const unsigned char* string );
FGAPI GLfloat FGAPIENTRY glutStrokeLengthf( void* font, const unsigned char *string ); /* GLUT 3.8 */
/*
* Geometry functions, see fg_geometry.c
*/
FGAPI void FGAPIENTRY glutWireCube( double size );
FGAPI void FGAPIENTRY glutSolidCube( double size );
FGAPI void FGAPIENTRY glutWireSphere( double radius, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutSolidSphere( double radius, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutWireCone( double base, double height, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutSolidCone( double base, double height, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutWireTorus( double innerRadius, double outerRadius, GLint sides, GLint rings );
FGAPI void FGAPIENTRY glutSolidTorus( double innerRadius, double outerRadius, GLint sides, GLint rings );
FGAPI void FGAPIENTRY glutWireDodecahedron( void );
FGAPI void FGAPIENTRY glutSolidDodecahedron( void );
FGAPI void FGAPIENTRY glutWireOctahedron( void );
FGAPI void FGAPIENTRY glutSolidOctahedron( void );
FGAPI void FGAPIENTRY glutWireTetrahedron( void );
FGAPI void FGAPIENTRY glutSolidTetrahedron( void );
FGAPI void FGAPIENTRY glutWireIcosahedron( void );
FGAPI void FGAPIENTRY glutSolidIcosahedron( void );
/*
* Teapot rendering functions, found in fg_teapot.c
* NB: front facing polygons have clockwise winding, not counter clockwise
*/
FGAPI void FGAPIENTRY glutWireTeapot( double size );
FGAPI void FGAPIENTRY glutSolidTeapot( double size );
/*
* Game mode functions, see fg_gamemode.c
*/
FGAPI void FGAPIENTRY glutGameModeString( const char* string );
FGAPI int FGAPIENTRY glutEnterGameMode( void );
FGAPI void FGAPIENTRY glutLeaveGameMode( void );
FGAPI int FGAPIENTRY glutGameModeGet( GLenum query );
/*
* Video resize functions, see fg_videoresize.c
*/
FGAPI int FGAPIENTRY glutVideoResizeGet( GLenum query );
FGAPI void FGAPIENTRY glutSetupVideoResizing( void );
FGAPI void FGAPIENTRY glutStopVideoResizing( void );
FGAPI void FGAPIENTRY glutVideoResize( int x, int y, int width, int height );
FGAPI void FGAPIENTRY glutVideoPan( int x, int y, int width, int height );
/*
* Colormap functions, see fg_misc.c
*/
FGAPI void FGAPIENTRY glutSetColor( int color, GLfloat red, GLfloat green, GLfloat blue );
FGAPI GLfloat FGAPIENTRY glutGetColor( int color, int component );
FGAPI void FGAPIENTRY glutCopyColormap( int window );
/*
* Misc keyboard and joystick functions, see fg_misc.c
*/
FGAPI void FGAPIENTRY glutIgnoreKeyRepeat( int ignore );
FGAPI void FGAPIENTRY glutSetKeyRepeat( int repeatMode );
FGAPI void FGAPIENTRY glutForceJoystickFunc( void );
/*
* Misc functions, see fg_misc.c
*/
FGAPI int FGAPIENTRY glutExtensionSupported( const char* extension );
FGAPI void FGAPIENTRY glutReportErrors( void );
/* Comment from glut.h of classic GLUT:
Win32 has an annoying issue where there are multiple C run-time
libraries (CRTs). If the executable is linked with a different CRT
from the GLUT DLL, the GLUT DLL will not share the same CRT static
data seen by the executable. In particular, atexit callbacks registered
in the executable will not be called if GLUT calls its (different)
exit routine). GLUT is typically built with the
"/MD" option (the CRT with multithreading DLL support), but the Visual
C++ linker default is "/ML" (the single threaded CRT).
One workaround to this issue is requiring users to always link with
the same CRT as GLUT is compiled with. That requires users supply a
non-standard option. GLUT 3.7 has its own built-in workaround where
the executable's "exit" function pointer is covertly passed to GLUT.
GLUT then calls the executable's exit function pointer to ensure that
any "atexit" calls registered by the application are called if GLUT
needs to exit.
Note that the __glut*WithExit routines should NEVER be called directly.
To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */
/* to get the prototype for exit() */
#include <stdlib.h>
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) && !defined(__WATCOMC__)
FGAPI void FGAPIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
FGAPI int FGAPIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int));
FGAPI int FGAPIENTRY __glutCreateMenuWithExit(void (* func)(int), void (__cdecl *exitfunc)(int));
#ifndef FREEGLUT_BUILDING_LIB
#if defined(__GNUC__)
#define FGUNUSED __attribute__((unused))
#else
#define FGUNUSED
#endif
static void FGAPIENTRY FGUNUSED glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); }
#define glutInit glutInit_ATEXIT_HACK
static int FGAPIENTRY FGUNUSED glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); }
#define glutCreateWindow glutCreateWindow_ATEXIT_HACK
static int FGAPIENTRY FGUNUSED glutCreateMenu_ATEXIT_HACK(void (* func)(int)) { return __glutCreateMenuWithExit(func, exit); }
#define glutCreateMenu glutCreateMenu_ATEXIT_HACK
#endif
#endif
#ifdef __cplusplus
}
#endif
/*** END OF FILE ***/
#endif /* __FREEGLUT_STD_H__ */
+21
View File
@@ -0,0 +1,21 @@
#ifndef __GLUT_H__
#define __GLUT_H__
/*
* glut.h
*
* The freeglut library include file
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "freeglut_std.h"
/*** END OF FILE ***/
#endif /* __GLUT_H__ */
Binary file not shown.
+439
View File
@@ -0,0 +1,439 @@
#include <GL/freeglut.h>
#include <cstdio>
#include <time.h>
#include <iostream>
#include <windows.h>
#include <mmsystem.h>
#define _USE_MATH_DEFINES
#include <cmath>
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#define STB_PERLIN_IMPLEMENTATION
#include "stb_perlin.h"
void generateTree(int, int, int);
void generateWater(int, int, int);
int width, height;
GLuint blocksTexture;
const int worldWidth = 64;
const int worldDepth = 64;
const int worldHeight = 16;
const int blockSize = 2;
float lastFrameTime = 0;
float lastypos = 0;
float speed = 10;
float eyeheight = 3;
struct Camera
{
float posX = 0;
float posZ = 0;
float posY = 0;
float rotX = 0;
float rotY = 120;
} camera;
struct Block
{
int textureTop;
int textureSide;
};
Block world[worldWidth][worldDepth][worldHeight];
bool keys[255];
void generateWorld() {
std::srand(time(NULL));
float rand = std::rand() * (1.0f / worldDepth);
std::cout << "Generating world... " << rand << std::endl;
for (int x = 0; x < worldWidth; x++){
for (int z = 0; z < worldDepth; z++){
for (int y = 0; y < worldHeight; y++){
world[x][z][y] = Block{ -1,-1 };
}
}
}
for (int x = 0; x < worldWidth; x++)
{
for (int z = 0; z < worldDepth; z++)
{
float h = stb_perlin_noise3((1.0f/(float)worldWidth)*(float)x, (1.0f / (float)worldDepth)*(float)z, rand);
int heightInt = abs((int)(h * 8));
for (int y = 0; y < worldHeight; y++)
{
if (world[x][z][y].textureSide != -1)
continue;
if (y < worldHeight / 4)
{
int d = std::rand() % 1000;
if (d > 990)
world[x][z][y] = Block{ 32, 32 };
else if (d > 960)
world[x][z][y] = Block{ 33, 33 };
else if (d > 900)
world[x][z][y] = Block{ 34, 34 };
else
world[x][z][y] = Block{ 1, 1 };
}
else if (y < (heightInt + worldHeight / 4))
{
world[x][z][y] = Block{ 2, 2 };
}
else if (y == (heightInt + worldHeight / 4))
{
world[x][z][y] = Block{ 0, 3 };
if (x == 0 && z == 0)
{
camera.posX = -blockSize / 2;
camera.posZ = -blockSize / 2;
camera.posY = (y + eyeheight) * -blockSize;
lastypos = camera.posY;
}
int d = std::rand() % 1000;
if (d > 998)
generateWater(x,z,y);
else if (d > 990)
generateTree(x, z, y+1);
else if (d > 980)
world[x][z][y + 1] = Block{ -1, 12 };
else if (d > 970)
world[x][z][y + 1] = Block{ -1, 13 };
else if (d > 920)
world[x][z][y + 1] = Block{ -1, 39 };
}
}
}
}
}
void drawCube(int top, int sides)
{
int rowNum = sides / 16;
int columnNum = sides % 16;
float part = (float)1 / 16;
float row = rowNum * part;
float column = columnNum * part;
float rowEnd = row + part;
float columnEnd = column + part;
glBegin(GL_QUADS);
glColor4f(1.0, 1.0, 1.0, 1.0);
//Side blockSize
glTexCoord2f(column, rowEnd); glVertex3f(0, 0, 0); //Linksonder
glTexCoord2f(columnEnd, rowEnd); glVertex3f(blockSize, 0, 0); //Rechtsonder
glTexCoord2f(columnEnd, row); glVertex3f(blockSize, blockSize, 0); //Rechtsboven
glTexCoord2f(column, row); glVertex3f(0, blockSize, 0); //Linksboven
//Side 2
glTexCoord2f(column, rowEnd); glVertex3f(0, 0, blockSize);
glTexCoord2f(columnEnd, rowEnd); glVertex3f(blockSize, 0, blockSize);
glTexCoord2f(columnEnd, row); glVertex3f(blockSize, blockSize, blockSize);
glTexCoord2f(column, row); glVertex3f(0, blockSize, blockSize);
//Side 3
glTexCoord2f(column, rowEnd); glVertex3f(0, 0, 0);
glTexCoord2f(column, row); glVertex3f(0, blockSize, 0);
glTexCoord2f(columnEnd, row); glVertex3f(0, blockSize, blockSize);
glTexCoord2f(columnEnd, rowEnd); glVertex3f(0, 0, blockSize);
//Side 4
glTexCoord2f(column, rowEnd); glVertex3f(blockSize, 0, 0);
glTexCoord2f(column, row); glVertex3f(blockSize, blockSize, 0);
glTexCoord2f(columnEnd, row); glVertex3f(blockSize, blockSize, blockSize);
glTexCoord2f(columnEnd, rowEnd); glVertex3f(blockSize, 0, blockSize);
if (top == -1)
{
glEnd();
return;
}
//Different textures
rowNum = top / 16;
columnNum = top % 16;
row = rowNum * part;
column = columnNum * part;
rowEnd = row + part;
columnEnd = column + part;
//Bottom
glTexCoord2f(column, row); glVertex3f(0, 0, 0);
glTexCoord2f(column, rowEnd); glVertex3f(blockSize, 0, 0);
glTexCoord2f(columnEnd, rowEnd); glVertex3f(blockSize, 0, blockSize);
glTexCoord2f(columnEnd, row); glVertex3f(0, 0, blockSize);
//Top
glTexCoord2f(column, row); glVertex3f(0, blockSize, 0);
glTexCoord2f(column, rowEnd); glVertex3f(blockSize, blockSize, 0);
glTexCoord2f(columnEnd, rowEnd); glVertex3f(blockSize, blockSize, blockSize);
glTexCoord2f(columnEnd, row); glVertex3f(0, blockSize, blockSize);
glEnd();
}
void drawCube(int texture)
{
drawCube(texture, texture);
}
void generateWater(int xlocation, int zlocation, int ylocation)
{
int size = std::rand() % 2 + 1; //Size from 1 to 2;
for (int x = (-size / 2); x <= (size / 2); x++)
{
for (int z = -(size / 2); z <= (size / 2); z++)
{
if (x + xlocation >= 0 && x + xlocation < worldWidth && z + zlocation >= 0 && z + zlocation < worldDepth)
{
world[x + xlocation][z+zlocation][ylocation] = Block{ 205,205 };
}
}
}
}
void generateTree(int xlocation, int zlocation, int ylocation)
{
int size = std::rand() % 3 + 3; //Size from 2 to 5;
int treetype = std::rand() % 4;
for (int y = ylocation; y <= ylocation+size; y ++)
{
if (y >= 0 && y < worldHeight)
{
if(treetype <= 1)
world[xlocation][zlocation][y] = Block{ 21, 20 };
else if(treetype <= 2)
world[xlocation][zlocation][y] = Block{ 21, 117 };
else
world[xlocation][zlocation][y] = Block{ 21, 116 };
}
}
for (int x = (-size /2); x <= (size / 2); x ++)
{
for (int z = - (size / 2); z <= (size / 2); z ++)
{
for (int y = size - (size / 3); y <= size + (size / 3); y++)
{
if (x + xlocation >= 0 && x + xlocation < worldWidth && z + zlocation >= 0 && z + zlocation < worldDepth && y + ylocation >= 0 && y + ylocation < worldHeight)
{
if (abs(x) == (size / 2) && abs(y) == size + (size / 3)|| abs(z) == (size / 2) && abs(y) == size + (size / 3))
{
}
else
{
if (treetype <= 2)
world[x + xlocation][z + zlocation][y + ylocation] = Block{ 52, 52 };
else
world[x + xlocation][z + zlocation][y + ylocation] = Block{ 132, 132 };
}
}
}
}
}
}
void display()
{
glClearColor(0.6f, 0.6f, 1, 1);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0f, (float)width/height, 0.5, 300);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef(camera.rotX, 1, 0, 0);
glRotatef(camera.rotY, 0, 1, 0);
glTranslatef(camera.posX, camera.posY, camera.posZ);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, blocksTexture);
for (int x = 0; x < worldWidth; x++)
{
for (int z = 0; z < worldDepth; z++)
{
for (int y = 0; y < worldHeight; y++)
{
if (world[x][z][y].textureSide == -1)
continue;
glPushMatrix();
glTranslatef((float)x*blockSize, (float)y*blockSize, (float)z*blockSize);
drawCube(world[x][z][y].textureTop, world[x][z][y].textureSide);
glPopMatrix();
}
}
}
glDisable(GL_TEXTURE_2D);
glutSwapBuffers();
}
void gravity(float direction, float fac)
{
int blockx = (int)(camera.posX / -blockSize);
int blockz = (int)(camera.posZ / -blockSize);
if (blockx >= worldWidth || blockx <= 0 || blockz >= worldDepth || blockz <= 0)
return;
for (int y = 0; y < worldHeight; y++)
{
if (world[blockx][blockz][y].textureTop == -1)
{
float newpos = ((y - 1) + eyeheight) * -blockSize;
if (newpos >= lastypos - blockSize)
{
camera.posY = newpos;
lastypos = newpos;
}
break;
}
}
}
void move(float angle, float fac)
{
camera.posX += (float)cos((camera.rotY + angle) / 180 * M_PI) * fac;
camera.posZ += (float)sin((camera.rotY + angle) / 180 * M_PI) * fac;
}
void moveZ(float direction, float fac)
{
camera.posY += (fac * direction);
}
void idle()
{
float frameTime = glutGet(GLUT_ELAPSED_TIME)/1000.0f;
float deltaTime = frameTime - lastFrameTime;
float g = -9.8;
lastFrameTime = frameTime;
gravity(-1, deltaTime*g);
if (keys['+']) speed += speed > 25 ? 0 : 0.5;
if (keys['-']) speed -= speed < 5 ? 0 : 0.5;
if (keys['a']) move(0, deltaTime*speed);
if (keys['d']) move(180, deltaTime*speed);
if (keys['w']) move(90, deltaTime*speed);
if (keys['s']) move(270, deltaTime*speed);
//if (keys['q']) moveZ(-1, deltaTime*speed);
//if (keys['e']) moveZ(1, deltaTime*speed);
glutPostRedisplay();
}
void mousePassiveMotion(int x, int y)
{
int dx = x - width / 2;
int dy = y - height / 2;
if ((dx != 0 || dy != 0) && abs(dx) < 400 && abs(dy) < 400)
{
camera.rotY += dx / 10.0f;
camera.rotX += dy / 10.0f;
glutWarpPointer(width / 2, height / 2);
}
}
void keyboard(unsigned char key, int, int)
{
if (key == 27)
exit(0);
keys[key] = true;
}
void keyboardUp(unsigned char key, int,int)
{
keys[key] = false;
}
void loadTexture()
{
//Load Textures :: blocks
int width2, height2, bpp2;
unsigned char* imgData2 = stbi_load("terrain.png", &width2, &height2, &bpp2, 4);
glGenTextures(1, &blocksTexture);
glBindTexture(GL_TEXTURE_2D, blocksTexture);
glTexImage2D(GL_TEXTURE_2D,
0, //level
GL_RGBA, //internal format
width2, //width
height2, //height
0, //border
GL_RGBA, //data format
GL_UNSIGNED_BYTE, //data type
imgData2); //data
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
stbi_image_free(imgData2);
}
int main(int argc, char* argv[])
{
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(800, 600);
glutInit(&argc, argv);
glutCreateWindow("Minecraft 2.0");
memset(keys, 0, sizeof(keys));
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.01f);
glutIdleFunc(idle);
glutDisplayFunc(display);
glutReshapeFunc([](int w, int h) { width = w; height = h; glViewport(0, 0, w, h); });
glutKeyboardFunc(keyboard);
glutKeyboardUpFunc(keyboardUp);
glutPassiveMotionFunc(mousePassiveMotion);
//Cursor
glutWarpPointer(width / 2, height / 2);
glutSetCursor(GLUT_CURSOR_NONE);
loadTexture();
generateWorld();
PlaySound(L"theme.wav", NULL, SND_ASYNC | SND_FILENAME | SND_LOOP);
glutMainLoop();
return 0;
}
+158
View File
@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A48AE72D-7CD7-4525-8917-81A5B2F50E2B}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>wk2_fps</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>freeglut/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>freeglut/lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>freeglut/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>freeglut/lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Main.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stb_image.h" />
<ClInclude Include="stb_perlin.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+30
View File
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stb_image.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="stb_perlin.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
Binary file not shown.
+27
View File
@@ -0,0 +1,27 @@
Freeglut Copyright
------------------
Freeglut code without an explicit copyright is covered by the following
copyright:
Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Pawel W. Olszta shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from Pawel W. Olszta.
+106
View File
@@ -0,0 +1,106 @@
freeglut 3.0.0-1.mp for MSVC
This package contains freeglut import libraries, headers, and Windows DLLs.
These allow 32 and 64 bit GLUT applications to be compiled on Windows using
Microsoft Visual C++.
For more information on freeglut, visit http://freeglut.sourceforge.net/.
Installation
Create a folder on your PC which is readable by all users, for example
“C:\Program Files\Common Files\MSVC\freeglut\” on a typical Windows system. Copy
the “lib\” and “include\” folders from this zip archive to that location.
The appropriate freeglut DLL can either be placed in the same folder as your
application, or can be installed in a system-wide folder which appears in your
%PATH% environment variable. Be careful not to mix the 32 bit DLL up with the 64
bit DLL, as they are not interchangeable.
Compiling 32 bit Applications
To create a 32 bit freeglut application, create a new Win32 C++ project in MSVC.
From the “Win32 Application Wizard”, choose a “Windows application”, check the
“Empty project” box, and submit.
Youll now need to configure the compiler and linker settings. Open up the
project properties, and select “All Configurations” (this is necessary to ensure
our changes are applied for both debug and release builds). Open up the
“general” section under “C/C++”, and configure the “include\” folder you created
above as an “Additional Include Directory”. If you have more than one GLUT
package which contains a “glut.h” file, its important to ensure that the
freeglut include folder appears above all other GLUT include folders.
Now open up the “general” section under “Linker”, and configure the “lib\”
folder you created above as an “Additional Library Directory”. A freeglut
application depends on the import libraries “freeglut.lib” and “opengl32.lib”,
which can be configured under the “Input” section. However, it shouldnt be
necessary to explicitly state these dependencies, since the freeglut headers
handle this for you. Now open the “Advanced” section, and enter “mainCRTStartup”
as the “Entry Point” for your application. This is necessary because GLUT
applications use “main” as the application entry point, not “WinMain”—without it
youll get an undefined reference when you try to link your application.
Thats all of your project properties configured, so you can now add source
files to your project and build the application. If you want your application to
be compatible with GLUT, you should “#include <GL/glut.h>”. If you want to use
freeglut specific extensions, you should “#include <GL/freeglut.h>” instead.
Dont forget to either include the freeglut DLL when distributing applications,
or provide your users with some method of obtaining it if they dont already
have it!
Compiling 64 bit Applications
Building 64 bit applications is almost identical to building 32 bit applications.
When you use the configuration manager to add the x64 platform, its easiest to
copy the settings from the Win32 platform. If you do so, its then only necessary
to change the “Additional Library Directories” configuration so that it
references the directory containing the 64 bit import library rather
than the 32 bit one.
Problems?
If you have problems using this package (compiler / linker errors etc.), please
check that you have followed all of the steps in this readme file correctly.
Almost all of the problems which are reported with these packages are due to
missing a step or not doing it correctly, for example trying to build a 32 bit
app against the 64 bit import library. If you have followed all of the steps
correctly but your application still fails to build, try building a very simple
but functional program (the example at
http://www.transmissionzero.co.uk/computing/using-glut-with-mingw/ works fine
with MSVC). A lot of people try to build very complex applications after
installing these packages, and often the error is with the application code or
other library dependencies rather than freeglut.
If you still cant get it working after trying to compile a simple application,
then please get in touch via http://www.transmissionzero.co.uk/contact/,
providing as much detail as you can. Please dont complain to the freeglut guys
unless youre sure its a freeglut bug, and have reproduced the issue after
compiling freeglut from the latest SVN version—if thats still the case, Im
sure they would appreciate a bug report or a patch.
Changelog
20150722: Release 3.0.0-2.mp
• Modified the freeglut_std.h file so that it doesnt try to link against the
freeglutd.lib import library.
20150315: Release 3.0.0-1.mp
• First 3.0.0 MSVC release. Ive built the package using Visual Studio 2013,
and the only change Ive made is to the DLL version resource—Ive changed
the description so that my MinGW and MSVC builds are distinguishable from
each other (and other builds) using Windows Explorer.
Transmission Zero
20150722
http://www.transmissionzero.co.uk/
+22
View File
@@ -0,0 +1,22 @@
#ifndef __FREEGLUT_H__
#define __FREEGLUT_H__
/*
* freeglut.h
*
* The freeglut library include file
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "freeglut_std.h"
#include "freeglut_ext.h"
/*** END OF FILE ***/
#endif /* __FREEGLUT_H__ */
+271
View File
@@ -0,0 +1,271 @@
#ifndef __FREEGLUT_EXT_H__
#define __FREEGLUT_EXT_H__
/*
* freeglut_ext.h
*
* The non-GLUT-compatible extensions to the freeglut library include file
*
* Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
* Written by Pawel W. Olszta, <olszta@sourceforge.net>
* Creation date: Thu Dec 2 1999
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Additional GLUT Key definitions for the Special key function
*/
#define GLUT_KEY_NUM_LOCK 0x006D
#define GLUT_KEY_BEGIN 0x006E
#define GLUT_KEY_DELETE 0x006F
#define GLUT_KEY_SHIFT_L 0x0070
#define GLUT_KEY_SHIFT_R 0x0071
#define GLUT_KEY_CTRL_L 0x0072
#define GLUT_KEY_CTRL_R 0x0073
#define GLUT_KEY_ALT_L 0x0074
#define GLUT_KEY_ALT_R 0x0075
/*
* GLUT API Extension macro definitions -- behaviour when the user clicks on an "x" to close a window
*/
#define GLUT_ACTION_EXIT 0
#define GLUT_ACTION_GLUTMAINLOOP_RETURNS 1
#define GLUT_ACTION_CONTINUE_EXECUTION 2
/*
* Create a new rendering context when the user opens a new window?
*/
#define GLUT_CREATE_NEW_CONTEXT 0
#define GLUT_USE_CURRENT_CONTEXT 1
/*
* Direct/Indirect rendering context options (has meaning only in Unix/X11)
*/
#define GLUT_FORCE_INDIRECT_CONTEXT 0
#define GLUT_ALLOW_DIRECT_CONTEXT 1
#define GLUT_TRY_DIRECT_CONTEXT 2
#define GLUT_FORCE_DIRECT_CONTEXT 3
/*
* GLUT API Extension macro definitions -- the glutGet parameters
*/
#define GLUT_INIT_STATE 0x007C
#define GLUT_ACTION_ON_WINDOW_CLOSE 0x01F9
#define GLUT_WINDOW_BORDER_WIDTH 0x01FA
#define GLUT_WINDOW_BORDER_HEIGHT 0x01FB
#define GLUT_WINDOW_HEADER_HEIGHT 0x01FB /* Docs say it should always have been GLUT_WINDOW_BORDER_HEIGHT, keep this for backward compatibility */
#define GLUT_VERSION 0x01FC
#define GLUT_RENDERING_CONTEXT 0x01FD
#define GLUT_DIRECT_RENDERING 0x01FE
#define GLUT_FULL_SCREEN 0x01FF
#define GLUT_SKIP_STALE_MOTION_EVENTS 0x0204
#define GLUT_GEOMETRY_VISUALIZE_NORMALS 0x0205
#define GLUT_STROKE_FONT_DRAW_JOIN_DOTS 0x0206 /* Draw dots between line segments of stroke fonts? */
/*
* New tokens for glutInitDisplayMode.
* Only one GLUT_AUXn bit may be used at a time.
* Value 0x0400 is defined in OpenGLUT.
*/
#define GLUT_AUX 0x1000
#define GLUT_AUX1 0x1000
#define GLUT_AUX2 0x2000
#define GLUT_AUX3 0x4000
#define GLUT_AUX4 0x8000
/*
* Context-related flags, see fg_state.c
* Set the requested OpenGL version
*/
#define GLUT_INIT_MAJOR_VERSION 0x0200
#define GLUT_INIT_MINOR_VERSION 0x0201
#define GLUT_INIT_FLAGS 0x0202
#define GLUT_INIT_PROFILE 0x0203
/*
* Flags for glutInitContextFlags, see fg_init.c
*/
#define GLUT_DEBUG 0x0001
#define GLUT_FORWARD_COMPATIBLE 0x0002
/*
* Flags for glutInitContextProfile, see fg_init.c
*/
#define GLUT_CORE_PROFILE 0x0001
#define GLUT_COMPATIBILITY_PROFILE 0x0002
/*
* Process loop function, see fg_main.c
*/
FGAPI void FGAPIENTRY glutMainLoopEvent( void );
FGAPI void FGAPIENTRY glutLeaveMainLoop( void );
FGAPI void FGAPIENTRY glutExit ( void );
/*
* Window management functions, see fg_window.c
*/
FGAPI void FGAPIENTRY glutFullScreenToggle( void );
FGAPI void FGAPIENTRY glutLeaveFullScreen( void );
/*
* Menu functions
*/
FGAPI void FGAPIENTRY glutSetMenuFont( int menuID, void* font );
/*
* Window-specific callback functions, see fg_callbacks.c
*/
FGAPI void FGAPIENTRY glutMouseWheelFunc( void (* callback)( int, int, int, int ) );
FGAPI void FGAPIENTRY glutPositionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutCloseFunc( void (* callback)( void ) );
FGAPI void FGAPIENTRY glutWMCloseFunc( void (* callback)( void ) );
/* And also a destruction callback for menus */
FGAPI void FGAPIENTRY glutMenuDestroyFunc( void (* callback)( void ) );
/*
* State setting and retrieval functions, see fg_state.c
*/
FGAPI void FGAPIENTRY glutSetOption ( GLenum option_flag, int value );
FGAPI int * FGAPIENTRY glutGetModeValues(GLenum mode, int * size);
/* A.Donev: User-data manipulation */
FGAPI void* FGAPIENTRY glutGetWindowData( void );
FGAPI void FGAPIENTRY glutSetWindowData(void* data);
FGAPI void* FGAPIENTRY glutGetMenuData( void );
FGAPI void FGAPIENTRY glutSetMenuData(void* data);
/*
* Font stuff, see fg_font.c
*/
FGAPI int FGAPIENTRY glutBitmapHeight( void* font );
FGAPI GLfloat FGAPIENTRY glutStrokeHeight( void* font );
FGAPI void FGAPIENTRY glutBitmapString( void* font, const unsigned char *string );
FGAPI void FGAPIENTRY glutStrokeString( void* font, const unsigned char *string );
/*
* Geometry functions, see fg_geometry.c
*/
FGAPI void FGAPIENTRY glutWireRhombicDodecahedron( void );
FGAPI void FGAPIENTRY glutSolidRhombicDodecahedron( void );
FGAPI void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, double offset[3], double scale );
FGAPI void FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, double offset[3], double scale );
FGAPI void FGAPIENTRY glutWireCylinder( double radius, double height, GLint slices, GLint stacks);
FGAPI void FGAPIENTRY glutSolidCylinder( double radius, double height, GLint slices, GLint stacks);
/*
* Rest of functions for rendering Newell's teaset, found in fg_teapot.c
* NB: front facing polygons have clockwise winding, not counter clockwise
*/
FGAPI void FGAPIENTRY glutWireTeacup( double size );
FGAPI void FGAPIENTRY glutSolidTeacup( double size );
FGAPI void FGAPIENTRY glutWireTeaspoon( double size );
FGAPI void FGAPIENTRY glutSolidTeaspoon( double size );
/*
* Extension functions, see fg_ext.c
*/
typedef void (*GLUTproc)();
FGAPI GLUTproc FGAPIENTRY glutGetProcAddress( const char *procName );
/*
* Multi-touch/multi-pointer extensions
*/
#define GLUT_HAS_MULTI 1
/* TODO: add device_id parameter,
cf. http://sourceforge.net/mailarchive/forum.php?thread_name=20120518071314.GA28061%40perso.beuc.net&forum_name=freeglut-developer */
FGAPI void FGAPIENTRY glutMultiEntryFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutMultiButtonFunc( void (* callback)( int, int, int, int, int ) );
FGAPI void FGAPIENTRY glutMultiMotionFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutMultiPassiveFunc( void (* callback)( int, int, int ) );
/*
* Joystick functions, see fg_joystick.c
*/
/* USE OF THESE FUNCTIONS IS DEPRECATED !!!!! */
/* If you have a serious need for these functions in your application, please either
* contact the "freeglut" developer community at freeglut-developer@lists.sourceforge.net,
* switch to the OpenGLUT library, or else port your joystick functionality over to PLIB's
* "js" library.
*/
int glutJoystickGetNumAxes( int ident );
int glutJoystickGetNumButtons( int ident );
int glutJoystickNotWorking( int ident );
float glutJoystickGetDeadBand( int ident, int axis );
void glutJoystickSetDeadBand( int ident, int axis, float db );
float glutJoystickGetSaturation( int ident, int axis );
void glutJoystickSetSaturation( int ident, int axis, float st );
void glutJoystickSetMinRange( int ident, float *axes );
void glutJoystickSetMaxRange( int ident, float *axes );
void glutJoystickSetCenter( int ident, float *axes );
void glutJoystickGetMinRange( int ident, float *axes );
void glutJoystickGetMaxRange( int ident, float *axes );
void glutJoystickGetCenter( int ident, float *axes );
/*
* Initialization functions, see fg_init.c
*/
/* to get the typedef for va_list */
#include <stdarg.h>
FGAPI void FGAPIENTRY glutInitContextVersion( int majorVersion, int minorVersion );
FGAPI void FGAPIENTRY glutInitContextFlags( int flags );
FGAPI void FGAPIENTRY glutInitContextProfile( int profile );
FGAPI void FGAPIENTRY glutInitErrorFunc( void (* callback)( const char *fmt, va_list ap ) );
FGAPI void FGAPIENTRY glutInitWarningFunc( void (* callback)( const char *fmt, va_list ap ) );
/* OpenGL >= 2.0 support */
FGAPI void FGAPIENTRY glutSetVertexAttribCoord3(GLint attrib);
FGAPI void FGAPIENTRY glutSetVertexAttribNormal(GLint attrib);
FGAPI void FGAPIENTRY glutSetVertexAttribTexCoord2(GLint attrib);
/* Mobile platforms lifecycle */
FGAPI void FGAPIENTRY glutInitContextFunc(void (* callback)());
FGAPI void FGAPIENTRY glutAppStatusFunc(void (* callback)(int));
/* state flags that can be passed to callback set by glutAppStatusFunc */
#define GLUT_APPSTATUS_PAUSE 0x0001
#define GLUT_APPSTATUS_RESUME 0x0002
/*
* GLUT API macro definitions -- the display mode definitions
*/
#define GLUT_CAPTIONLESS 0x0400
#define GLUT_BORDERLESS 0x0800
#define GLUT_SRGB 0x1000
#ifdef __cplusplus
}
#endif
/*** END OF FILE ***/
#endif /* __FREEGLUT_EXT_H__ */
+638
View File
@@ -0,0 +1,638 @@
#ifndef __FREEGLUT_STD_H__
#define __FREEGLUT_STD_H__
/*
* freeglut_std.h
*
* The GLUT-compatible part of the freeglut library include file
*
* Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
* Written by Pawel W. Olszta, <olszta@sourceforge.net>
* Creation date: Thu Dec 2 1999
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Under windows, we have to differentiate between static and dynamic libraries
*/
#ifdef _WIN32
/* #pragma may not be supported by some compilers.
* Discussion by FreeGLUT developers suggests that
* Visual C++ specific code involving pragmas may
* need to move to a separate header. 24th Dec 2003
*/
/* Define FREEGLUT_LIB_PRAGMAS to 1 to include library
* pragmas or to 0 to exclude library pragmas.
* The default behavior depends on the compiler/platform.
*/
# ifndef FREEGLUT_LIB_PRAGMAS
# if ( defined(_MSC_VER) || defined(__WATCOMC__) ) && !defined(_WIN32_WCE)
# define FREEGLUT_LIB_PRAGMAS 1
# else
# define FREEGLUT_LIB_PRAGMAS 0
# endif
# endif
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN 1
# endif
# ifndef NOMINMAX
# define NOMINMAX
# endif
# include <windows.h>
/* Windows static library */
# ifdef FREEGLUT_STATIC
#error Static linking is not supported with this build. Please remove the FREEGLUT_STATIC preprocessor directive, or download the source code from http://freeglut.sf.net/ and build against that.
/* Windows shared library (DLL) */
# else
# define FGAPIENTRY __stdcall
# if defined(FREEGLUT_EXPORTS)
# define FGAPI __declspec(dllexport)
# else
# define FGAPI __declspec(dllimport)
/* Link with Win32 shared freeglut lib */
# if FREEGLUT_LIB_PRAGMAS
# pragma comment (lib, "freeglut.lib")
# endif
# endif
# endif
/* Drag in other Windows libraries as required by FreeGLUT */
# if FREEGLUT_LIB_PRAGMAS
# pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */
# pragma comment (lib, "opengl32.lib") /* link Microsoft OpenGL lib */
# pragma comment (lib, "gdi32.lib") /* link Windows GDI lib */
# pragma comment (lib, "winmm.lib") /* link Windows MultiMedia lib */
# pragma comment (lib, "user32.lib") /* link Windows user lib */
# endif
#else
/* Non-Windows definition of FGAPI and FGAPIENTRY */
# define FGAPI
# define FGAPIENTRY
#endif
/*
* The freeglut and GLUT API versions
*/
#define FREEGLUT 1
#define GLUT_API_VERSION 4
#define GLUT_XLIB_IMPLEMENTATION 13
/* Deprecated:
cf. http://sourceforge.net/mailarchive/forum.php?thread_name=CABcAi1hw7cr4xtigckaGXB5X8wddLfMcbA_rZ3NAuwMrX_zmsw%40mail.gmail.com&forum_name=freeglut-developer */
#define FREEGLUT_VERSION_2_0 1
/*
* Always include OpenGL and GLU headers
*/
/* Note: FREEGLUT_GLES is only used to cleanly bootstrap headers
inclusion here; use GLES constants directly
(e.g. GL_ES_VERSION_2_0) for all other needs */
#ifdef FREEGLUT_GLES
# include <EGL/egl.h>
# include <GLES/gl.h>
# include <GLES2/gl2.h>
#elif __APPLE__
# include <OpenGL/gl.h>
# include <OpenGL/glu.h>
#else
# include <GL/gl.h>
# include <GL/glu.h>
#endif
/*
* GLUT API macro definitions -- the special key codes:
*/
#define GLUT_KEY_F1 0x0001
#define GLUT_KEY_F2 0x0002
#define GLUT_KEY_F3 0x0003
#define GLUT_KEY_F4 0x0004
#define GLUT_KEY_F5 0x0005
#define GLUT_KEY_F6 0x0006
#define GLUT_KEY_F7 0x0007
#define GLUT_KEY_F8 0x0008
#define GLUT_KEY_F9 0x0009
#define GLUT_KEY_F10 0x000A
#define GLUT_KEY_F11 0x000B
#define GLUT_KEY_F12 0x000C
#define GLUT_KEY_LEFT 0x0064
#define GLUT_KEY_UP 0x0065
#define GLUT_KEY_RIGHT 0x0066
#define GLUT_KEY_DOWN 0x0067
#define GLUT_KEY_PAGE_UP 0x0068
#define GLUT_KEY_PAGE_DOWN 0x0069
#define GLUT_KEY_HOME 0x006A
#define GLUT_KEY_END 0x006B
#define GLUT_KEY_INSERT 0x006C
/*
* GLUT API macro definitions -- mouse state definitions
*/
#define GLUT_LEFT_BUTTON 0x0000
#define GLUT_MIDDLE_BUTTON 0x0001
#define GLUT_RIGHT_BUTTON 0x0002
#define GLUT_DOWN 0x0000
#define GLUT_UP 0x0001
#define GLUT_LEFT 0x0000
#define GLUT_ENTERED 0x0001
/*
* GLUT API macro definitions -- the display mode definitions
*/
#define GLUT_RGB 0x0000
#define GLUT_RGBA 0x0000
#define GLUT_INDEX 0x0001
#define GLUT_SINGLE 0x0000
#define GLUT_DOUBLE 0x0002
#define GLUT_ACCUM 0x0004
#define GLUT_ALPHA 0x0008
#define GLUT_DEPTH 0x0010
#define GLUT_STENCIL 0x0020
#define GLUT_MULTISAMPLE 0x0080
#define GLUT_STEREO 0x0100
#define GLUT_LUMINANCE 0x0200
/*
* GLUT API macro definitions -- windows and menu related definitions
*/
#define GLUT_MENU_NOT_IN_USE 0x0000
#define GLUT_MENU_IN_USE 0x0001
#define GLUT_NOT_VISIBLE 0x0000
#define GLUT_VISIBLE 0x0001
#define GLUT_HIDDEN 0x0000
#define GLUT_FULLY_RETAINED 0x0001
#define GLUT_PARTIALLY_RETAINED 0x0002
#define GLUT_FULLY_COVERED 0x0003
/*
* GLUT API macro definitions -- fonts definitions
*
* Steve Baker suggested to make it binary compatible with GLUT:
*/
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__WATCOMC__)
# define GLUT_STROKE_ROMAN ((void *)0x0000)
# define GLUT_STROKE_MONO_ROMAN ((void *)0x0001)
# define GLUT_BITMAP_9_BY_15 ((void *)0x0002)
# define GLUT_BITMAP_8_BY_13 ((void *)0x0003)
# define GLUT_BITMAP_TIMES_ROMAN_10 ((void *)0x0004)
# define GLUT_BITMAP_TIMES_ROMAN_24 ((void *)0x0005)
# define GLUT_BITMAP_HELVETICA_10 ((void *)0x0006)
# define GLUT_BITMAP_HELVETICA_12 ((void *)0x0007)
# define GLUT_BITMAP_HELVETICA_18 ((void *)0x0008)
#else
/*
* I don't really know if it's a good idea... But here it goes:
*/
extern void* glutStrokeRoman;
extern void* glutStrokeMonoRoman;
extern void* glutBitmap9By15;
extern void* glutBitmap8By13;
extern void* glutBitmapTimesRoman10;
extern void* glutBitmapTimesRoman24;
extern void* glutBitmapHelvetica10;
extern void* glutBitmapHelvetica12;
extern void* glutBitmapHelvetica18;
/*
* Those pointers will be used by following definitions:
*/
# define GLUT_STROKE_ROMAN ((void *) &glutStrokeRoman)
# define GLUT_STROKE_MONO_ROMAN ((void *) &glutStrokeMonoRoman)
# define GLUT_BITMAP_9_BY_15 ((void *) &glutBitmap9By15)
# define GLUT_BITMAP_8_BY_13 ((void *) &glutBitmap8By13)
# define GLUT_BITMAP_TIMES_ROMAN_10 ((void *) &glutBitmapTimesRoman10)
# define GLUT_BITMAP_TIMES_ROMAN_24 ((void *) &glutBitmapTimesRoman24)
# define GLUT_BITMAP_HELVETICA_10 ((void *) &glutBitmapHelvetica10)
# define GLUT_BITMAP_HELVETICA_12 ((void *) &glutBitmapHelvetica12)
# define GLUT_BITMAP_HELVETICA_18 ((void *) &glutBitmapHelvetica18)
#endif
/*
* GLUT API macro definitions -- the glutGet parameters
*/
#define GLUT_WINDOW_X 0x0064
#define GLUT_WINDOW_Y 0x0065
#define GLUT_WINDOW_WIDTH 0x0066
#define GLUT_WINDOW_HEIGHT 0x0067
#define GLUT_WINDOW_BUFFER_SIZE 0x0068
#define GLUT_WINDOW_STENCIL_SIZE 0x0069
#define GLUT_WINDOW_DEPTH_SIZE 0x006A
#define GLUT_WINDOW_RED_SIZE 0x006B
#define GLUT_WINDOW_GREEN_SIZE 0x006C
#define GLUT_WINDOW_BLUE_SIZE 0x006D
#define GLUT_WINDOW_ALPHA_SIZE 0x006E
#define GLUT_WINDOW_ACCUM_RED_SIZE 0x006F
#define GLUT_WINDOW_ACCUM_GREEN_SIZE 0x0070
#define GLUT_WINDOW_ACCUM_BLUE_SIZE 0x0071
#define GLUT_WINDOW_ACCUM_ALPHA_SIZE 0x0072
#define GLUT_WINDOW_DOUBLEBUFFER 0x0073
#define GLUT_WINDOW_RGBA 0x0074
#define GLUT_WINDOW_PARENT 0x0075
#define GLUT_WINDOW_NUM_CHILDREN 0x0076
#define GLUT_WINDOW_COLORMAP_SIZE 0x0077
#define GLUT_WINDOW_NUM_SAMPLES 0x0078
#define GLUT_WINDOW_STEREO 0x0079
#define GLUT_WINDOW_CURSOR 0x007A
#define GLUT_SCREEN_WIDTH 0x00C8
#define GLUT_SCREEN_HEIGHT 0x00C9
#define GLUT_SCREEN_WIDTH_MM 0x00CA
#define GLUT_SCREEN_HEIGHT_MM 0x00CB
#define GLUT_MENU_NUM_ITEMS 0x012C
#define GLUT_DISPLAY_MODE_POSSIBLE 0x0190
#define GLUT_INIT_WINDOW_X 0x01F4
#define GLUT_INIT_WINDOW_Y 0x01F5
#define GLUT_INIT_WINDOW_WIDTH 0x01F6
#define GLUT_INIT_WINDOW_HEIGHT 0x01F7
#define GLUT_INIT_DISPLAY_MODE 0x01F8
#define GLUT_ELAPSED_TIME 0x02BC
#define GLUT_WINDOW_FORMAT_ID 0x007B
/*
* GLUT API macro definitions -- the glutDeviceGet parameters
*/
#define GLUT_HAS_KEYBOARD 0x0258
#define GLUT_HAS_MOUSE 0x0259
#define GLUT_HAS_SPACEBALL 0x025A
#define GLUT_HAS_DIAL_AND_BUTTON_BOX 0x025B
#define GLUT_HAS_TABLET 0x025C
#define GLUT_NUM_MOUSE_BUTTONS 0x025D
#define GLUT_NUM_SPACEBALL_BUTTONS 0x025E
#define GLUT_NUM_BUTTON_BOX_BUTTONS 0x025F
#define GLUT_NUM_DIALS 0x0260
#define GLUT_NUM_TABLET_BUTTONS 0x0261
#define GLUT_DEVICE_IGNORE_KEY_REPEAT 0x0262
#define GLUT_DEVICE_KEY_REPEAT 0x0263
#define GLUT_HAS_JOYSTICK 0x0264
#define GLUT_OWNS_JOYSTICK 0x0265
#define GLUT_JOYSTICK_BUTTONS 0x0266
#define GLUT_JOYSTICK_AXES 0x0267
#define GLUT_JOYSTICK_POLL_RATE 0x0268
/*
* GLUT API macro definitions -- the glutLayerGet parameters
*/
#define GLUT_OVERLAY_POSSIBLE 0x0320
#define GLUT_LAYER_IN_USE 0x0321
#define GLUT_HAS_OVERLAY 0x0322
#define GLUT_TRANSPARENT_INDEX 0x0323
#define GLUT_NORMAL_DAMAGED 0x0324
#define GLUT_OVERLAY_DAMAGED 0x0325
/*
* GLUT API macro definitions -- the glutVideoResizeGet parameters
*/
#define GLUT_VIDEO_RESIZE_POSSIBLE 0x0384
#define GLUT_VIDEO_RESIZE_IN_USE 0x0385
#define GLUT_VIDEO_RESIZE_X_DELTA 0x0386
#define GLUT_VIDEO_RESIZE_Y_DELTA 0x0387
#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 0x0388
#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 0x0389
#define GLUT_VIDEO_RESIZE_X 0x038A
#define GLUT_VIDEO_RESIZE_Y 0x038B
#define GLUT_VIDEO_RESIZE_WIDTH 0x038C
#define GLUT_VIDEO_RESIZE_HEIGHT 0x038D
/*
* GLUT API macro definitions -- the glutUseLayer parameters
*/
#define GLUT_NORMAL 0x0000
#define GLUT_OVERLAY 0x0001
/*
* GLUT API macro definitions -- the glutGetModifiers parameters
*/
#define GLUT_ACTIVE_SHIFT 0x0001
#define GLUT_ACTIVE_CTRL 0x0002
#define GLUT_ACTIVE_ALT 0x0004
/*
* GLUT API macro definitions -- the glutSetCursor parameters
*/
#define GLUT_CURSOR_RIGHT_ARROW 0x0000
#define GLUT_CURSOR_LEFT_ARROW 0x0001
#define GLUT_CURSOR_INFO 0x0002
#define GLUT_CURSOR_DESTROY 0x0003
#define GLUT_CURSOR_HELP 0x0004
#define GLUT_CURSOR_CYCLE 0x0005
#define GLUT_CURSOR_SPRAY 0x0006
#define GLUT_CURSOR_WAIT 0x0007
#define GLUT_CURSOR_TEXT 0x0008
#define GLUT_CURSOR_CROSSHAIR 0x0009
#define GLUT_CURSOR_UP_DOWN 0x000A
#define GLUT_CURSOR_LEFT_RIGHT 0x000B
#define GLUT_CURSOR_TOP_SIDE 0x000C
#define GLUT_CURSOR_BOTTOM_SIDE 0x000D
#define GLUT_CURSOR_LEFT_SIDE 0x000E
#define GLUT_CURSOR_RIGHT_SIDE 0x000F
#define GLUT_CURSOR_TOP_LEFT_CORNER 0x0010
#define GLUT_CURSOR_TOP_RIGHT_CORNER 0x0011
#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 0x0012
#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 0x0013
#define GLUT_CURSOR_INHERIT 0x0064
#define GLUT_CURSOR_NONE 0x0065
#define GLUT_CURSOR_FULL_CROSSHAIR 0x0066
/*
* GLUT API macro definitions -- RGB color component specification definitions
*/
#define GLUT_RED 0x0000
#define GLUT_GREEN 0x0001
#define GLUT_BLUE 0x0002
/*
* GLUT API macro definitions -- additional keyboard and joystick definitions
*/
#define GLUT_KEY_REPEAT_OFF 0x0000
#define GLUT_KEY_REPEAT_ON 0x0001
#define GLUT_KEY_REPEAT_DEFAULT 0x0002
#define GLUT_JOYSTICK_BUTTON_A 0x0001
#define GLUT_JOYSTICK_BUTTON_B 0x0002
#define GLUT_JOYSTICK_BUTTON_C 0x0004
#define GLUT_JOYSTICK_BUTTON_D 0x0008
/*
* GLUT API macro definitions -- game mode definitions
*/
#define GLUT_GAME_MODE_ACTIVE 0x0000
#define GLUT_GAME_MODE_POSSIBLE 0x0001
#define GLUT_GAME_MODE_WIDTH 0x0002
#define GLUT_GAME_MODE_HEIGHT 0x0003
#define GLUT_GAME_MODE_PIXEL_DEPTH 0x0004
#define GLUT_GAME_MODE_REFRESH_RATE 0x0005
#define GLUT_GAME_MODE_DISPLAY_CHANGED 0x0006
/*
* Initialization functions, see fglut_init.c
*/
FGAPI void FGAPIENTRY glutInit( int* pargc, char** argv );
FGAPI void FGAPIENTRY glutInitWindowPosition( int x, int y );
FGAPI void FGAPIENTRY glutInitWindowSize( int width, int height );
FGAPI void FGAPIENTRY glutInitDisplayMode( unsigned int displayMode );
FGAPI void FGAPIENTRY glutInitDisplayString( const char* displayMode );
/*
* Process loop function, see fg_main.c
*/
FGAPI void FGAPIENTRY glutMainLoop( void );
/*
* Window management functions, see fg_window.c
*/
FGAPI int FGAPIENTRY glutCreateWindow( const char* title );
FGAPI int FGAPIENTRY glutCreateSubWindow( int window, int x, int y, int width, int height );
FGAPI void FGAPIENTRY glutDestroyWindow( int window );
FGAPI void FGAPIENTRY glutSetWindow( int window );
FGAPI int FGAPIENTRY glutGetWindow( void );
FGAPI void FGAPIENTRY glutSetWindowTitle( const char* title );
FGAPI void FGAPIENTRY glutSetIconTitle( const char* title );
FGAPI void FGAPIENTRY glutReshapeWindow( int width, int height );
FGAPI void FGAPIENTRY glutPositionWindow( int x, int y );
FGAPI void FGAPIENTRY glutShowWindow( void );
FGAPI void FGAPIENTRY glutHideWindow( void );
FGAPI void FGAPIENTRY glutIconifyWindow( void );
FGAPI void FGAPIENTRY glutPushWindow( void );
FGAPI void FGAPIENTRY glutPopWindow( void );
FGAPI void FGAPIENTRY glutFullScreen( void );
/*
* Display-related functions, see fg_display.c
*/
FGAPI void FGAPIENTRY glutPostWindowRedisplay( int window );
FGAPI void FGAPIENTRY glutPostRedisplay( void );
FGAPI void FGAPIENTRY glutSwapBuffers( void );
/*
* Mouse cursor functions, see fg_cursor.c
*/
FGAPI void FGAPIENTRY glutWarpPointer( int x, int y );
FGAPI void FGAPIENTRY glutSetCursor( int cursor );
/*
* Overlay stuff, see fg_overlay.c
*/
FGAPI void FGAPIENTRY glutEstablishOverlay( void );
FGAPI void FGAPIENTRY glutRemoveOverlay( void );
FGAPI void FGAPIENTRY glutUseLayer( GLenum layer );
FGAPI void FGAPIENTRY glutPostOverlayRedisplay( void );
FGAPI void FGAPIENTRY glutPostWindowOverlayRedisplay( int window );
FGAPI void FGAPIENTRY glutShowOverlay( void );
FGAPI void FGAPIENTRY glutHideOverlay( void );
/*
* Menu stuff, see fg_menu.c
*/
FGAPI int FGAPIENTRY glutCreateMenu( void (* callback)( int menu ) );
FGAPI void FGAPIENTRY glutDestroyMenu( int menu );
FGAPI int FGAPIENTRY glutGetMenu( void );
FGAPI void FGAPIENTRY glutSetMenu( int menu );
FGAPI void FGAPIENTRY glutAddMenuEntry( const char* label, int value );
FGAPI void FGAPIENTRY glutAddSubMenu( const char* label, int subMenu );
FGAPI void FGAPIENTRY glutChangeToMenuEntry( int item, const char* label, int value );
FGAPI void FGAPIENTRY glutChangeToSubMenu( int item, const char* label, int value );
FGAPI void FGAPIENTRY glutRemoveMenuItem( int item );
FGAPI void FGAPIENTRY glutAttachMenu( int button );
FGAPI void FGAPIENTRY glutDetachMenu( int button );
/*
* Global callback functions, see fg_callbacks.c
*/
FGAPI void FGAPIENTRY glutTimerFunc( unsigned int time, void (* callback)( int ), int value );
FGAPI void FGAPIENTRY glutIdleFunc( void (* callback)( void ) );
/*
* Window-specific callback functions, see fg_callbacks.c
*/
FGAPI void FGAPIENTRY glutKeyboardFunc( void (* callback)( unsigned char, int, int ) );
FGAPI void FGAPIENTRY glutSpecialFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutReshapeFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutVisibilityFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutDisplayFunc( void (* callback)( void ) );
FGAPI void FGAPIENTRY glutMouseFunc( void (* callback)( int, int, int, int ) );
FGAPI void FGAPIENTRY glutMotionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutPassiveMotionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutEntryFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutKeyboardUpFunc( void (* callback)( unsigned char, int, int ) );
FGAPI void FGAPIENTRY glutSpecialUpFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutJoystickFunc( void (* callback)( unsigned int, int, int, int ), int pollInterval );
FGAPI void FGAPIENTRY glutMenuStateFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutMenuStatusFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutOverlayDisplayFunc( void (* callback)( void ) );
FGAPI void FGAPIENTRY glutWindowStatusFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutSpaceballMotionFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutSpaceballRotateFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutSpaceballButtonFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutButtonBoxFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutDialsFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutTabletMotionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutTabletButtonFunc( void (* callback)( int, int, int, int ) );
/*
* State setting and retrieval functions, see fg_state.c
*/
FGAPI int FGAPIENTRY glutGet( GLenum query );
FGAPI int FGAPIENTRY glutDeviceGet( GLenum query );
FGAPI int FGAPIENTRY glutGetModifiers( void );
FGAPI int FGAPIENTRY glutLayerGet( GLenum query );
/*
* Font stuff, see fg_font.c
*/
FGAPI void FGAPIENTRY glutBitmapCharacter( void* font, int character );
FGAPI int FGAPIENTRY glutBitmapWidth( void* font, int character );
FGAPI void FGAPIENTRY glutStrokeCharacter( void* font, int character );
FGAPI int FGAPIENTRY glutStrokeWidth( void* font, int character );
FGAPI GLfloat FGAPIENTRY glutStrokeWidthf( void* font, int character ); /* GLUT 3.8 */
FGAPI int FGAPIENTRY glutBitmapLength( void* font, const unsigned char* string );
FGAPI int FGAPIENTRY glutStrokeLength( void* font, const unsigned char* string );
FGAPI GLfloat FGAPIENTRY glutStrokeLengthf( void* font, const unsigned char *string ); /* GLUT 3.8 */
/*
* Geometry functions, see fg_geometry.c
*/
FGAPI void FGAPIENTRY glutWireCube( double size );
FGAPI void FGAPIENTRY glutSolidCube( double size );
FGAPI void FGAPIENTRY glutWireSphere( double radius, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutSolidSphere( double radius, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutWireCone( double base, double height, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutSolidCone( double base, double height, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutWireTorus( double innerRadius, double outerRadius, GLint sides, GLint rings );
FGAPI void FGAPIENTRY glutSolidTorus( double innerRadius, double outerRadius, GLint sides, GLint rings );
FGAPI void FGAPIENTRY glutWireDodecahedron( void );
FGAPI void FGAPIENTRY glutSolidDodecahedron( void );
FGAPI void FGAPIENTRY glutWireOctahedron( void );
FGAPI void FGAPIENTRY glutSolidOctahedron( void );
FGAPI void FGAPIENTRY glutWireTetrahedron( void );
FGAPI void FGAPIENTRY glutSolidTetrahedron( void );
FGAPI void FGAPIENTRY glutWireIcosahedron( void );
FGAPI void FGAPIENTRY glutSolidIcosahedron( void );
/*
* Teapot rendering functions, found in fg_teapot.c
* NB: front facing polygons have clockwise winding, not counter clockwise
*/
FGAPI void FGAPIENTRY glutWireTeapot( double size );
FGAPI void FGAPIENTRY glutSolidTeapot( double size );
/*
* Game mode functions, see fg_gamemode.c
*/
FGAPI void FGAPIENTRY glutGameModeString( const char* string );
FGAPI int FGAPIENTRY glutEnterGameMode( void );
FGAPI void FGAPIENTRY glutLeaveGameMode( void );
FGAPI int FGAPIENTRY glutGameModeGet( GLenum query );
/*
* Video resize functions, see fg_videoresize.c
*/
FGAPI int FGAPIENTRY glutVideoResizeGet( GLenum query );
FGAPI void FGAPIENTRY glutSetupVideoResizing( void );
FGAPI void FGAPIENTRY glutStopVideoResizing( void );
FGAPI void FGAPIENTRY glutVideoResize( int x, int y, int width, int height );
FGAPI void FGAPIENTRY glutVideoPan( int x, int y, int width, int height );
/*
* Colormap functions, see fg_misc.c
*/
FGAPI void FGAPIENTRY glutSetColor( int color, GLfloat red, GLfloat green, GLfloat blue );
FGAPI GLfloat FGAPIENTRY glutGetColor( int color, int component );
FGAPI void FGAPIENTRY glutCopyColormap( int window );
/*
* Misc keyboard and joystick functions, see fg_misc.c
*/
FGAPI void FGAPIENTRY glutIgnoreKeyRepeat( int ignore );
FGAPI void FGAPIENTRY glutSetKeyRepeat( int repeatMode );
FGAPI void FGAPIENTRY glutForceJoystickFunc( void );
/*
* Misc functions, see fg_misc.c
*/
FGAPI int FGAPIENTRY glutExtensionSupported( const char* extension );
FGAPI void FGAPIENTRY glutReportErrors( void );
/* Comment from glut.h of classic GLUT:
Win32 has an annoying issue where there are multiple C run-time
libraries (CRTs). If the executable is linked with a different CRT
from the GLUT DLL, the GLUT DLL will not share the same CRT static
data seen by the executable. In particular, atexit callbacks registered
in the executable will not be called if GLUT calls its (different)
exit routine). GLUT is typically built with the
"/MD" option (the CRT with multithreading DLL support), but the Visual
C++ linker default is "/ML" (the single threaded CRT).
One workaround to this issue is requiring users to always link with
the same CRT as GLUT is compiled with. That requires users supply a
non-standard option. GLUT 3.7 has its own built-in workaround where
the executable's "exit" function pointer is covertly passed to GLUT.
GLUT then calls the executable's exit function pointer to ensure that
any "atexit" calls registered by the application are called if GLUT
needs to exit.
Note that the __glut*WithExit routines should NEVER be called directly.
To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */
/* to get the prototype for exit() */
#include <stdlib.h>
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) && !defined(__WATCOMC__)
FGAPI void FGAPIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
FGAPI int FGAPIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int));
FGAPI int FGAPIENTRY __glutCreateMenuWithExit(void (* func)(int), void (__cdecl *exitfunc)(int));
#ifndef FREEGLUT_BUILDING_LIB
#if defined(__GNUC__)
#define FGUNUSED __attribute__((unused))
#else
#define FGUNUSED
#endif
static void FGAPIENTRY FGUNUSED glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); }
#define glutInit glutInit_ATEXIT_HACK
static int FGAPIENTRY FGUNUSED glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); }
#define glutCreateWindow glutCreateWindow_ATEXIT_HACK
static int FGAPIENTRY FGUNUSED glutCreateMenu_ATEXIT_HACK(void (* func)(int)) { return __glutCreateMenuWithExit(func, exit); }
#define glutCreateMenu glutCreateMenu_ATEXIT_HACK
#endif
#endif
#ifdef __cplusplus
}
#endif
/*** END OF FILE ***/
#endif /* __FREEGLUT_STD_H__ */
+21
View File
@@ -0,0 +1,21 @@
#ifndef __GLUT_H__
#define __GLUT_H__
/*
* glut.h
*
* The freeglut library include file
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "freeglut_std.h"
/*** END OF FILE ***/
#endif /* __GLUT_H__ */
Binary file not shown.
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

+6755
View File
File diff suppressed because it is too large Load Diff
+182
View File
@@ -0,0 +1,182 @@
// stb_perlin.h - v0.2 - perlin noise
// public domain single-file C implementation by Sean Barrett
//
// LICENSE
//
// This software is dual-licensed to the public domain and under the following
// license: you are granted a perpetual, irrevocable license to copy, modify,
// publish, and distribute this file as you see fit.
//
//
// to create the implementation,
// #define STB_PERLIN_IMPLEMENTATION
// in *one* C/CPP file that includes this file.
// Documentation:
//
// float stb_perlin_noise3( float x,
// float y,
// float z,
// int x_wrap=0,
// int y_wrap=0,
// int z_wrap=0)
//
// This function computes a random value at the coordinate (x,y,z).
// Adjacent random values are continuous but the noise fluctuates
// its randomness with period 1, i.e. takes on wholly unrelated values
// at integer points. Specifically, this implements Ken Perlin's
// revised noise function from 2002.
//
// The "wrap" parameters can be used to create wraparound noise that
// wraps at powers of two. The numbers MUST be powers of two. Specify
// 0 to mean "don't care". (The noise always wraps every 256 due
// details of the implementation, even if you ask for larger or no
// wrapping.)
#ifdef __cplusplus
extern "C" float stb_perlin_noise3(float x, float y, float z, int x_wrap=0, int y_wrap=0, int z_wrap=0);
#else
extern float stb_perlin_noise3(float x, float y, float z, int x_wrap, int y_wrap, int z_wrap);
#endif
#ifdef STB_PERLIN_IMPLEMENTATION
#include <math.h> // floor()
// not same permutation table as Perlin's reference to avoid copyright issues;
// Perlin's table can be found at http://mrl.nyu.edu/~perlin/noise/
// @OPTIMIZE: should this be unsigned char instead of int for cache?
static int stb__perlin_randtab[512] =
{
23, 125, 161, 52, 103, 117, 70, 37, 247, 101, 203, 169, 124, 126, 44, 123,
152, 238, 145, 45, 171, 114, 253, 10, 192, 136, 4, 157, 249, 30, 35, 72,
175, 63, 77, 90, 181, 16, 96, 111, 133, 104, 75, 162, 93, 56, 66, 240,
8, 50, 84, 229, 49, 210, 173, 239, 141, 1, 87, 18, 2, 198, 143, 57,
225, 160, 58, 217, 168, 206, 245, 204, 199, 6, 73, 60, 20, 230, 211, 233,
94, 200, 88, 9, 74, 155, 33, 15, 219, 130, 226, 202, 83, 236, 42, 172,
165, 218, 55, 222, 46, 107, 98, 154, 109, 67, 196, 178, 127, 158, 13, 243,
65, 79, 166, 248, 25, 224, 115, 80, 68, 51, 184, 128, 232, 208, 151, 122,
26, 212, 105, 43, 179, 213, 235, 148, 146, 89, 14, 195, 28, 78, 112, 76,
250, 47, 24, 251, 140, 108, 186, 190, 228, 170, 183, 139, 39, 188, 244, 246,
132, 48, 119, 144, 180, 138, 134, 193, 82, 182, 120, 121, 86, 220, 209, 3,
91, 241, 149, 85, 205, 150, 113, 216, 31, 100, 41, 164, 177, 214, 153, 231,
38, 71, 185, 174, 97, 201, 29, 95, 7, 92, 54, 254, 191, 118, 34, 221,
131, 11, 163, 99, 234, 81, 227, 147, 156, 176, 17, 142, 69, 12, 110, 62,
27, 255, 0, 194, 59, 116, 242, 252, 19, 21, 187, 53, 207, 129, 64, 135,
61, 40, 167, 237, 102, 223, 106, 159, 197, 189, 215, 137, 36, 32, 22, 5,
// and a second copy so we don't need an extra mask or static initializer
23, 125, 161, 52, 103, 117, 70, 37, 247, 101, 203, 169, 124, 126, 44, 123,
152, 238, 145, 45, 171, 114, 253, 10, 192, 136, 4, 157, 249, 30, 35, 72,
175, 63, 77, 90, 181, 16, 96, 111, 133, 104, 75, 162, 93, 56, 66, 240,
8, 50, 84, 229, 49, 210, 173, 239, 141, 1, 87, 18, 2, 198, 143, 57,
225, 160, 58, 217, 168, 206, 245, 204, 199, 6, 73, 60, 20, 230, 211, 233,
94, 200, 88, 9, 74, 155, 33, 15, 219, 130, 226, 202, 83, 236, 42, 172,
165, 218, 55, 222, 46, 107, 98, 154, 109, 67, 196, 178, 127, 158, 13, 243,
65, 79, 166, 248, 25, 224, 115, 80, 68, 51, 184, 128, 232, 208, 151, 122,
26, 212, 105, 43, 179, 213, 235, 148, 146, 89, 14, 195, 28, 78, 112, 76,
250, 47, 24, 251, 140, 108, 186, 190, 228, 170, 183, 139, 39, 188, 244, 246,
132, 48, 119, 144, 180, 138, 134, 193, 82, 182, 120, 121, 86, 220, 209, 3,
91, 241, 149, 85, 205, 150, 113, 216, 31, 100, 41, 164, 177, 214, 153, 231,
38, 71, 185, 174, 97, 201, 29, 95, 7, 92, 54, 254, 191, 118, 34, 221,
131, 11, 163, 99, 234, 81, 227, 147, 156, 176, 17, 142, 69, 12, 110, 62,
27, 255, 0, 194, 59, 116, 242, 252, 19, 21, 187, 53, 207, 129, 64, 135,
61, 40, 167, 237, 102, 223, 106, 159, 197, 189, 215, 137, 36, 32, 22, 5,
};
static float stb__perlin_lerp(float a, float b, float t)
{
return a + (b-a) * t;
}
// different grad function from Perlin's, but easy to modify to match reference
static float stb__perlin_grad(int hash, float x, float y, float z)
{
static float basis[12][4] =
{
{ 1, 1, 0 },
{ -1, 1, 0 },
{ 1,-1, 0 },
{ -1,-1, 0 },
{ 1, 0, 1 },
{ -1, 0, 1 },
{ 1, 0,-1 },
{ -1, 0,-1 },
{ 0, 1, 1 },
{ 0,-1, 1 },
{ 0, 1,-1 },
{ 0,-1,-1 },
};
// perlin's gradient has 12 cases so some get used 1/16th of the time
// and some 2/16ths. We reduce bias by changing those fractions
// to 5/16ths and 6/16ths, and the same 4 cases get the extra weight.
static unsigned char indices[64] =
{
0,1,2,3,4,5,6,7,8,9,10,11,
0,9,1,11,
0,1,2,3,4,5,6,7,8,9,10,11,
0,1,2,3,4,5,6,7,8,9,10,11,
0,1,2,3,4,5,6,7,8,9,10,11,
0,1,2,3,4,5,6,7,8,9,10,11,
};
// if you use reference permutation table, change 63 below to 15 to match reference
float *grad = basis[indices[hash & 63]];
return grad[0]*x + grad[1]*y + grad[2]*z;
}
float stb_perlin_noise3(float x, float y, float z, int x_wrap, int y_wrap, int z_wrap)
{
float u,v,w;
float n000,n001,n010,n011,n100,n101,n110,n111;
float n00,n01,n10,n11;
float n0,n1;
unsigned int x_mask = (x_wrap-1) & 255;
unsigned int y_mask = (y_wrap-1) & 255;
unsigned int z_mask = (z_wrap-1) & 255;
int px = (int) floor(x);
int py = (int) floor(y);
int pz = (int) floor(z);
int x0 = px & x_mask, x1 = (px+1) & x_mask;
int y0 = py & y_mask, y1 = (py+1) & y_mask;
int z0 = pz & z_mask, z1 = (pz+1) & z_mask;
int r0,r1, r00,r01,r10,r11;
#define stb__perlin_ease(a) (((a*6-15)*a + 10) * a * a * a)
x -= px; u = stb__perlin_ease(x);
y -= py; v = stb__perlin_ease(y);
z -= pz; w = stb__perlin_ease(z);
r0 = stb__perlin_randtab[x0];
r1 = stb__perlin_randtab[x1];
r00 = stb__perlin_randtab[r0+y0];
r01 = stb__perlin_randtab[r0+y1];
r10 = stb__perlin_randtab[r1+y0];
r11 = stb__perlin_randtab[r1+y1];
n000 = stb__perlin_grad(stb__perlin_randtab[r00+z0], x , y , z );
n001 = stb__perlin_grad(stb__perlin_randtab[r00+z1], x , y , z-1 );
n010 = stb__perlin_grad(stb__perlin_randtab[r01+z0], x , y-1, z );
n011 = stb__perlin_grad(stb__perlin_randtab[r01+z1], x , y-1, z-1 );
n100 = stb__perlin_grad(stb__perlin_randtab[r10+z0], x-1, y , z );
n101 = stb__perlin_grad(stb__perlin_randtab[r10+z1], x-1, y , z-1 );
n110 = stb__perlin_grad(stb__perlin_randtab[r11+z0], x-1, y-1, z );
n111 = stb__perlin_grad(stb__perlin_randtab[r11+z1], x-1, y-1, z-1 );
n00 = stb__perlin_lerp(n000,n001,w);
n01 = stb__perlin_lerp(n010,n011,w);
n10 = stb__perlin_lerp(n100,n101,w);
n11 = stb__perlin_lerp(n110,n111,w);
n0 = stb__perlin_lerp(n00,n01,v);
n1 = stb__perlin_lerp(n10,n11,v);
return stb__perlin_lerp(n0,n1,u);
}
#endif // STB_PERLIN_IMPLEMENTATION
Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

BIN
View File
Binary file not shown.
+326
View File
@@ -0,0 +1,326 @@
#include "ObjModel.h"
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
std::string replace(std::string str, std::string toReplace, std::string replacement)
{
size_t index = 0;
while (true)
{
index = str.find(toReplace, index);
if (index == std::string::npos)
break;
str.replace(index, toReplace.length(), replacement);
++index;
}
return str;
}
std::vector<std::string> split(std::string str, std::string sep)
{
std::vector<std::string> ret;
size_t index;
while(true)
{
index = str.find(sep);
if(index == std::string::npos)
break;
ret.push_back(str.substr(0, index));
str = str.substr(index+1);
}
ret.push_back(str);
return ret;
}
inline std::string toLower(std::string data)
{
std::transform(data.begin(), data.end(), data.begin(), ::tolower);
return data;
}
ObjModel::ObjModel(std::string fileName)
{
std::string dirName = fileName;
if(dirName.rfind("/") != std::string::npos)
dirName = dirName.substr(0, dirName.rfind("/"));
if(dirName.rfind("\\") != std::string::npos)
dirName = dirName.substr(0, dirName.rfind("\\"));
if(fileName == dirName)
dirName = "";
std::ifstream pFile(fileName.c_str());
if (!pFile.is_open())
{
std::cout << "Could not open file " << fileName << std::endl;
return;
}
ObjGroup* currentGroup = new ObjGroup();
currentGroup->materialIndex = -1;
while(!pFile.eof())
{
std::string line;
std::getline(pFile, line);
line = replace(line, "\t", " ");
while(line.find(" ") != std::string::npos)
line = replace(line, " ", " ");
if(line == "")
continue;
if(line[0] == ' ')
line = line.substr(1);
if(line == "")
continue;
if(line[line.length()-1] == ' ')
line = line.substr(0, line.length()-1);
if(line == "")
continue;
if(line[0] == '#')
continue;
std::vector<std::string> params = split(line, " ");
params[0] = toLower(params[0]);
if(params[0] == "v")
vertices.push_back(Vec3f((float)atof(params[1].c_str()), (float)atof(params[2].c_str()), (float)atof(params[3].c_str())));
else if(params[0] == "vn")
normals.push_back(Vec3f((float)atof(params[1].c_str()), (float)atof(params[2].c_str()), (float)atof(params[3].c_str())));
else if(params[0] == "vt")
texcoords.push_back(Vec2f((float)atof(params[1].c_str()), (float)atof(params[2].c_str())));
else if(params[0] == "f")
{
for(size_t ii = 4; ii <= params.size(); ii++)
{
Face face;
for(size_t i = ii-3; i < ii; i++) //magische forlus om van quads triangles te maken ;)
{
Vertex vertex;
std::vector<std::string> indices = split(params[i == (ii-3) ? 1 : i], "/");
if (indices.size() >= 1) //er is een positie
vertex.position = atoi(indices[0].c_str()) - 1;
if(indices.size() == 2) //alleen texture
vertex.texcoord = atoi(indices[1].c_str())-1;
if(indices.size() == 3) //v/t/n of v//n
{
if( indices[1] != "")
vertex.texcoord = atoi(indices[1].c_str())-1;
vertex.normal = atoi(indices[2].c_str())-1;
}
face.vertices.push_back(vertex);
}
currentGroup->faces.push_back(face);
}
}
else if(params[0] == "s")
{//smoothing
}
else if(params[0] == "mtllib")
{
loadMaterialFile(dirName + "/" + params[1], dirName);
}
else if(params[0] == "usemtl")
{
if(currentGroup->faces.size() != 0)
groups.push_back(currentGroup);
currentGroup = new ObjGroup();
currentGroup->materialIndex = -1;
for(size_t i = 0; i < materials.size(); i++)
{
MaterialInfo* info = materials[i];
if(info->name == params[1])
{
currentGroup->materialIndex = i;
break;
}
}
if(currentGroup->materialIndex == -1)
std::cout<<"Could not find material name "<<params[1]<<std::endl;
}
}
groups.push_back(currentGroup);
}
ObjModel::~ObjModel(void)
{
}
void ObjModel::draw()
{
for(auto &g : groups)
{
if (materials[g->materialIndex]->hasTexture)
{
glEnable(GL_TEXTURE_2D);
materials[g->materialIndex]->texture->bind();
}
glBegin(GL_TRIANGLES);
for(auto &f : g->faces)
{
for(auto &v : f.vertices)
{
glNormal3f(normals[v.normal].x, normals[v.normal].y, normals[v.normal].z);
glTexCoord2f(texcoords[v.texcoord].x, texcoords[v.texcoord].y);
glVertex3f(vertices[v.position].x, vertices[v.position].y, vertices[v.position].z);
}
}
glEnd();
}
}
void ObjModel::loadMaterialFile( std::string fileName, std::string dirName )
{
std::ifstream pFile(fileName.c_str());
if (!pFile.is_open())
{
std::cout << "Could not open file " << fileName << std::endl;
return;
}
MaterialInfo* currentMaterial = NULL;
while(!pFile.eof())
{
std::string line;
std::getline(pFile, line);
line = replace(line, "\t", " ");
while(line.find(" ") != std::string::npos)
line = replace(line, " ", " ");
if(line == "")
continue;
if(line[0] == ' ')
line = line.substr(1);
if(line == "")
continue;
if(line[line.length()-1] == ' ')
line = line.substr(0, line.length()-1);
if(line == "")
continue;
if(line[0] == '#')
continue;
std::vector<std::string> params = split(line, " ");
params[0] = toLower(params[0]);
if(params[0] == "newmtl")
{
if(currentMaterial != NULL)
{
materials.push_back(currentMaterial);
}
currentMaterial = new MaterialInfo();
currentMaterial->name = params[1];
}
else if(params[0] == "map_kd")
{
currentMaterial->hasTexture = true;
currentMaterial->texture = new Texture(dirName + "/" + params[1]);
}
else
std::cout<<"Didn't parse "<<params[0]<<" in material file"<<std::endl;
}
if(currentMaterial != NULL)
materials.push_back(currentMaterial);
}
ObjModel::MaterialInfo::MaterialInfo()
{
Texture *texture;
hasTexture = false;
}
Vec3f::Vec3f(float x, float y, float z)
{
this->x = x;
this->y = y;
this->z = z;
}
Vec3f::Vec3f()
{
this->x = 0;
this->y = 0;
this->z = 0;
}
Vec3f::Vec3f(Vec3f &other)
{
this->x = other.x;
this->y = other.y;
this->z = other.z;
}
float& Vec3f::operator [](int index)
{
return v[index];
}
Vec2f::Vec2f(float x, float y)
{
this->x = x;
this->y = y;
}
Vec2f::Vec2f()
{
this->x = 0;
this->y = 0;
}
Vec2f::Vec2f(Vec2f &other)
{
this->x = other.x;
this->y = other.y;
}
float& Vec2f::operator [](int index)
{
return v[index];
}
ObjModel::Texture::Texture(const std::string & fileName)
{
int width, height, bpp;
stbi_set_flip_vertically_on_load(true);
unsigned char* imgData = stbi_load(fileName.c_str(), &width, &height, &bpp, 4);
glGenTextures(1, &index);
glBindTexture(GL_TEXTURE_2D, index);
glTexImage2D(GL_TEXTURE_2D,
0, //level
GL_RGBA, //internal format
width, //width
height, //height
0, //border
GL_RGBA, //data format
GL_UNSIGNED_BYTE, //data type
imgData); //data
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
stbi_image_free(imgData);
}
void ObjModel::Texture::bind()
{
glBindTexture(GL_TEXTURE_2D, index);
}
+101
View File
@@ -0,0 +1,101 @@
#pragma once
#include <string>
#include <vector>
#include <list>
#include <windows.h>
#include <gl/GL.h>
using namespace std;
class Vec3f
{
public:
union
{
struct
{
float x,y,z;
};
float v[3];
};
Vec3f();
Vec3f(Vec3f &other);
Vec3f(float x, float y, float z);
float& operator [](int);
};
class Vec2f
{
public:
union
{
struct
{
float x,y;
};
float v[2];
};
Vec2f();
Vec2f(float x, float y);
Vec2f(Vec2f &other);
float& operator [](int);
};
class ObjModel
{
private:
class Vertex
{
public:
int position;
int normal;
int texcoord;
};
class Face
{
public:
list<Vertex> vertices;
};
class Texture
{
GLuint index;
public:
Texture(const std::string &fileName);
void bind();
};
class MaterialInfo
{
public:
MaterialInfo();
std::string name;
Texture* texture;
bool hasTexture;
};
class ObjGroup
{
public:
std::string name;
int materialIndex;
list<Face> faces;
};
std::vector<Vec3f> vertices;
std::vector<Vec3f> normals;
std::vector<Vec2f> texcoords;
std::vector<ObjGroup*> groups;
std::vector<MaterialInfo*> materials;
void loadMaterialFile(std::string fileName, std::string dirName);
public:
ObjModel(std::string filename);
~ObjModel(void);
void draw();
};
+94
View File
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7FE0B211-D231-442F-BEDA-60613B8B1F9D}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>OpenGL</RootNamespace>
<ProjectName>OpenGL3</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>freeglut\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>freeglut\lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>freeglut\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>freeglut\lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
<ClCompile Include="ObjModel.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="ObjModel.h" />
<ClInclude Include="stb_image.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+33
View File
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ObjModel.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="ObjModel.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="stb_image.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
Binary file not shown.
+27
View File
@@ -0,0 +1,27 @@
Freeglut Copyright
------------------
Freeglut code without an explicit copyright is covered by the following
copyright:
Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Pawel W. Olszta shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from Pawel W. Olszta.
+106
View File
@@ -0,0 +1,106 @@
freeglut 3.0.0-1.mp for MSVC
This package contains freeglut import libraries, headers, and Windows DLLs.
These allow 32 and 64 bit GLUT applications to be compiled on Windows using
Microsoft Visual C++.
For more information on freeglut, visit http://freeglut.sourceforge.net/.
Installation
Create a folder on your PC which is readable by all users, for example
“C:\Program Files\Common Files\MSVC\freeglut\” on a typical Windows system. Copy
the “lib\” and “include\” folders from this zip archive to that location.
The appropriate freeglut DLL can either be placed in the same folder as your
application, or can be installed in a system-wide folder which appears in your
%PATH% environment variable. Be careful not to mix the 32 bit DLL up with the 64
bit DLL, as they are not interchangeable.
Compiling 32 bit Applications
To create a 32 bit freeglut application, create a new Win32 C++ project in MSVC.
From the “Win32 Application Wizard”, choose a “Windows application”, check the
“Empty project” box, and submit.
Youll now need to configure the compiler and linker settings. Open up the
project properties, and select “All Configurations” (this is necessary to ensure
our changes are applied for both debug and release builds). Open up the
“general” section under “C/C++”, and configure the “include\” folder you created
above as an “Additional Include Directory”. If you have more than one GLUT
package which contains a “glut.h” file, its important to ensure that the
freeglut include folder appears above all other GLUT include folders.
Now open up the “general” section under “Linker”, and configure the “lib\”
folder you created above as an “Additional Library Directory”. A freeglut
application depends on the import libraries “freeglut.lib” and “opengl32.lib”,
which can be configured under the “Input” section. However, it shouldnt be
necessary to explicitly state these dependencies, since the freeglut headers
handle this for you. Now open the “Advanced” section, and enter “mainCRTStartup”
as the “Entry Point” for your application. This is necessary because GLUT
applications use “main” as the application entry point, not “WinMain”—without it
youll get an undefined reference when you try to link your application.
Thats all of your project properties configured, so you can now add source
files to your project and build the application. If you want your application to
be compatible with GLUT, you should “#include <GL/glut.h>”. If you want to use
freeglut specific extensions, you should “#include <GL/freeglut.h>” instead.
Dont forget to either include the freeglut DLL when distributing applications,
or provide your users with some method of obtaining it if they dont already
have it!
Compiling 64 bit Applications
Building 64 bit applications is almost identical to building 32 bit applications.
When you use the configuration manager to add the x64 platform, its easiest to
copy the settings from the Win32 platform. If you do so, its then only necessary
to change the “Additional Library Directories” configuration so that it
references the directory containing the 64 bit import library rather
than the 32 bit one.
Problems?
If you have problems using this package (compiler / linker errors etc.), please
check that you have followed all of the steps in this readme file correctly.
Almost all of the problems which are reported with these packages are due to
missing a step or not doing it correctly, for example trying to build a 32 bit
app against the 64 bit import library. If you have followed all of the steps
correctly but your application still fails to build, try building a very simple
but functional program (the example at
http://www.transmissionzero.co.uk/computing/using-glut-with-mingw/ works fine
with MSVC). A lot of people try to build very complex applications after
installing these packages, and often the error is with the application code or
other library dependencies rather than freeglut.
If you still cant get it working after trying to compile a simple application,
then please get in touch via http://www.transmissionzero.co.uk/contact/,
providing as much detail as you can. Please dont complain to the freeglut guys
unless youre sure its a freeglut bug, and have reproduced the issue after
compiling freeglut from the latest SVN version—if thats still the case, Im
sure they would appreciate a bug report or a patch.
Changelog
20150722: Release 3.0.0-2.mp
• Modified the freeglut_std.h file so that it doesnt try to link against the
freeglutd.lib import library.
20150315: Release 3.0.0-1.mp
• First 3.0.0 MSVC release. Ive built the package using Visual Studio 2013,
and the only change Ive made is to the DLL version resource—Ive changed
the description so that my MinGW and MSVC builds are distinguishable from
each other (and other builds) using Windows Explorer.
Transmission Zero
20150722
http://www.transmissionzero.co.uk/
+22
View File
@@ -0,0 +1,22 @@
#ifndef __FREEGLUT_H__
#define __FREEGLUT_H__
/*
* freeglut.h
*
* The freeglut library include file
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "freeglut_std.h"
#include "freeglut_ext.h"
/*** END OF FILE ***/
#endif /* __FREEGLUT_H__ */
+271
View File
@@ -0,0 +1,271 @@
#ifndef __FREEGLUT_EXT_H__
#define __FREEGLUT_EXT_H__
/*
* freeglut_ext.h
*
* The non-GLUT-compatible extensions to the freeglut library include file
*
* Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
* Written by Pawel W. Olszta, <olszta@sourceforge.net>
* Creation date: Thu Dec 2 1999
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Additional GLUT Key definitions for the Special key function
*/
#define GLUT_KEY_NUM_LOCK 0x006D
#define GLUT_KEY_BEGIN 0x006E
#define GLUT_KEY_DELETE 0x006F
#define GLUT_KEY_SHIFT_L 0x0070
#define GLUT_KEY_SHIFT_R 0x0071
#define GLUT_KEY_CTRL_L 0x0072
#define GLUT_KEY_CTRL_R 0x0073
#define GLUT_KEY_ALT_L 0x0074
#define GLUT_KEY_ALT_R 0x0075
/*
* GLUT API Extension macro definitions -- behaviour when the user clicks on an "x" to close a window
*/
#define GLUT_ACTION_EXIT 0
#define GLUT_ACTION_GLUTMAINLOOP_RETURNS 1
#define GLUT_ACTION_CONTINUE_EXECUTION 2
/*
* Create a new rendering context when the user opens a new window?
*/
#define GLUT_CREATE_NEW_CONTEXT 0
#define GLUT_USE_CURRENT_CONTEXT 1
/*
* Direct/Indirect rendering context options (has meaning only in Unix/X11)
*/
#define GLUT_FORCE_INDIRECT_CONTEXT 0
#define GLUT_ALLOW_DIRECT_CONTEXT 1
#define GLUT_TRY_DIRECT_CONTEXT 2
#define GLUT_FORCE_DIRECT_CONTEXT 3
/*
* GLUT API Extension macro definitions -- the glutGet parameters
*/
#define GLUT_INIT_STATE 0x007C
#define GLUT_ACTION_ON_WINDOW_CLOSE 0x01F9
#define GLUT_WINDOW_BORDER_WIDTH 0x01FA
#define GLUT_WINDOW_BORDER_HEIGHT 0x01FB
#define GLUT_WINDOW_HEADER_HEIGHT 0x01FB /* Docs say it should always have been GLUT_WINDOW_BORDER_HEIGHT, keep this for backward compatibility */
#define GLUT_VERSION 0x01FC
#define GLUT_RENDERING_CONTEXT 0x01FD
#define GLUT_DIRECT_RENDERING 0x01FE
#define GLUT_FULL_SCREEN 0x01FF
#define GLUT_SKIP_STALE_MOTION_EVENTS 0x0204
#define GLUT_GEOMETRY_VISUALIZE_NORMALS 0x0205
#define GLUT_STROKE_FONT_DRAW_JOIN_DOTS 0x0206 /* Draw dots between line segments of stroke fonts? */
/*
* New tokens for glutInitDisplayMode.
* Only one GLUT_AUXn bit may be used at a time.
* Value 0x0400 is defined in OpenGLUT.
*/
#define GLUT_AUX 0x1000
#define GLUT_AUX1 0x1000
#define GLUT_AUX2 0x2000
#define GLUT_AUX3 0x4000
#define GLUT_AUX4 0x8000
/*
* Context-related flags, see fg_state.c
* Set the requested OpenGL version
*/
#define GLUT_INIT_MAJOR_VERSION 0x0200
#define GLUT_INIT_MINOR_VERSION 0x0201
#define GLUT_INIT_FLAGS 0x0202
#define GLUT_INIT_PROFILE 0x0203
/*
* Flags for glutInitContextFlags, see fg_init.c
*/
#define GLUT_DEBUG 0x0001
#define GLUT_FORWARD_COMPATIBLE 0x0002
/*
* Flags for glutInitContextProfile, see fg_init.c
*/
#define GLUT_CORE_PROFILE 0x0001
#define GLUT_COMPATIBILITY_PROFILE 0x0002
/*
* Process loop function, see fg_main.c
*/
FGAPI void FGAPIENTRY glutMainLoopEvent( void );
FGAPI void FGAPIENTRY glutLeaveMainLoop( void );
FGAPI void FGAPIENTRY glutExit ( void );
/*
* Window management functions, see fg_window.c
*/
FGAPI void FGAPIENTRY glutFullScreenToggle( void );
FGAPI void FGAPIENTRY glutLeaveFullScreen( void );
/*
* Menu functions
*/
FGAPI void FGAPIENTRY glutSetMenuFont( int menuID, void* font );
/*
* Window-specific callback functions, see fg_callbacks.c
*/
FGAPI void FGAPIENTRY glutMouseWheelFunc( void (* callback)( int, int, int, int ) );
FGAPI void FGAPIENTRY glutPositionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutCloseFunc( void (* callback)( void ) );
FGAPI void FGAPIENTRY glutWMCloseFunc( void (* callback)( void ) );
/* And also a destruction callback for menus */
FGAPI void FGAPIENTRY glutMenuDestroyFunc( void (* callback)( void ) );
/*
* State setting and retrieval functions, see fg_state.c
*/
FGAPI void FGAPIENTRY glutSetOption ( GLenum option_flag, int value );
FGAPI int * FGAPIENTRY glutGetModeValues(GLenum mode, int * size);
/* A.Donev: User-data manipulation */
FGAPI void* FGAPIENTRY glutGetWindowData( void );
FGAPI void FGAPIENTRY glutSetWindowData(void* data);
FGAPI void* FGAPIENTRY glutGetMenuData( void );
FGAPI void FGAPIENTRY glutSetMenuData(void* data);
/*
* Font stuff, see fg_font.c
*/
FGAPI int FGAPIENTRY glutBitmapHeight( void* font );
FGAPI GLfloat FGAPIENTRY glutStrokeHeight( void* font );
FGAPI void FGAPIENTRY glutBitmapString( void* font, const unsigned char *string );
FGAPI void FGAPIENTRY glutStrokeString( void* font, const unsigned char *string );
/*
* Geometry functions, see fg_geometry.c
*/
FGAPI void FGAPIENTRY glutWireRhombicDodecahedron( void );
FGAPI void FGAPIENTRY glutSolidRhombicDodecahedron( void );
FGAPI void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, double offset[3], double scale );
FGAPI void FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, double offset[3], double scale );
FGAPI void FGAPIENTRY glutWireCylinder( double radius, double height, GLint slices, GLint stacks);
FGAPI void FGAPIENTRY glutSolidCylinder( double radius, double height, GLint slices, GLint stacks);
/*
* Rest of functions for rendering Newell's teaset, found in fg_teapot.c
* NB: front facing polygons have clockwise winding, not counter clockwise
*/
FGAPI void FGAPIENTRY glutWireTeacup( double size );
FGAPI void FGAPIENTRY glutSolidTeacup( double size );
FGAPI void FGAPIENTRY glutWireTeaspoon( double size );
FGAPI void FGAPIENTRY glutSolidTeaspoon( double size );
/*
* Extension functions, see fg_ext.c
*/
typedef void (*GLUTproc)();
FGAPI GLUTproc FGAPIENTRY glutGetProcAddress( const char *procName );
/*
* Multi-touch/multi-pointer extensions
*/
#define GLUT_HAS_MULTI 1
/* TODO: add device_id parameter,
cf. http://sourceforge.net/mailarchive/forum.php?thread_name=20120518071314.GA28061%40perso.beuc.net&forum_name=freeglut-developer */
FGAPI void FGAPIENTRY glutMultiEntryFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutMultiButtonFunc( void (* callback)( int, int, int, int, int ) );
FGAPI void FGAPIENTRY glutMultiMotionFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutMultiPassiveFunc( void (* callback)( int, int, int ) );
/*
* Joystick functions, see fg_joystick.c
*/
/* USE OF THESE FUNCTIONS IS DEPRECATED !!!!! */
/* If you have a serious need for these functions in your application, please either
* contact the "freeglut" developer community at freeglut-developer@lists.sourceforge.net,
* switch to the OpenGLUT library, or else port your joystick functionality over to PLIB's
* "js" library.
*/
int glutJoystickGetNumAxes( int ident );
int glutJoystickGetNumButtons( int ident );
int glutJoystickNotWorking( int ident );
float glutJoystickGetDeadBand( int ident, int axis );
void glutJoystickSetDeadBand( int ident, int axis, float db );
float glutJoystickGetSaturation( int ident, int axis );
void glutJoystickSetSaturation( int ident, int axis, float st );
void glutJoystickSetMinRange( int ident, float *axes );
void glutJoystickSetMaxRange( int ident, float *axes );
void glutJoystickSetCenter( int ident, float *axes );
void glutJoystickGetMinRange( int ident, float *axes );
void glutJoystickGetMaxRange( int ident, float *axes );
void glutJoystickGetCenter( int ident, float *axes );
/*
* Initialization functions, see fg_init.c
*/
/* to get the typedef for va_list */
#include <stdarg.h>
FGAPI void FGAPIENTRY glutInitContextVersion( int majorVersion, int minorVersion );
FGAPI void FGAPIENTRY glutInitContextFlags( int flags );
FGAPI void FGAPIENTRY glutInitContextProfile( int profile );
FGAPI void FGAPIENTRY glutInitErrorFunc( void (* callback)( const char *fmt, va_list ap ) );
FGAPI void FGAPIENTRY glutInitWarningFunc( void (* callback)( const char *fmt, va_list ap ) );
/* OpenGL >= 2.0 support */
FGAPI void FGAPIENTRY glutSetVertexAttribCoord3(GLint attrib);
FGAPI void FGAPIENTRY glutSetVertexAttribNormal(GLint attrib);
FGAPI void FGAPIENTRY glutSetVertexAttribTexCoord2(GLint attrib);
/* Mobile platforms lifecycle */
FGAPI void FGAPIENTRY glutInitContextFunc(void (* callback)());
FGAPI void FGAPIENTRY glutAppStatusFunc(void (* callback)(int));
/* state flags that can be passed to callback set by glutAppStatusFunc */
#define GLUT_APPSTATUS_PAUSE 0x0001
#define GLUT_APPSTATUS_RESUME 0x0002
/*
* GLUT API macro definitions -- the display mode definitions
*/
#define GLUT_CAPTIONLESS 0x0400
#define GLUT_BORDERLESS 0x0800
#define GLUT_SRGB 0x1000
#ifdef __cplusplus
}
#endif
/*** END OF FILE ***/
#endif /* __FREEGLUT_EXT_H__ */
+638
View File
@@ -0,0 +1,638 @@
#ifndef __FREEGLUT_STD_H__
#define __FREEGLUT_STD_H__
/*
* freeglut_std.h
*
* The GLUT-compatible part of the freeglut library include file
*
* Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
* Written by Pawel W. Olszta, <olszta@sourceforge.net>
* Creation date: Thu Dec 2 1999
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Under windows, we have to differentiate between static and dynamic libraries
*/
#ifdef _WIN32
/* #pragma may not be supported by some compilers.
* Discussion by FreeGLUT developers suggests that
* Visual C++ specific code involving pragmas may
* need to move to a separate header. 24th Dec 2003
*/
/* Define FREEGLUT_LIB_PRAGMAS to 1 to include library
* pragmas or to 0 to exclude library pragmas.
* The default behavior depends on the compiler/platform.
*/
# ifndef FREEGLUT_LIB_PRAGMAS
# if ( defined(_MSC_VER) || defined(__WATCOMC__) ) && !defined(_WIN32_WCE)
# define FREEGLUT_LIB_PRAGMAS 1
# else
# define FREEGLUT_LIB_PRAGMAS 0
# endif
# endif
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN 1
# endif
# ifndef NOMINMAX
# define NOMINMAX
# endif
# include <windows.h>
/* Windows static library */
# ifdef FREEGLUT_STATIC
#error Static linking is not supported with this build. Please remove the FREEGLUT_STATIC preprocessor directive, or download the source code from http://freeglut.sf.net/ and build against that.
/* Windows shared library (DLL) */
# else
# define FGAPIENTRY __stdcall
# if defined(FREEGLUT_EXPORTS)
# define FGAPI __declspec(dllexport)
# else
# define FGAPI __declspec(dllimport)
/* Link with Win32 shared freeglut lib */
# if FREEGLUT_LIB_PRAGMAS
# pragma comment (lib, "freeglut.lib")
# endif
# endif
# endif
/* Drag in other Windows libraries as required by FreeGLUT */
# if FREEGLUT_LIB_PRAGMAS
# pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */
# pragma comment (lib, "opengl32.lib") /* link Microsoft OpenGL lib */
# pragma comment (lib, "gdi32.lib") /* link Windows GDI lib */
# pragma comment (lib, "winmm.lib") /* link Windows MultiMedia lib */
# pragma comment (lib, "user32.lib") /* link Windows user lib */
# endif
#else
/* Non-Windows definition of FGAPI and FGAPIENTRY */
# define FGAPI
# define FGAPIENTRY
#endif
/*
* The freeglut and GLUT API versions
*/
#define FREEGLUT 1
#define GLUT_API_VERSION 4
#define GLUT_XLIB_IMPLEMENTATION 13
/* Deprecated:
cf. http://sourceforge.net/mailarchive/forum.php?thread_name=CABcAi1hw7cr4xtigckaGXB5X8wddLfMcbA_rZ3NAuwMrX_zmsw%40mail.gmail.com&forum_name=freeglut-developer */
#define FREEGLUT_VERSION_2_0 1
/*
* Always include OpenGL and GLU headers
*/
/* Note: FREEGLUT_GLES is only used to cleanly bootstrap headers
inclusion here; use GLES constants directly
(e.g. GL_ES_VERSION_2_0) for all other needs */
#ifdef FREEGLUT_GLES
# include <EGL/egl.h>
# include <GLES/gl.h>
# include <GLES2/gl2.h>
#elif __APPLE__
# include <OpenGL/gl.h>
# include <OpenGL/glu.h>
#else
# include <GL/gl.h>
# include <GL/glu.h>
#endif
/*
* GLUT API macro definitions -- the special key codes:
*/
#define GLUT_KEY_F1 0x0001
#define GLUT_KEY_F2 0x0002
#define GLUT_KEY_F3 0x0003
#define GLUT_KEY_F4 0x0004
#define GLUT_KEY_F5 0x0005
#define GLUT_KEY_F6 0x0006
#define GLUT_KEY_F7 0x0007
#define GLUT_KEY_F8 0x0008
#define GLUT_KEY_F9 0x0009
#define GLUT_KEY_F10 0x000A
#define GLUT_KEY_F11 0x000B
#define GLUT_KEY_F12 0x000C
#define GLUT_KEY_LEFT 0x0064
#define GLUT_KEY_UP 0x0065
#define GLUT_KEY_RIGHT 0x0066
#define GLUT_KEY_DOWN 0x0067
#define GLUT_KEY_PAGE_UP 0x0068
#define GLUT_KEY_PAGE_DOWN 0x0069
#define GLUT_KEY_HOME 0x006A
#define GLUT_KEY_END 0x006B
#define GLUT_KEY_INSERT 0x006C
/*
* GLUT API macro definitions -- mouse state definitions
*/
#define GLUT_LEFT_BUTTON 0x0000
#define GLUT_MIDDLE_BUTTON 0x0001
#define GLUT_RIGHT_BUTTON 0x0002
#define GLUT_DOWN 0x0000
#define GLUT_UP 0x0001
#define GLUT_LEFT 0x0000
#define GLUT_ENTERED 0x0001
/*
* GLUT API macro definitions -- the display mode definitions
*/
#define GLUT_RGB 0x0000
#define GLUT_RGBA 0x0000
#define GLUT_INDEX 0x0001
#define GLUT_SINGLE 0x0000
#define GLUT_DOUBLE 0x0002
#define GLUT_ACCUM 0x0004
#define GLUT_ALPHA 0x0008
#define GLUT_DEPTH 0x0010
#define GLUT_STENCIL 0x0020
#define GLUT_MULTISAMPLE 0x0080
#define GLUT_STEREO 0x0100
#define GLUT_LUMINANCE 0x0200
/*
* GLUT API macro definitions -- windows and menu related definitions
*/
#define GLUT_MENU_NOT_IN_USE 0x0000
#define GLUT_MENU_IN_USE 0x0001
#define GLUT_NOT_VISIBLE 0x0000
#define GLUT_VISIBLE 0x0001
#define GLUT_HIDDEN 0x0000
#define GLUT_FULLY_RETAINED 0x0001
#define GLUT_PARTIALLY_RETAINED 0x0002
#define GLUT_FULLY_COVERED 0x0003
/*
* GLUT API macro definitions -- fonts definitions
*
* Steve Baker suggested to make it binary compatible with GLUT:
*/
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__WATCOMC__)
# define GLUT_STROKE_ROMAN ((void *)0x0000)
# define GLUT_STROKE_MONO_ROMAN ((void *)0x0001)
# define GLUT_BITMAP_9_BY_15 ((void *)0x0002)
# define GLUT_BITMAP_8_BY_13 ((void *)0x0003)
# define GLUT_BITMAP_TIMES_ROMAN_10 ((void *)0x0004)
# define GLUT_BITMAP_TIMES_ROMAN_24 ((void *)0x0005)
# define GLUT_BITMAP_HELVETICA_10 ((void *)0x0006)
# define GLUT_BITMAP_HELVETICA_12 ((void *)0x0007)
# define GLUT_BITMAP_HELVETICA_18 ((void *)0x0008)
#else
/*
* I don't really know if it's a good idea... But here it goes:
*/
extern void* glutStrokeRoman;
extern void* glutStrokeMonoRoman;
extern void* glutBitmap9By15;
extern void* glutBitmap8By13;
extern void* glutBitmapTimesRoman10;
extern void* glutBitmapTimesRoman24;
extern void* glutBitmapHelvetica10;
extern void* glutBitmapHelvetica12;
extern void* glutBitmapHelvetica18;
/*
* Those pointers will be used by following definitions:
*/
# define GLUT_STROKE_ROMAN ((void *) &glutStrokeRoman)
# define GLUT_STROKE_MONO_ROMAN ((void *) &glutStrokeMonoRoman)
# define GLUT_BITMAP_9_BY_15 ((void *) &glutBitmap9By15)
# define GLUT_BITMAP_8_BY_13 ((void *) &glutBitmap8By13)
# define GLUT_BITMAP_TIMES_ROMAN_10 ((void *) &glutBitmapTimesRoman10)
# define GLUT_BITMAP_TIMES_ROMAN_24 ((void *) &glutBitmapTimesRoman24)
# define GLUT_BITMAP_HELVETICA_10 ((void *) &glutBitmapHelvetica10)
# define GLUT_BITMAP_HELVETICA_12 ((void *) &glutBitmapHelvetica12)
# define GLUT_BITMAP_HELVETICA_18 ((void *) &glutBitmapHelvetica18)
#endif
/*
* GLUT API macro definitions -- the glutGet parameters
*/
#define GLUT_WINDOW_X 0x0064
#define GLUT_WINDOW_Y 0x0065
#define GLUT_WINDOW_WIDTH 0x0066
#define GLUT_WINDOW_HEIGHT 0x0067
#define GLUT_WINDOW_BUFFER_SIZE 0x0068
#define GLUT_WINDOW_STENCIL_SIZE 0x0069
#define GLUT_WINDOW_DEPTH_SIZE 0x006A
#define GLUT_WINDOW_RED_SIZE 0x006B
#define GLUT_WINDOW_GREEN_SIZE 0x006C
#define GLUT_WINDOW_BLUE_SIZE 0x006D
#define GLUT_WINDOW_ALPHA_SIZE 0x006E
#define GLUT_WINDOW_ACCUM_RED_SIZE 0x006F
#define GLUT_WINDOW_ACCUM_GREEN_SIZE 0x0070
#define GLUT_WINDOW_ACCUM_BLUE_SIZE 0x0071
#define GLUT_WINDOW_ACCUM_ALPHA_SIZE 0x0072
#define GLUT_WINDOW_DOUBLEBUFFER 0x0073
#define GLUT_WINDOW_RGBA 0x0074
#define GLUT_WINDOW_PARENT 0x0075
#define GLUT_WINDOW_NUM_CHILDREN 0x0076
#define GLUT_WINDOW_COLORMAP_SIZE 0x0077
#define GLUT_WINDOW_NUM_SAMPLES 0x0078
#define GLUT_WINDOW_STEREO 0x0079
#define GLUT_WINDOW_CURSOR 0x007A
#define GLUT_SCREEN_WIDTH 0x00C8
#define GLUT_SCREEN_HEIGHT 0x00C9
#define GLUT_SCREEN_WIDTH_MM 0x00CA
#define GLUT_SCREEN_HEIGHT_MM 0x00CB
#define GLUT_MENU_NUM_ITEMS 0x012C
#define GLUT_DISPLAY_MODE_POSSIBLE 0x0190
#define GLUT_INIT_WINDOW_X 0x01F4
#define GLUT_INIT_WINDOW_Y 0x01F5
#define GLUT_INIT_WINDOW_WIDTH 0x01F6
#define GLUT_INIT_WINDOW_HEIGHT 0x01F7
#define GLUT_INIT_DISPLAY_MODE 0x01F8
#define GLUT_ELAPSED_TIME 0x02BC
#define GLUT_WINDOW_FORMAT_ID 0x007B
/*
* GLUT API macro definitions -- the glutDeviceGet parameters
*/
#define GLUT_HAS_KEYBOARD 0x0258
#define GLUT_HAS_MOUSE 0x0259
#define GLUT_HAS_SPACEBALL 0x025A
#define GLUT_HAS_DIAL_AND_BUTTON_BOX 0x025B
#define GLUT_HAS_TABLET 0x025C
#define GLUT_NUM_MOUSE_BUTTONS 0x025D
#define GLUT_NUM_SPACEBALL_BUTTONS 0x025E
#define GLUT_NUM_BUTTON_BOX_BUTTONS 0x025F
#define GLUT_NUM_DIALS 0x0260
#define GLUT_NUM_TABLET_BUTTONS 0x0261
#define GLUT_DEVICE_IGNORE_KEY_REPEAT 0x0262
#define GLUT_DEVICE_KEY_REPEAT 0x0263
#define GLUT_HAS_JOYSTICK 0x0264
#define GLUT_OWNS_JOYSTICK 0x0265
#define GLUT_JOYSTICK_BUTTONS 0x0266
#define GLUT_JOYSTICK_AXES 0x0267
#define GLUT_JOYSTICK_POLL_RATE 0x0268
/*
* GLUT API macro definitions -- the glutLayerGet parameters
*/
#define GLUT_OVERLAY_POSSIBLE 0x0320
#define GLUT_LAYER_IN_USE 0x0321
#define GLUT_HAS_OVERLAY 0x0322
#define GLUT_TRANSPARENT_INDEX 0x0323
#define GLUT_NORMAL_DAMAGED 0x0324
#define GLUT_OVERLAY_DAMAGED 0x0325
/*
* GLUT API macro definitions -- the glutVideoResizeGet parameters
*/
#define GLUT_VIDEO_RESIZE_POSSIBLE 0x0384
#define GLUT_VIDEO_RESIZE_IN_USE 0x0385
#define GLUT_VIDEO_RESIZE_X_DELTA 0x0386
#define GLUT_VIDEO_RESIZE_Y_DELTA 0x0387
#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 0x0388
#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 0x0389
#define GLUT_VIDEO_RESIZE_X 0x038A
#define GLUT_VIDEO_RESIZE_Y 0x038B
#define GLUT_VIDEO_RESIZE_WIDTH 0x038C
#define GLUT_VIDEO_RESIZE_HEIGHT 0x038D
/*
* GLUT API macro definitions -- the glutUseLayer parameters
*/
#define GLUT_NORMAL 0x0000
#define GLUT_OVERLAY 0x0001
/*
* GLUT API macro definitions -- the glutGetModifiers parameters
*/
#define GLUT_ACTIVE_SHIFT 0x0001
#define GLUT_ACTIVE_CTRL 0x0002
#define GLUT_ACTIVE_ALT 0x0004
/*
* GLUT API macro definitions -- the glutSetCursor parameters
*/
#define GLUT_CURSOR_RIGHT_ARROW 0x0000
#define GLUT_CURSOR_LEFT_ARROW 0x0001
#define GLUT_CURSOR_INFO 0x0002
#define GLUT_CURSOR_DESTROY 0x0003
#define GLUT_CURSOR_HELP 0x0004
#define GLUT_CURSOR_CYCLE 0x0005
#define GLUT_CURSOR_SPRAY 0x0006
#define GLUT_CURSOR_WAIT 0x0007
#define GLUT_CURSOR_TEXT 0x0008
#define GLUT_CURSOR_CROSSHAIR 0x0009
#define GLUT_CURSOR_UP_DOWN 0x000A
#define GLUT_CURSOR_LEFT_RIGHT 0x000B
#define GLUT_CURSOR_TOP_SIDE 0x000C
#define GLUT_CURSOR_BOTTOM_SIDE 0x000D
#define GLUT_CURSOR_LEFT_SIDE 0x000E
#define GLUT_CURSOR_RIGHT_SIDE 0x000F
#define GLUT_CURSOR_TOP_LEFT_CORNER 0x0010
#define GLUT_CURSOR_TOP_RIGHT_CORNER 0x0011
#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 0x0012
#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 0x0013
#define GLUT_CURSOR_INHERIT 0x0064
#define GLUT_CURSOR_NONE 0x0065
#define GLUT_CURSOR_FULL_CROSSHAIR 0x0066
/*
* GLUT API macro definitions -- RGB color component specification definitions
*/
#define GLUT_RED 0x0000
#define GLUT_GREEN 0x0001
#define GLUT_BLUE 0x0002
/*
* GLUT API macro definitions -- additional keyboard and joystick definitions
*/
#define GLUT_KEY_REPEAT_OFF 0x0000
#define GLUT_KEY_REPEAT_ON 0x0001
#define GLUT_KEY_REPEAT_DEFAULT 0x0002
#define GLUT_JOYSTICK_BUTTON_A 0x0001
#define GLUT_JOYSTICK_BUTTON_B 0x0002
#define GLUT_JOYSTICK_BUTTON_C 0x0004
#define GLUT_JOYSTICK_BUTTON_D 0x0008
/*
* GLUT API macro definitions -- game mode definitions
*/
#define GLUT_GAME_MODE_ACTIVE 0x0000
#define GLUT_GAME_MODE_POSSIBLE 0x0001
#define GLUT_GAME_MODE_WIDTH 0x0002
#define GLUT_GAME_MODE_HEIGHT 0x0003
#define GLUT_GAME_MODE_PIXEL_DEPTH 0x0004
#define GLUT_GAME_MODE_REFRESH_RATE 0x0005
#define GLUT_GAME_MODE_DISPLAY_CHANGED 0x0006
/*
* Initialization functions, see fglut_init.c
*/
FGAPI void FGAPIENTRY glutInit( int* pargc, char** argv );
FGAPI void FGAPIENTRY glutInitWindowPosition( int x, int y );
FGAPI void FGAPIENTRY glutInitWindowSize( int width, int height );
FGAPI void FGAPIENTRY glutInitDisplayMode( unsigned int displayMode );
FGAPI void FGAPIENTRY glutInitDisplayString( const char* displayMode );
/*
* Process loop function, see fg_main.c
*/
FGAPI void FGAPIENTRY glutMainLoop( void );
/*
* Window management functions, see fg_window.c
*/
FGAPI int FGAPIENTRY glutCreateWindow( const char* title );
FGAPI int FGAPIENTRY glutCreateSubWindow( int window, int x, int y, int width, int height );
FGAPI void FGAPIENTRY glutDestroyWindow( int window );
FGAPI void FGAPIENTRY glutSetWindow( int window );
FGAPI int FGAPIENTRY glutGetWindow( void );
FGAPI void FGAPIENTRY glutSetWindowTitle( const char* title );
FGAPI void FGAPIENTRY glutSetIconTitle( const char* title );
FGAPI void FGAPIENTRY glutReshapeWindow( int width, int height );
FGAPI void FGAPIENTRY glutPositionWindow( int x, int y );
FGAPI void FGAPIENTRY glutShowWindow( void );
FGAPI void FGAPIENTRY glutHideWindow( void );
FGAPI void FGAPIENTRY glutIconifyWindow( void );
FGAPI void FGAPIENTRY glutPushWindow( void );
FGAPI void FGAPIENTRY glutPopWindow( void );
FGAPI void FGAPIENTRY glutFullScreen( void );
/*
* Display-related functions, see fg_display.c
*/
FGAPI void FGAPIENTRY glutPostWindowRedisplay( int window );
FGAPI void FGAPIENTRY glutPostRedisplay( void );
FGAPI void FGAPIENTRY glutSwapBuffers( void );
/*
* Mouse cursor functions, see fg_cursor.c
*/
FGAPI void FGAPIENTRY glutWarpPointer( int x, int y );
FGAPI void FGAPIENTRY glutSetCursor( int cursor );
/*
* Overlay stuff, see fg_overlay.c
*/
FGAPI void FGAPIENTRY glutEstablishOverlay( void );
FGAPI void FGAPIENTRY glutRemoveOverlay( void );
FGAPI void FGAPIENTRY glutUseLayer( GLenum layer );
FGAPI void FGAPIENTRY glutPostOverlayRedisplay( void );
FGAPI void FGAPIENTRY glutPostWindowOverlayRedisplay( int window );
FGAPI void FGAPIENTRY glutShowOverlay( void );
FGAPI void FGAPIENTRY glutHideOverlay( void );
/*
* Menu stuff, see fg_menu.c
*/
FGAPI int FGAPIENTRY glutCreateMenu( void (* callback)( int menu ) );
FGAPI void FGAPIENTRY glutDestroyMenu( int menu );
FGAPI int FGAPIENTRY glutGetMenu( void );
FGAPI void FGAPIENTRY glutSetMenu( int menu );
FGAPI void FGAPIENTRY glutAddMenuEntry( const char* label, int value );
FGAPI void FGAPIENTRY glutAddSubMenu( const char* label, int subMenu );
FGAPI void FGAPIENTRY glutChangeToMenuEntry( int item, const char* label, int value );
FGAPI void FGAPIENTRY glutChangeToSubMenu( int item, const char* label, int value );
FGAPI void FGAPIENTRY glutRemoveMenuItem( int item );
FGAPI void FGAPIENTRY glutAttachMenu( int button );
FGAPI void FGAPIENTRY glutDetachMenu( int button );
/*
* Global callback functions, see fg_callbacks.c
*/
FGAPI void FGAPIENTRY glutTimerFunc( unsigned int time, void (* callback)( int ), int value );
FGAPI void FGAPIENTRY glutIdleFunc( void (* callback)( void ) );
/*
* Window-specific callback functions, see fg_callbacks.c
*/
FGAPI void FGAPIENTRY glutKeyboardFunc( void (* callback)( unsigned char, int, int ) );
FGAPI void FGAPIENTRY glutSpecialFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutReshapeFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutVisibilityFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutDisplayFunc( void (* callback)( void ) );
FGAPI void FGAPIENTRY glutMouseFunc( void (* callback)( int, int, int, int ) );
FGAPI void FGAPIENTRY glutMotionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutPassiveMotionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutEntryFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutKeyboardUpFunc( void (* callback)( unsigned char, int, int ) );
FGAPI void FGAPIENTRY glutSpecialUpFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutJoystickFunc( void (* callback)( unsigned int, int, int, int ), int pollInterval );
FGAPI void FGAPIENTRY glutMenuStateFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutMenuStatusFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutOverlayDisplayFunc( void (* callback)( void ) );
FGAPI void FGAPIENTRY glutWindowStatusFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutSpaceballMotionFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutSpaceballRotateFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutSpaceballButtonFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutButtonBoxFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutDialsFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutTabletMotionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutTabletButtonFunc( void (* callback)( int, int, int, int ) );
/*
* State setting and retrieval functions, see fg_state.c
*/
FGAPI int FGAPIENTRY glutGet( GLenum query );
FGAPI int FGAPIENTRY glutDeviceGet( GLenum query );
FGAPI int FGAPIENTRY glutGetModifiers( void );
FGAPI int FGAPIENTRY glutLayerGet( GLenum query );
/*
* Font stuff, see fg_font.c
*/
FGAPI void FGAPIENTRY glutBitmapCharacter( void* font, int character );
FGAPI int FGAPIENTRY glutBitmapWidth( void* font, int character );
FGAPI void FGAPIENTRY glutStrokeCharacter( void* font, int character );
FGAPI int FGAPIENTRY glutStrokeWidth( void* font, int character );
FGAPI GLfloat FGAPIENTRY glutStrokeWidthf( void* font, int character ); /* GLUT 3.8 */
FGAPI int FGAPIENTRY glutBitmapLength( void* font, const unsigned char* string );
FGAPI int FGAPIENTRY glutStrokeLength( void* font, const unsigned char* string );
FGAPI GLfloat FGAPIENTRY glutStrokeLengthf( void* font, const unsigned char *string ); /* GLUT 3.8 */
/*
* Geometry functions, see fg_geometry.c
*/
FGAPI void FGAPIENTRY glutWireCube( double size );
FGAPI void FGAPIENTRY glutSolidCube( double size );
FGAPI void FGAPIENTRY glutWireSphere( double radius, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutSolidSphere( double radius, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutWireCone( double base, double height, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutSolidCone( double base, double height, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutWireTorus( double innerRadius, double outerRadius, GLint sides, GLint rings );
FGAPI void FGAPIENTRY glutSolidTorus( double innerRadius, double outerRadius, GLint sides, GLint rings );
FGAPI void FGAPIENTRY glutWireDodecahedron( void );
FGAPI void FGAPIENTRY glutSolidDodecahedron( void );
FGAPI void FGAPIENTRY glutWireOctahedron( void );
FGAPI void FGAPIENTRY glutSolidOctahedron( void );
FGAPI void FGAPIENTRY glutWireTetrahedron( void );
FGAPI void FGAPIENTRY glutSolidTetrahedron( void );
FGAPI void FGAPIENTRY glutWireIcosahedron( void );
FGAPI void FGAPIENTRY glutSolidIcosahedron( void );
/*
* Teapot rendering functions, found in fg_teapot.c
* NB: front facing polygons have clockwise winding, not counter clockwise
*/
FGAPI void FGAPIENTRY glutWireTeapot( double size );
FGAPI void FGAPIENTRY glutSolidTeapot( double size );
/*
* Game mode functions, see fg_gamemode.c
*/
FGAPI void FGAPIENTRY glutGameModeString( const char* string );
FGAPI int FGAPIENTRY glutEnterGameMode( void );
FGAPI void FGAPIENTRY glutLeaveGameMode( void );
FGAPI int FGAPIENTRY glutGameModeGet( GLenum query );
/*
* Video resize functions, see fg_videoresize.c
*/
FGAPI int FGAPIENTRY glutVideoResizeGet( GLenum query );
FGAPI void FGAPIENTRY glutSetupVideoResizing( void );
FGAPI void FGAPIENTRY glutStopVideoResizing( void );
FGAPI void FGAPIENTRY glutVideoResize( int x, int y, int width, int height );
FGAPI void FGAPIENTRY glutVideoPan( int x, int y, int width, int height );
/*
* Colormap functions, see fg_misc.c
*/
FGAPI void FGAPIENTRY glutSetColor( int color, GLfloat red, GLfloat green, GLfloat blue );
FGAPI GLfloat FGAPIENTRY glutGetColor( int color, int component );
FGAPI void FGAPIENTRY glutCopyColormap( int window );
/*
* Misc keyboard and joystick functions, see fg_misc.c
*/
FGAPI void FGAPIENTRY glutIgnoreKeyRepeat( int ignore );
FGAPI void FGAPIENTRY glutSetKeyRepeat( int repeatMode );
FGAPI void FGAPIENTRY glutForceJoystickFunc( void );
/*
* Misc functions, see fg_misc.c
*/
FGAPI int FGAPIENTRY glutExtensionSupported( const char* extension );
FGAPI void FGAPIENTRY glutReportErrors( void );
/* Comment from glut.h of classic GLUT:
Win32 has an annoying issue where there are multiple C run-time
libraries (CRTs). If the executable is linked with a different CRT
from the GLUT DLL, the GLUT DLL will not share the same CRT static
data seen by the executable. In particular, atexit callbacks registered
in the executable will not be called if GLUT calls its (different)
exit routine). GLUT is typically built with the
"/MD" option (the CRT with multithreading DLL support), but the Visual
C++ linker default is "/ML" (the single threaded CRT).
One workaround to this issue is requiring users to always link with
the same CRT as GLUT is compiled with. That requires users supply a
non-standard option. GLUT 3.7 has its own built-in workaround where
the executable's "exit" function pointer is covertly passed to GLUT.
GLUT then calls the executable's exit function pointer to ensure that
any "atexit" calls registered by the application are called if GLUT
needs to exit.
Note that the __glut*WithExit routines should NEVER be called directly.
To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */
/* to get the prototype for exit() */
#include <stdlib.h>
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) && !defined(__WATCOMC__)
FGAPI void FGAPIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
FGAPI int FGAPIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int));
FGAPI int FGAPIENTRY __glutCreateMenuWithExit(void (* func)(int), void (__cdecl *exitfunc)(int));
#ifndef FREEGLUT_BUILDING_LIB
#if defined(__GNUC__)
#define FGUNUSED __attribute__((unused))
#else
#define FGUNUSED
#endif
static void FGAPIENTRY FGUNUSED glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); }
#define glutInit glutInit_ATEXIT_HACK
static int FGAPIENTRY FGUNUSED glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); }
#define glutCreateWindow glutCreateWindow_ATEXIT_HACK
static int FGAPIENTRY FGUNUSED glutCreateMenu_ATEXIT_HACK(void (* func)(int)) { return __glutCreateMenuWithExit(func, exit); }
#define glutCreateMenu glutCreateMenu_ATEXIT_HACK
#endif
#endif
#ifdef __cplusplus
}
#endif
/*** END OF FILE ***/
#endif /* __FREEGLUT_STD_H__ */
+21
View File
@@ -0,0 +1,21 @@
#ifndef __GLUT_H__
#define __GLUT_H__
/*
* glut.h
*
* The freeglut library include file
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "freeglut_std.h"
/*** END OF FILE ***/
#endif /* __GLUT_H__ */
Binary file not shown.
+101
View File
@@ -0,0 +1,101 @@
#include <Windows.h>
#include <gl/glut.h>
#include <gl/GL.h>
#include <gl/glu.h>
#include <math.h>
#include "ObjModel.h"
float rotation = 0;
vector<pair<int, ObjModel*> > models;
int currentModel = 0;
void display(void)
{
glClearColor(0.6f, 0.6f, 0.9f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0, models[currentModel].first*1.1, models[currentModel].first * 2, 0,0, 0, 0, 1,0);
glRotatef(rotation, 0, 1, 0);
models[currentModel].second->draw();
glutSwapBuffers();
}
void reshape(GLint width, GLint height)
{
glViewport(0,0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(70, width/(float)height, 1, 1000);
glMatrixMode(GL_MODELVIEW);
}
void InitGraphics(void)
{
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
models.push_back(pair<int, ObjModel*>(75, new ObjModel("models/car/honda_jazz.obj")));
models.push_back(pair<int, ObjModel*>(1, new ObjModel("models/bloemetje/PrimRoseP.obj")));
models.push_back(pair<int, ObjModel*>(1, new ObjModel("models/cube/cube-textures.obj")));
models.push_back(pair<int, ObjModel*>(35, new ObjModel("models/ship/shipA_OBJ.obj")));
}
void MouseButton(int button, int state, int x, int y)
{
}
void MouseMotion(int x, int y)
{
}
void IdleFunc(void)
{
rotation += 0.25f;
glutPostRedisplay();
}
void Keyboard(unsigned char key, int x, int y)
{
switch (key)
{
case 27: // ESCAPE key
exit (0);
break;
case '[':
currentModel = (currentModel + models.size() - 1) % models.size();
break;
case ']':
currentModel = (currentModel + 1) % models.size();
break;
}
glutPostRedisplay();
}
int main(int argc, char* argv[])
{
glutInit (&argc, argv);
glutInitWindowSize (1024, 768);
glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow ("Object loading");
// Initialize OpenGL graphics state
InitGraphics();
// Register callbacks:
glutDisplayFunc (display);
glutReshapeFunc (reshape);
glutKeyboardFunc (Keyboard);
glutMouseFunc (MouseButton);
glutMotionFunc (MouseMotion);
glutIdleFunc (IdleFunc);
// Turn the flow of control over to GLUT
glutMainLoop ();
return 0;
}
@@ -0,0 +1,17 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 17.11.2010 17:49:56
newmtl 02___Default
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5882 0.5882 0.5882
Kd 0.5882 0.5882 0.5882
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka Notebook_Color.jpg
map_Kd Notebook_Color.jpg
map_bump Map__2_Normal_Bump.tga
@@ -0,0 +1,560 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 17.11.2010 17:49:56
mtllib Lowpoly Old Notebook(obj).mtl
#
# object Box001
#
v -50.0000 0.0000 36.7478
v -50.0000 0.0000 -40.0000
v 50.0000 0.0000 -40.0000
v 50.0000 0.0000 36.7478
v -39.6000 9.7724 8.5873
v 39.6000 9.7724 8.5873
v 39.6000 11.0633 -29.5871
v -39.6000 11.0633 -29.5871
v 50.0000 7.0964 40.0000
v -50.0000 7.0964 40.0000
v 50.0000 10.0000 -40.0000
v -50.0000 10.0000 -40.0000
v 34.3534 10.0000 -40.0000
v -36.9708 10.0000 -40.0000
v -29.4465 10.0000 -40.0000
v 32.0639 10.0000 -40.0000
v 40.0000 8.2278 9.5169
v -40.0000 8.2278 9.5169
v 40.0000 9.6373 -30.0066
v 34.3534 9.9778 -39.4716
v 34.3534 9.8861 -36.9309
v 34.3534 9.6373 -30.0066
v -40.0000 9.6373 -30.0066
v 30.6625 9.6373 -30.0066
v -38.8100 9.6373 -30.0066
v -29.4465 9.6373 -30.0066
v -36.9708 9.9778 -39.4716
v -36.9708 9.8861 -36.9309
v -29.4465 9.9778 -39.4716
v -29.4465 9.8861 -36.9309
v 32.0639 9.9778 -39.4716
v 32.0639 9.8861 -36.9309
v -36.9708 14.8238 -38.2527
v -36.9708 14.8069 -37.7871
v -29.4465 14.8069 -37.7871
v -29.4465 14.8238 -38.2527
v 32.0639 14.8238 -38.2527
v 32.0639 14.8069 -37.7871
v 34.3534 14.8069 -37.7871
v 34.3534 14.8238 -38.2527
v -36.9708 13.8239 -39.3279
v -29.4465 13.8239 -39.3279
v -36.9708 13.7317 -36.7872
v -36.9708 14.1948 -36.9596
v -36.9708 14.6014 -37.3377
v -36.9708 14.6514 -38.7158
v -36.9708 14.2733 -39.1224
v -29.4465 13.7317 -36.7872
v -29.4465 14.2733 -39.1224
v -29.4465 14.6514 -38.7158
v -29.4465 14.6014 -37.3377
v -29.4465 14.1948 -36.9596
v 32.0639 13.8239 -39.3279
v 34.3534 13.8239 -39.3279
v 32.0639 13.7317 -36.7872
v 32.0639 14.1948 -36.9596
v 32.0639 14.6014 -37.3377
v 32.0639 14.6514 -38.7158
v 32.0639 14.2733 -39.1224
v 34.3534 13.7317 -36.7872
v 34.3534 14.2733 -39.1224
v 34.3534 14.6514 -38.7158
v 34.3534 14.6014 -37.3377
v 34.3534 14.1948 -36.9596
# 64 vertices
vn 0.0000 -1.0000 0.0000
vn -0.5142 0.7583 0.4007
vn 0.5144 0.7583 0.4006
vn 0.4940 0.7268 -0.4772
vn -0.4938 0.7268 -0.4773
vn -0.7865 -0.2573 0.5614
vn 0.7865 -0.2573 0.5614
vn 0.5998 -0.3334 0.7274
vn -0.5998 -0.3334 0.7274
vn 0.7071 0.0000 -0.7071
vn 0.6988 0.0000 -0.7153
vn -0.7071 0.0000 -0.7071
vn -0.6988 0.0000 -0.7153
vn 0.0000 0.0000 -1.0000
vn 1.0000 0.0000 -0.0000
vn -0.0005 0.9993 0.0369
vn 0.0005 0.9993 0.0369
vn 0.0027 0.9993 0.0362
vn -0.0014 0.9993 0.0366
vn -0.0000 0.9993 0.0363
vn 0.0001 0.9993 0.0362
vn -0.0035 0.9993 0.0365
vn -1.0000 0.0000 -0.0000
vn -0.0010 0.9993 0.0365
vn 0.0000 0.9994 0.0359
vn -0.0001 0.9994 0.0360
vn 0.0004 0.9994 0.0359
vn -0.5428 0.5318 0.6501
vn 0.5428 0.5320 0.6499
vn 0.6651 0.3763 -0.6450
vn 0.0000 0.2822 -0.9594
vn -0.6650 0.3761 -0.6453
vn 0.0017 0.9992 0.0396
vn 0.0112 0.9991 0.0415
vn 0.0004 0.9994 0.0360
vn -0.0015 0.9992 0.0395
vn -0.8941 0.4475 0.0188
vn -0.0002 0.9993 0.0363
vn 0.0008 0.9991 0.0413
vn -0.0000 0.9994 0.0359
vn 0.0005 0.9992 0.0392
vn 0.0005 0.9994 0.0360
vn 0.0000 0.9991 0.0419
vn 0.0000 0.9872 -0.1594
vn 0.0000 0.9731 0.2305
vn 0.0000 0.0373 -0.9993
vn 0.0000 0.2311 -0.9729
vn 0.0000 -0.0373 0.9993
vn 0.0000 0.1589 0.9873
vn 0.0000 0.8511 -0.5250
vn 0.0000 0.5854 -0.8108
vn 0.0000 0.8108 0.5854
vn 0.0000 0.5250 0.8511
# 53 vertex normals
vt 0.5062 0.3688 0.4983
vt 0.5062 0.6593 0.4983
vt 0.9658 0.6593 0.4983
vt 0.9658 0.3688 0.4983
vt 0.5068 0.2087 0.0000
vt 0.9195 0.2087 0.0000
vt 0.9195 0.3456 0.0000
vt 0.5068 0.3456 0.0000
vt 0.5062 0.3565 0.4983
vt 0.9658 0.3565 0.4983
vt 0.9658 0.3853 0.4983
vt 0.5062 0.3853 0.4983
vt 0.0416 0.1825 0.0000
vt 0.2112 0.1825 0.0000
vt 0.2112 0.2057 0.0000
vt 0.0370 0.2004 0.0000
vt 0.9659 0.6390 0.4983
vt 0.5064 0.6390 0.4983
vt 0.5064 0.6593 0.4983
vt 0.8940 0.6593 0.4983
vt 0.5663 0.6593 0.4983
vt 0.6008 0.6593 0.4983
vt 0.8835 0.6593 0.4983
vt 0.9659 0.6593 0.4983
vt 0.0497 0.2653 0.0000
vt 0.2100 0.2653 0.0000
vt 0.2128 0.2814 0.0000
vt 0.0497 0.2858 0.0000
vt 0.0321 0.3570 0.0000
vt 0.4908 0.3570 0.0000
vt 0.4449 0.4725 0.0000
vt 0.0780 0.4725 0.0000
vt 0.4908 0.6602 0.0000
vt 0.4449 0.6224 0.0000
vt 0.4190 0.6602 0.0000
vt 0.4190 0.6582 0.0000
vt 0.4190 0.6486 0.0000
vt 0.4190 0.6224 0.0000
vt 0.0321 0.6602 0.0000
vt 0.0780 0.6224 0.0000
vt 0.5045 0.2054 0.0000
vt 0.9215 0.2054 0.0000
vt 0.9215 0.3468 0.0000
vt 0.8921 0.3468 0.0000
vt 0.8729 0.3468 0.0000
vt 0.5107 0.3468 0.0000
vt 0.5595 0.3468 0.0000
vt 0.5045 0.3468 0.0000
vt 0.0919 0.6602 0.0000
vt 0.0919 0.6582 0.0000
vt 0.0834 0.6224 0.0000
vt 0.0919 0.6486 0.0000
vt 0.1264 0.6602 0.0000
vt 0.1264 0.6582 0.0000
vt 0.1264 0.6486 0.0000
vt 0.4085 0.6602 0.0000
vt 0.1264 0.6224 0.0000
vt 0.4085 0.6582 0.0000
vt 0.4021 0.6224 0.0000
vt 0.4085 0.6486 0.0000
vt 0.5444 0.5392 0.0000
vt 0.5444 0.5391 0.0000
vt 0.5663 0.5391 0.0000
vt 0.5663 0.5392 0.0000
vt 0.5187 0.5400 0.0000
vt 0.5187 0.5399 0.0000
vt 0.5314 0.5399 0.0000
vt 0.5314 0.5400 0.0000
vt 0.5663 0.5164 0.0000
vt 0.5444 0.5164 0.0000
vt 0.5444 0.5345 0.0000
vt 0.5663 0.5345 0.0000
vt 0.6777 0.5184 0.0000
vt 0.6789 0.5361 0.0000
vt 0.6774 0.5383 0.0000
vt 0.6704 0.5411 0.0000
vt 0.6742 0.5401 0.0000
vt 0.6562 0.5188 0.0000
vt 0.6574 0.5365 0.0000
vt 0.6665 0.5412 0.0000
vt 0.6626 0.5404 0.0000
vt 0.6591 0.5386 0.0000
vt 0.5444 0.5159 0.0000
vt 0.5663 0.5159 0.0000
vt 0.5663 0.5341 0.0000
vt 0.5444 0.5341 0.0000
vt 0.5314 0.5175 0.0000
vt 0.5187 0.5175 0.0000
vt 0.5187 0.5353 0.0000
vt 0.5314 0.5353 0.0000
vt 0.6461 0.5191 0.0000
vt 0.6476 0.5373 0.0000
vt 0.6458 0.5395 0.0000
vt 0.6375 0.5424 0.0000
vt 0.6420 0.5414 0.0000
vt 0.6204 0.5195 0.0000
vt 0.6219 0.5378 0.0000
vt 0.6328 0.5425 0.0000
vt 0.6281 0.5417 0.0000
vt 0.6240 0.5399 0.0000
vt 0.5187 0.5171 0.0000
vt 0.5314 0.5171 0.0000
vt 0.5314 0.5349 0.0000
vt 0.5187 0.5349 0.0000
vt 0.5663 0.5384 0.0000
vt 0.5663 0.5366 0.0000
vt 0.5444 0.5366 0.0000
vt 0.5444 0.5384 0.0000
vt 0.5444 0.5382 0.0000
vt 0.5444 0.5363 0.0000
vt 0.5663 0.5363 0.0000
vt 0.5663 0.5382 0.0000
vt 0.5314 0.5392 0.0000
vt 0.5314 0.5374 0.0000
vt 0.5187 0.5374 0.0000
vt 0.5187 0.5392 0.0000
vt 0.5187 0.5389 0.0000
vt 0.5187 0.5371 0.0000
vt 0.5314 0.5371 0.0000
vt 0.5314 0.5389 0.0000
# 120 texture coords
g Box001
usemtl 02___Default
s 8
f 1/1/1 2/2/1 3/3/1 4/4/1
s 96
f 5/5/2 6/6/3 7/7/4 8/8/5
s 16
f 1/9/6 4/10/7 9/11/8 10/12/9
f 4/13/7 3/14/10 11/15/11 9/16/8
f 3/17/10 2/18/12 12/19/13 13/20/14
f 12/19/13 14/21/15 15/22/15 13/20/14
f 15/22/15 16/23/15 13/20/14
f 3/17/10 13/20/14 11/24/11
f 2/25/12 1/26/6 10/27/9 12/28/13
s 128
f 10/29/16 9/30/17 17/31/18 18/32/19
f 9/30/17 11/33/20 19/34/21 17/31/18
f 13/35/22 20/36/23 21/37/24 19/34/21
f 21/37/24 22/38/25 19/34/21
f 11/33/20 13/35/22 19/34/21
f 12/39/26 10/29/16 18/32/19 23/40/27
s 96
f 18/41/28 17/42/29 6/6/3 5/5/2
f 17/42/29 19/43/30 7/7/4 6/6/3
f 19/43/30 22/44/15 24/45/15 25/46/31
f 24/45/15 26/47/15 25/46/31
f 25/46/31 23/48/32 8/8/5 19/43/30
f 19/43/30 8/8/5 7/7/4
f 23/48/32 18/41/28 5/5/2 8/8/5
s 128
f 14/49/33 12/39/26 23/40/27 27/50/34
f 25/51/25 28/52/35 27/50/34 23/40/27
f 15/53/36 29/54/37 30/55/38 16/56/39
f 16/56/39 30/55/38 26/57/40 31/58/41
f 24/59/25 32/60/42 31/58/41 26/57/40
s 8
f 16/56/43 31/58/43 20/36/43 13/35/43
s 128
f 14/49/33 27/50/34 29/54/37 15/53/36
f 25/51/25 26/57/40 30/55/38 28/52/35
f 24/59/25 22/38/25 21/37/24 32/60/42
s 4
f 33/61/44 34/62/45 35/63/45 36/64/44
f 37/65/44 38/66/45 39/67/45 40/68/44
s 1
f 29/69/46 27/70/46 41/71/47 42/72/47
s 2
f 28/73/23 43/74/23 44/75/23 34/76/23
f 44/75/23 45/77/23 34/76/23
f 27/78/23 28/73/23 34/76/23 41/79/23
f 34/76/23 33/80/23 46/81/23 41/79/23
f 46/81/23 47/82/23 41/79/23
s 1
f 28/83/48 30/84/48 48/85/49 43/86/49
s 2
f 29/78/15 42/79/15 49/82/15 36/80/15
f 49/82/15 50/81/15 36/80/15
f 30/73/15 29/78/15 36/80/15 48/74/15
f 36/80/15 35/76/15 51/77/15 48/74/15
f 51/77/15 52/75/15 48/74/15
s 1
f 20/87/46 31/88/46 53/89/47 54/90/47
s 2
f 32/91/23 55/92/23 56/93/23 38/94/23
f 56/93/23 57/95/23 38/94/23
f 31/96/23 32/91/23 38/94/23 53/97/23
f 38/94/23 37/98/23 58/99/23 53/97/23
f 58/99/23 59/100/23 53/97/23
s 1
f 32/101/48 21/102/48 60/103/49 55/104/49
s 2
f 20/96/15 54/97/15 61/100/15 40/98/15
f 61/100/15 62/99/15 40/98/15
f 21/91/15 20/96/15 40/98/15 60/92/15
f 40/98/15 39/94/15 63/95/15 60/92/15
f 63/95/15 64/93/15 60/92/15
s 4
f 50/105/50 49/106/51 47/107/51 46/108/50
f 45/109/52 44/110/53 52/111/53 51/112/52
f 62/113/50 61/114/51 59/115/51 58/116/50
f 57/117/52 56/118/53 64/119/53 63/120/52
f 36/64/44 50/105/50 46/108/50 33/61/44
f 34/62/45 45/109/52 51/112/52 35/63/45
f 40/68/44 62/113/50 58/116/50 37/65/44
f 38/66/45 57/117/52 63/120/52 39/67/45
s 5
f 49/106/51 42/72/47 41/71/47 47/107/51
f 44/110/53 43/86/49 48/85/49 52/111/53
f 61/114/51 54/90/47 53/89/47 59/115/51
f 56/118/53 55/104/49 60/103/49 64/119/53
# 55 polygons - 14 triangles
#
# object Box002
#
v -44.5000 80.2079 -63.5523
v -44.5000 20.5485 -41.8381
v 44.5000 20.5485 -41.8381
v 44.5000 80.2079 -63.5523
v -48.4300 83.9872 -68.1204
v 48.4300 83.9872 -68.1204
v 48.4300 12.0676 -41.9438
v -37.2173 12.0676 -41.9438
v 34.5425 12.0676 -41.9438
v 31.9377 12.0676 -41.9438
v -29.2629 12.0676 -41.9438
v -48.4300 12.0676 -41.9438
v -50.0000 86.9832 -64.9541
v 50.0000 86.9832 -64.9541
v 50.0000 11.8077 -37.5925
v 34.5425 11.9377 -39.7681
v 34.5425 11.8077 -37.5925
v -50.0000 11.8077 -37.5925
v -45.5000 19.9508 -40.5563
v -45.5000 81.4896 -62.9546
v -37.2173 16.8515 -39.4283
v -37.2173 19.9508 -40.5563
v -37.2173 11.8077 -37.5925
v 45.5000 81.4896 -62.9546
v 45.5000 19.9508 -40.5563
v -29.2629 19.9508 -40.5563
v 34.5425 19.9508 -40.5563
v 31.9377 19.9508 -40.5563
v -37.2173 11.9377 -39.7681
v 34.5425 16.8515 -39.4283
v 31.9377 11.8077 -37.5925
v -29.2629 11.8077 -37.5925
v -29.2629 11.9377 -39.7681
v 31.9377 11.9377 -39.7681
v 31.9377 16.8515 -39.4283
v -29.2629 16.8515 -39.4283
v 34.5425 15.2944 -42.0095
v 31.9377 15.2944 -42.0095
v -37.2173 15.2944 -42.0095
v -29.2629 15.2944 -42.0095
# 40 vertices
vn 0.3002 0.0276 0.9535
vn 0.3002 0.5918 0.7481
vn -0.3002 0.5918 0.7481
vn -0.3002 0.0276 0.9535
vn 0.0000 -0.3420 -0.9397
vn 1.0000 0.0000 -0.0000
vn 0.0000 0.7264 -0.6873
vn 0.9309 -0.1250 -0.3433
vn 0.0000 -0.9982 -0.0596
vn -0.9309 -0.1250 -0.3433
vn 0.0000 0.3420 0.9397
vn -0.0000 0.3420 0.9397
vn 0.4082 -0.1044 0.9069
vn 0.4082 0.6629 0.6276
vn 0.0000 -0.9397 0.3420
vn 0.0000 0.9063 0.4226
vn -0.4082 0.6629 0.6276
vn -0.4082 -0.1044 0.9069
vn -1.0000 0.0000 -0.0000
vn -0.0000 -0.8563 0.5165
vn 1.0000 0.0000 0.0000
vn 1.0000 -0.0000 0.0000
vn 1.0000 -0.0000 -0.0000
vn -0.0000 0.5553 0.8316
vn 0.0000 0.5553 0.8316
vn 0.0000 -0.8563 0.5165
# 26 vertex normals
vt 0.7288 0.0340 0.0000
vt 0.7288 0.1896 0.0000
vt 0.5043 0.1896 0.0000
vt 0.5043 0.0340 0.0000
vt 0.5133 0.9695 0.0000
vt 0.9563 0.9695 0.0000
vt 0.9563 0.6806 0.0000
vt 0.5646 0.6806 0.0000
vt 0.8928 0.6806 0.0000
vt 0.8808 0.6806 0.0000
vt 0.6010 0.6806 0.0000
vt 0.5133 0.6806 0.0000
vt 0.5062 0.9761 0.0000
vt 0.9634 0.9761 0.0000
vt 0.9634 0.6741 0.0000
vt 0.8928 0.6773 0.0000
vt 0.8928 0.6741 0.0000
vt 0.5062 0.6741 0.0000
vt 0.0351 0.9758 0.0000
vt 0.0351 0.6749 0.0000
vt 0.0556 0.7075 0.0000
vt 0.0556 0.9538 0.0000
vt 0.0935 0.6950 0.0000
vt 0.0935 0.7075 0.0000
vt 0.0935 0.6749 0.0000
vt 0.4926 0.6749 0.0000
vt 0.4926 0.9758 0.0000
vt 0.4720 0.9538 0.0000
vt 0.4720 0.7075 0.0000
vt 0.0692 0.9445 0.0000
vt 0.0692 0.7176 0.0000
vt 0.0734 0.7211 0.0000
vt 0.0734 0.9411 0.0000
vt 0.1041 0.7176 0.0000
vt 0.1377 0.7176 0.0000
vt 0.4069 0.7176 0.0000
vt 0.3959 0.7176 0.0000
vt 0.4531 0.7176 0.0000
vt 0.4489 0.7211 0.0000
vt 0.4531 0.9445 0.0000
vt 0.4489 0.9411 0.0000
vt 0.5646 0.6741 0.0000
vt 0.5646 0.6773 0.0000
vt 0.4218 0.6749 0.0000
vt 0.4218 0.6950 0.0000
vt 0.4218 0.7075 0.0000
vt 0.8808 0.6741 0.0000
vt 0.6010 0.6741 0.0000
vt 0.6010 0.6773 0.0000
vt 0.8808 0.6773 0.0000
vt 0.1299 0.6749 0.0000
vt 0.4099 0.6749 0.0000
vt 0.4099 0.6950 0.0000
vt 0.4099 0.7075 0.0000
vt 0.1299 0.7075 0.0000
vt 0.1299 0.6950 0.0000
vt 0.4016 0.5145 0.0000
vt 0.4016 0.5121 0.0000
vt 0.4016 0.5252 0.0000
vt 0.4016 0.5268 0.0000
vt 0.3959 0.5268 0.0000
vt 0.3959 0.5252 0.0000
vt 0.3959 0.5121 0.0000
vt 0.3959 0.5145 0.0000
vt 0.2464 0.5268 0.0000
vt 0.2464 0.5121 0.0000
vt 0.2464 0.5252 0.0000
vt 0.2464 0.5145 0.0000
vt 0.2636 0.5145 0.0000
vt 0.2636 0.5252 0.0000
vt 0.2636 0.5121 0.0000
vt 0.2636 0.5268 0.0000
# 72 texture coords
g Box002
usemtl 02___Default
s 1
f 65/121/54 66/122/55 67/123/56 68/124/57
f 69/125/58 70/126/58 71/127/58 72/128/58
f 71/127/58 73/129/59 74/130/59 72/128/58
f 74/130/59 75/131/59 72/128/58
f 69/125/58 72/128/58 76/132/58
s off
f 77/133/60 78/134/60 70/126/60 69/125/60
f 78/134/61 79/135/61 71/127/61 70/126/61
f 80/136/62 73/129/62 71/127/62 81/137/62
f 79/135/62 81/137/62 71/127/62
f 82/138/63 77/133/63 69/125/63 76/132/63
s 4
f 77/139/64 82/140/65 83/141/65 84/142/64
f 85/143/64 86/144/64 83/141/65 87/145/65
f 82/140/65 87/145/65 83/141/65
f 79/146/64 78/147/65 88/148/65 89/149/64
f 78/147/65 77/139/64 84/142/64 88/148/65
s 1
f 84/150/66 83/151/67 66/152/55 65/153/54
f 83/151/67 86/154/68 90/155/68 91/156/69
f 90/155/68 92/157/59 91/156/69
f 91/156/69 89/158/70 67/159/56 83/151/67
f 83/151/67 67/159/56 66/152/55
f 89/158/70 88/160/71 68/161/57 67/159/56
f 88/160/71 84/150/66 65/153/54 68/161/57
s off
f 87/162/62 82/138/62 76/132/62 93/163/62
f 76/132/62 72/128/62 93/163/62
s 4
f 81/164/64 79/146/64 89/149/64 94/165/65
f 89/149/64 91/166/65 94/165/65
s off
f 95/167/62 96/168/62 97/169/62 75/131/62
f 75/131/62 74/130/62 98/170/62 95/167/62
s 4
f 96/171/64 95/172/64 99/173/65 92/174/65
f 92/174/65 90/175/65 100/176/64 96/171/64
f 90/175/65 86/144/64 85/143/64 100/176/64
s off
f 72/128/62 75/131/62 97/169/62 93/163/62
f 74/130/62 73/129/62 80/136/62 98/170/62
s 4
f 91/166/65 92/174/65 99/173/65 94/165/65
s 1
f 80/177/72 81/178/72 101/179/72
f 81/178/72 94/180/72 101/179/72
s off
f 94/180/73 99/181/73 102/182/73 101/179/73
s 1
f 99/181/74 95/183/75 102/182/74
f 95/183/75 98/184/76 102/182/74
s 4
f 98/184/77 80/177/78 101/179/77 102/182/77
s 1
f 85/185/59 87/186/59 103/187/59
f 87/186/59 93/188/59 103/187/59
s 4
f 93/188/78 97/189/78 104/190/78 103/187/78
s 1
f 97/189/72 96/191/72 104/190/72
f 96/191/72 100/192/72 104/190/72
s off
f 100/192/79 85/185/79 103/187/79 104/190/79
# 30 polygons - 16 triangles
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

+79
View File
@@ -0,0 +1,79 @@
# Blender3D MTL File: Primrose02.blend
# Material Count: 7
newmtl prim1st_PRIM1ST.png
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.689231 0.689231 0.689231
Ks 0.192308 0.192308 0.192308
Ni 1.000000
d 1.000000
illum 2
map_Kd PRIM1ST.png
newmtl prim1L1_PRIM1L3.png
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.492308 0.492308 0.492308
Ks 0.192354 0.192354 0.192354
Ni 1.000000
d 1.000000
illum 2
map_Kd PRIM1L3.png
newmtl prim1p2_PRIM1L2.png
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.516942 0.516942 0.516942
Ks 0.130825 0.130825 0.130825
Ni 1.000000
d 1.000000
illum 2
map_Kd PRIM1L2.png
newmtl prim1p_PRIM1P.png
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.492308 0.492308 0.492308
Ks 0.130769 0.130769 0.130769
Ni 1.000000
d 1.000000
illum 2
map_Kd PRIM1P.png
newmtl vase_vase.png
Ns 219.607843
Ka 0.000000 0.000000 0.000000
Kd 0.640000 0.640000 0.640000
Ks 0.684615 0.684615 0.684615
Ni 1.000000
d 1.000000
illum 2
map_Kd vase.png
newmtl prim1p2_PRIM1L2.png.001
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.516942 0.516942 0.516942
Ks 0.130825 0.130825 0.130825
Ni 1.000000
d 1.000000
illum 2
map_Kd PRIM1L2.png
newmtl soil_PRIMsoil.png
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.492308 0.492308 0.492308
Ks 0.253846 0.253846 0.253846
Ni 1.000000
d 1.000000
illum 2
map_Kd PRIMsoil.png
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

+17
View File
@@ -0,0 +1,17 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 30.04.2010 10:12:01
newmtl Material__1
Ns 25.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 1.0000 1.0000 1.0000
Kd 1.0000 1.0000 1.0000
Ks 1.0000 1.0000 1.0000
Ke 0.0000 0.0000 0.0000
map_Ka tex\Jazz_diffuse.jpg
map_Kd tex\Jazz_diffuse.jpg
map_d tex\Jazz_opacity.jpg
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 560 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

+24
View File
@@ -0,0 +1,24 @@
newmtl t1
illum 4
Kd 0.80 0.80 0.80
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
map_Kd tex1.bmp
newmtl t2
illum 4
Kd 0.80 0.80 0.80
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
map_Kd tex2.bmp
newmtl t3
illum 4
Kd 0.80 0.80 0.80
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
map_Kd tex3.bmp
newmtl t4
illum 4
Kd 0.80 0.80 0.80
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
map_Kd tex4.bmp
+52
View File
@@ -0,0 +1,52 @@
# cube.obj with materials and documentation
#
mtllib cube-textures.mtl
g cube
# v1 is origin: back lower left (bll)
# v2=fll, v3=bul, v4=ful, v5=blr, v6=flr, v7=
v 0.0 0.0 0.0 v1 = back lower left (origin)
v 0.0 0.0 1.0 v2 = front lower left
v 0.0 1.0 0.0 v3 = back upper left
v 0.0 1.0 1.0 v4 = front upper left
v 1.0 0.0 0.0 v5 = back lower right
v 1.0 0.0 1.0 v6 = front lower right
v 1.0 1.0 0.0 v7 = back upper right
v 1.0 1.0 1.0 v8 = front upper right
vn 0.0 0.0 1.0
vn 0.0 0.0 -1.0
vn 0.0 1.0 0.0
vn 0.0 -1.0 0.0
vn 1.0 0.0 0.0
vn -1.0 0.0 0.0
vt 0.0 0.0 # vt=1 is upper left of texture
vt 0.0 1.0 # vt=2 is lower left of texture
vt 1.0 0.0 # vt=3 is upper right of texture
vt 1.0 1.0 # vt=4 is lower right of texture
# remember, syntax is v/vt/vn
g back face
usemtl t1
f 1/4/2 7/1/2 5/2/2
f 1/4/2 3/3/2 7/1/2
g left face
usemtl t2
f 1/2/6 4/3/6 3/1/6
f 1/2/6 2/4/6 4/3/6
g top face
usemtl t3
f 3/1/3 8/4/3 7/3/3
f 3/1/3 4/2/3 8/4/3
g right face
usemtl t4
f 5/4/5 7/3/5 8/1/5
f 5/4/5 8/1/5 6/2/5
g bottom face
usemtl t3
f 1/2/4 5/4/4 6/3/4
f 1/2/4 6/3/4 2/1/4
g front face
usemtl t1
f 2/2/1 6/4/1 8/3/1
f 2/2/1 8/3/1 4/1/1
Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.
Binary file not shown.
+12
View File
@@ -0,0 +1,12 @@
# Blender MTL File: 'normaltest.blend'
# Material Count: 1
newmtl _normaltest
Ns 0
Ka 0.000000 0.000000 0.000000
Kd 0.8 0.8 0.8
Ks 0.8 0.8 0.8
d 1
illum 2
map_Kd texture.png
map_bump normaltest.png
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 363 KiB

Binary file not shown.
Binary file not shown.
@@ -0,0 +1,12 @@
# Blender MTL File: 'normaltest2.blend'
# Material Count: 1
newmtl _normaltest
Ns 0
Ka 0.000000 0.000000 0.000000
Kd 0.8 0.8 0.8
Ks 0.8 0.8 0.8
d 1
illum 2
map_Kd texture.png
map_bump normaltest2.png
+887
View File
@@ -0,0 +1,887 @@
# Blender v2.61 (sub 0) OBJ File: 'normaltest2.blend'
# www.blender.org
mtllib normaltest2.mtl
o Icosphere_Icosphere.002
v 0.000000 -1.000000 0.000000
v 0.723600 -0.447215 0.525720
v -0.276385 -0.447215 0.850640
v -0.894425 -0.447215 0.000000
v -0.276385 -0.447215 -0.850640
v 0.723600 -0.447215 -0.525720
v 0.276385 0.447215 0.850640
v -0.723600 0.447215 0.525720
v -0.723600 0.447215 -0.525720
v 0.276385 0.447215 -0.850640
v 0.894425 0.447215 0.000000
v 0.000000 1.000000 0.000000
v -0.162456 -0.850654 0.499995
v 0.425323 -0.850654 0.309011
v 0.262869 -0.525738 0.809012
v 0.425323 -0.850654 -0.309011
v 0.850648 -0.525736 0.000000
v -0.525730 -0.850652 0.000000
v -0.688189 -0.525736 0.499997
v -0.162456 -0.850654 -0.499995
v -0.688189 -0.525736 -0.499997
v 0.262869 -0.525738 -0.809012
v 0.951058 0.000000 -0.309013
v 0.951058 0.000000 0.309013
v 0.587786 0.000000 0.809017
v 0.000000 0.000000 1.000000
v -0.587786 0.000000 0.809017
v -0.951058 0.000000 0.309013
v -0.951058 0.000000 -0.309013
v -0.587786 0.000000 -0.809017
v 0.000000 0.000000 -1.000000
v 0.587786 0.000000 -0.809017
v 0.688189 0.525736 0.499997
v -0.262869 0.525738 0.809012
v -0.850648 0.525736 0.000000
v -0.262869 0.525738 -0.809012
v 0.688189 0.525736 -0.499997
v 0.525730 0.850652 0.000000
v 0.162456 0.850654 0.499995
v -0.425323 0.850654 0.309011
v -0.425323 0.850654 -0.309011
v 0.162456 0.850654 -0.499995
v -0.228103 -0.674615 0.702042
v -0.084442 -0.961939 0.259889
v 0.221076 -0.961939 0.160619
v 0.597194 -0.674615 0.433882
v -0.007026 -0.505728 0.862665
v 0.512753 -0.505727 0.693775
v 0.597194 -0.674615 -0.433882
v 0.221076 -0.961939 -0.160619
v 0.818272 -0.505726 -0.273262
v 0.818272 -0.505726 0.273262
v -0.738174 -0.674610 0.000000
v -0.273266 -0.961939 0.000000
v -0.822618 -0.505724 0.259890
v -0.501373 -0.505727 0.702043
v -0.084442 -0.961939 -0.259889
v -0.228103 -0.674615 -0.702042
v -0.822618 -0.505724 -0.259890
v -0.501373 -0.505727 -0.702043
v 0.512753 -0.505727 -0.693775
v -0.007026 -0.505728 -0.862665
v 0.959253 0.232455 -0.160620
v 0.870465 -0.232456 -0.433883
v 0.959253 0.232455 0.160620
v 0.870465 -0.232456 0.433883
v 0.449185 0.232457 0.862668
v 0.681641 -0.232457 0.693779
v 0.143661 0.232456 0.961938
v -0.143661 -0.232456 0.961938
v -0.449185 -0.232457 0.862668
v -0.681641 0.232457 0.693779
v -0.959253 -0.232455 0.160620
v -0.870465 0.232456 0.433883
v -0.959253 -0.232455 -0.160620
v -0.870465 0.232456 -0.433883
v -0.681641 0.232457 -0.693779
v -0.449185 -0.232457 -0.862668
v 0.143661 0.232456 -0.961938
v -0.143661 -0.232456 -0.961938
v 0.449185 0.232457 -0.862668
v 0.681641 -0.232457 -0.693779
v 0.501373 0.505727 0.702043
v 0.822618 0.505724 0.259890
v 0.007026 0.505728 0.862665
v -0.512753 0.505727 0.693775
v -0.818272 0.505726 0.273262
v -0.818272 0.505726 -0.273262
v 0.007026 0.505728 -0.862665
v -0.512753 0.505727 -0.693775
v 0.501373 0.505727 -0.702043
v 0.822618 0.505724 -0.259890
v 0.273266 0.961939 0.000000
v 0.738174 0.674610 0.000000
v 0.228103 0.674615 0.702042
v 0.084442 0.961939 0.259889
v -0.221076 0.961939 0.160619
v -0.597194 0.674615 0.433882
v -0.221076 0.961939 -0.160619
v -0.597194 0.674615 -0.433882
v 0.084442 0.961939 -0.259889
v 0.228103 0.674615 -0.702042
v 0.052790 -0.723612 0.688185
v 0.138197 -0.894430 0.425320
v 0.361804 -0.723612 0.587779
v 0.670817 -0.723611 0.162457
v 0.447210 -0.894429 0.000000
v 0.670817 -0.723611 -0.162457
v -0.638195 -0.723609 0.262864
v -0.361800 -0.894429 0.262863
v -0.447211 -0.723611 0.525727
v -0.447211 -0.723611 -0.525727
v -0.361800 -0.894429 -0.262863
v -0.638195 -0.723609 -0.262864
v 0.361804 -0.723612 -0.587779
v 0.138197 -0.894430 -0.425320
v 0.052790 -0.723612 -0.688185
v 0.947213 -0.276396 0.162458
v 0.947213 -0.276396 -0.162458
v 1.000000 0.000000 0.000000
v 0.138199 -0.276397 0.951055
v 0.447216 -0.276397 0.850648
v 0.309017 0.000000 0.951056
v -0.861804 -0.276396 0.425322
v -0.670820 -0.276396 0.688190
v -0.809018 0.000000 0.587783
v -0.670820 -0.276396 -0.688190
v -0.861804 -0.276396 -0.425322
v -0.809018 0.000000 -0.587783
v 0.447216 -0.276397 -0.850648
v 0.138199 -0.276397 -0.951055
v 0.309017 0.000000 -0.951056
v 0.670820 0.276396 0.688190
v 0.809018 0.000000 0.587783
v 0.861804 0.276396 0.425322
v -0.447216 0.276397 0.850648
v -0.309017 0.000000 0.951056
v -0.138199 0.276397 0.951055
v -0.947213 0.276396 -0.162458
v -1.000000 0.000000 0.000000
v -0.947213 0.276396 0.162458
v -0.138199 0.276397 -0.951055
v -0.309017 0.000000 -0.951056
v -0.447216 0.276397 -0.850648
v 0.861804 0.276396 -0.425322
v 0.809018 0.000000 -0.587783
v 0.670820 0.276396 -0.688190
v 0.447211 0.723611 0.525727
v 0.638195 0.723609 0.262864
v 0.361800 0.894429 0.262863
v -0.361804 0.723612 0.587779
v -0.052790 0.723612 0.688185
v -0.138197 0.894430 0.425320
v -0.670817 0.723611 -0.162457
v -0.670817 0.723611 0.162457
v -0.447210 0.894429 0.000000
v -0.052790 0.723612 -0.688185
v -0.361804 0.723612 -0.587779
v -0.138197 0.894430 -0.425320
v 0.638195 0.723609 -0.262864
v 0.447211 0.723611 -0.525727
v 0.361800 0.894429 -0.262863
vt 0.045723 0.126758
vt 0.015838 0.185680
vt 0.000000 0.132966
vt 0.037330 0.074302
vt 0.087655 0.072819
vt 0.848247 0.042231
vt 0.913782 0.042164
vt 0.892631 0.078885
vt 0.109233 0.129738
vt 0.071476 0.189072
vt 0.136641 0.191347
vt 0.106111 0.240728
vt 0.080354 0.285307
vt 0.043319 0.237782
vt 0.169619 0.140924
vt 0.144157 0.079315
vt 0.202535 0.093297
vt 0.167197 0.251617
vt 0.197910 0.304646
vt 0.137958 0.299619
vt 0.204954 0.192282
vt 0.237165 0.251846
vt 0.269727 0.191784
vt 0.292976 0.241342
vt 0.306772 0.286051
vt 0.255647 0.300006
vt 0.238795 0.141151
vt 0.731779 0.100975
vt 0.787435 0.126317
vt 0.737271 0.158775
vt 0.684231 0.137151
vt 0.685392 0.084716
vt 0.693897 0.193896
vt 0.739545 0.043564
vt 0.793191 0.065435
vt 0.074021 0.026160
vt 0.137531 0.029141
vt 0.840570 0.098993
vt 0.802205 0.017114
vt 0.197597 0.041465
vt 0.190467 0.000000
vt 0.189386 0.426977
vt 0.236175 0.476222
vt 0.177749 0.485200
vt 0.128189 0.438780
vt 0.140827 0.386916
vt 0.118832 0.496889
vt 0.205793 0.371369
vt 0.255920 0.418320
vt 0.267382 0.370450
vt 0.305883 0.415660
vt 0.334139 0.468874
vt 0.289662 0.470639
vt 0.250741 0.029513
vt 0.256087 0.079683
vt 0.155786 0.345245
vt 0.959012 0.368513
vt 0.983599 0.429414
vt 0.938825 0.402099
vt 0.342116 0.238764
vt 0.324622 0.189904
vt 0.906116 0.345312
vt 0.884890 0.381989
vt 0.292410 0.130340
vt 0.342112 0.127732
vt 0.025912 0.454526
vt 0.034838 0.395507
vt 0.078845 0.415570
vt 0.095252 0.359962
vt 0.068457 0.473923
vt 0.302994 0.073526
vt 0.665729 0.407959
vt 0.648858 0.454641
vt 0.618948 0.402693
vt 0.094849 0.333070
vt 0.155806 0.345015
vt 0.225774 0.345245
vt 0.785478 0.368336
vt 0.723993 0.403751
vt 0.731877 0.346355
vt 0.677640 0.387397
vt 0.779597 0.429207
vt 0.729367 0.461562
vt 0.685921 0.496594
vt 0.676371 0.439830
vt 0.832788 0.401992
vt 0.840582 0.345245
vt 0.423223 0.392342
vt 0.392354 0.451583
vt 0.370706 0.412960
vt 0.946608 0.098885
vt 0.966726 0.065257
vt 0.462922 0.345245
vt 0.407386 0.357688
vt 0.491542 0.385293
vt 0.454442 0.441198
vt 0.522303 0.438174
vt 0.490763 0.488168
vt 0.460948 0.540312
vt 0.423217 0.495138
vt 0.553167 0.394133
vt 0.522301 0.345830
vt 0.036358 0.294853
vt 0.000925 0.243816
vt 0.785499 0.193802
vt 0.787573 0.261283
vt 0.737343 0.228928
vt 0.846912 0.158262
vt 0.846985 0.229217
vt 0.904387 0.193681
vt 0.901483 0.253360
vt 0.892866 0.308501
vt 0.840764 0.288498
vt 0.901360 0.134008
vt 0.210079 0.538490
vt 0.180188 0.599028
vt 0.148648 0.549033
vt 0.276613 0.529833
vt 0.247179 0.594395
vt 0.306743 0.582560
vt 0.276833 0.634508
vt 0.238888 0.677800
vt 0.211051 0.643068
vt 0.326342 0.525911
vt 0.946258 0.461381
vt 0.896411 0.496809
vt 0.893506 0.437130
vt 0.992024 0.496906
vt 0.946186 0.532337
vt 0.000000 0.568890
vt 0.031219 0.520034
vt 0.050238 0.585619
vt 0.938632 0.591604
vt 0.884655 0.611605
vt 0.893384 0.556482
vt 0.983461 0.564380
vt 0.081101 0.542063
vt 0.552195 0.498711
vt 0.578291 0.560979
vt 0.519865 0.552001
vt 0.589295 0.442806
vt 0.618729 0.507369
vt 0.668458 0.511290
vt 0.676255 0.568327
vt 0.631778 0.566563
vt 0.581004 0.359401
vt 0.954235 0.229108
vt 0.991575 0.261076
vt 0.946801 0.288390
vt 0.954162 0.158152
vt 1.000000 0.193584
vt 0.373335 0.517167
vt 0.342116 0.468311
vt 0.410573 0.563279
vt 0.368028 0.582676
vt 0.991438 0.126109
vt 0.528425 0.345015
vt 0.486321 0.304646
vt 0.546273 0.299619
vt 0.589382 0.333070
vt 0.323613 0.629243
vt 0.603877 0.285307
vt 0.739853 0.344135
vt 0.685616 0.303093
vt 0.731970 0.286739
vt 0.793455 0.322154
vt 0.458457 0.345245
vt 0.848558 0.345245
vt 0.428584 0.300006
vt 0.684347 0.250660
vt 0.081108 0.644859
vt 0.120806 0.691956
vt 0.065271 0.679514
vt 0.905805 0.648326
vt 0.958750 0.625233
vt 0.028590 0.624241
vt 0.112327 0.596003
vt 0.149427 0.651908
vt 0.647873 0.294853
vt 0.640912 0.237782
vt 0.180186 0.691371
vt 0.683306 0.243816
vt 0.668394 0.185680
vt 0.777523 0.496688
vt 0.779459 0.564173
vt 0.729295 0.531715
vt 0.839008 0.461273
vt 0.838935 0.532228
vt 0.832594 0.591496
vt 0.531502 0.610225
vt 0.482943 0.650285
vt 0.470304 0.598421
vt 0.598036 0.618881
vt 0.547908 0.665832
vt 0.609497 0.666752
vt 0.486634 0.041465
vt 0.481696 0.093297
vt 0.428144 0.079683
vt 0.433490 0.029513
vt 0.493764 0.000000
vt 0.497901 0.691956
vt 0.647999 0.621542
vt 0.359609 0.189904
vt 0.414504 0.191784
vt 0.391255 0.241342
vt 0.966989 0.321977
vt 0.914092 0.345178
vt 0.376953 0.641695
vt 0.420960 0.621631
vt 0.342119 0.127732
vt 0.391821 0.130340
vt 0.437368 0.677239
vt 0.445436 0.141151
vt 0.381237 0.073526
vt 0.517034 0.251616
vt 0.547590 0.191347
vt 0.578120 0.240728
vt 0.447066 0.251846
vt 0.479277 0.192282
vt 0.514612 0.140924
vt 0.377459 0.286051
vt 0.638508 0.126758
vt 0.596576 0.072819
vt 0.646901 0.074302
vt 0.684231 0.132966
vt 0.840271 0.648259
vt 0.612755 0.189072
vt 0.574998 0.129738
vt 0.540074 0.079315
vt 0.723803 0.589514
vt 0.677416 0.605774
vt 0.676255 0.553339
vt 0.785215 0.625055
vt 0.731568 0.646926
vt 0.546700 0.029141
vt 0.610210 0.026160
vt 0.794229 0.673376
vn 0.060305 -0.728202 0.682669
vn 0.262856 -0.525712 0.808985
vn -0.009033 -0.505417 0.862819
vn -0.228523 -0.673086 0.703330
vn -0.162450 -0.850642 0.499985
vn -0.276376 -0.447218 0.850642
vn 0.141057 -0.889706 0.434126
vn 0.352458 -0.728202 0.587725
vn 0.425306 -0.850642 0.309000
vn 0.598285 -0.673086 0.434675
vn 0.723594 -0.447218 0.525712
vn 0.514481 -0.505417 0.692709
vn 0.219459 -0.962493 0.159459
vn -0.083834 -0.962493 0.258003
vn 0.000000 -1.000000 0.000000
vn 0.667898 -0.728202 0.153600
vn 0.850642 -0.525712 0.000000
vn 0.817774 -0.505417 0.275216
vn 0.456465 -0.889706 0.000000
vn 0.667898 -0.728202 -0.153600
vn 0.425306 -0.850642 -0.309000
vn 0.598285 -0.673086 -0.434675
vn 0.723594 -0.447218 -0.525712
vn 0.817774 -0.505417 -0.275216
vn 0.219459 -0.962493 -0.159459
vn -0.630634 -0.728202 0.268288
vn -0.688162 -0.525712 0.499985
vn -0.823359 -0.505417 0.258003
vn -0.739525 -0.673086 0.000000
vn -0.525712 -0.850642 0.000000
vn -0.894406 -0.447188 0.000000
vn -0.369274 -0.889706 0.268288
vn -0.450056 -0.728202 0.516831
vn -0.499802 -0.505417 0.703330
vn -0.271279 -0.962493 0.000000
vn -0.450056 -0.728202 -0.516831
vn -0.688162 -0.525712 -0.499985
vn -0.499802 -0.505417 -0.703330
vn -0.228523 -0.673086 -0.703330
vn -0.162450 -0.850642 -0.499985
vn -0.276376 -0.447218 -0.850642
vn -0.369274 -0.889706 -0.268288
vn -0.630634 -0.728202 -0.268288
vn -0.823359 -0.505417 -0.258003
vn -0.083834 -0.962493 -0.258003
vn 0.352458 -0.728202 -0.587725
vn 0.262856 -0.525712 -0.808985
vn 0.514481 -0.505417 -0.692709
vn 0.141057 -0.889706 -0.434126
vn 0.060305 -0.728202 -0.682669
vn -0.009033 -0.505417 -0.862819
vn 0.950011 -0.271706 0.153600
vn 0.951048 0.000000 0.309000
vn 0.869594 -0.234107 0.434675
vn 0.950011 -0.271706 -0.153600
vn 0.999939 -0.010376 0.000000
vn 0.951048 0.000000 -0.309000
vn 0.959014 0.234107 -0.159459
vn 0.894406 0.447188 0.000000
vn 0.959014 0.234107 0.159459
vn 0.869594 -0.234107 -0.434675
vn 0.147465 -0.271706 0.950987
vn 0.000000 0.000000 1.000000
vn -0.144688 -0.234107 0.961364
vn 0.439650 -0.271706 0.856044
vn 0.309000 -0.010376 0.950987
vn 0.587756 0.000000 0.809015
vn 0.448012 0.234107 0.862819
vn 0.276376 0.447218 0.850642
vn 0.144688 0.234107 0.961364
vn 0.682150 -0.234107 0.692709
vn -0.858882 -0.271706 0.434126
vn -0.951048 0.000000 0.309000
vn -0.959014 -0.234107 0.159459
vn -0.678304 -0.271706 0.682669
vn -0.808954 -0.010376 0.587725
vn -0.587756 0.000000 0.809015
vn -0.682150 0.234107 0.692709
vn -0.723594 0.447218 0.525712
vn -0.869594 0.234107 0.434675
vn -0.448012 -0.234107 0.862819
vn -0.678304 -0.271706 -0.682669
vn -0.587756 0.000000 -0.809015
vn -0.448012 -0.234107 -0.862819
vn -0.858882 -0.271706 -0.434126
vn -0.808954 -0.010376 -0.587725
vn -0.951048 0.000000 -0.309000
vn -0.869594 0.234107 -0.434675
vn -0.723594 0.447218 -0.525712
vn -0.682150 0.234107 -0.692709
vn -0.959014 -0.234107 -0.159459
vn 0.439650 -0.271706 -0.856044
vn 0.587756 0.000000 -0.809015
vn 0.682150 -0.234107 -0.692709
vn 0.147465 -0.271706 -0.950987
vn 0.309000 -0.010376 -0.950987
vn 0.000000 0.000000 -1.000000
vn 0.144688 0.234107 -0.961364
vn 0.276376 0.447218 -0.850642
vn 0.448012 0.234107 -0.862819
vn -0.144688 -0.234107 -0.961364
vn 0.678304 0.271706 0.682669
vn 0.688162 0.525712 0.499985
vn 0.499802 0.505417 0.703330
vn 0.808954 0.010376 0.587725
vn 0.858882 0.271706 0.434126
vn 0.823359 0.505417 0.258003
vn -0.439650 0.271706 0.856044
vn -0.262856 0.525712 0.808985
vn -0.514481 0.505417 0.692709
vn -0.309000 0.010376 0.950987
vn -0.147465 0.271706 0.950987
vn 0.009033 0.505417 0.862819
vn -0.950011 0.271706 -0.153600
vn -0.850642 0.525712 0.000000
vn -0.817774 0.505417 -0.275216
vn -0.999939 0.010376 0.000000
vn -0.950011 0.271706 0.153600
vn -0.817774 0.505417 0.275216
vn -0.147465 0.271706 -0.950987
vn -0.262856 0.525712 -0.808985
vn 0.009033 0.505417 -0.862819
vn -0.309000 0.010376 -0.950987
vn -0.439650 0.271706 -0.856044
vn -0.514481 0.505417 -0.692709
vn 0.858882 0.271706 -0.434126
vn 0.688162 0.525712 -0.499985
vn 0.823359 0.505417 -0.258003
vn 0.808954 0.010376 -0.587725
vn 0.678304 0.271706 -0.682669
vn 0.499802 0.505417 -0.703330
vn 0.450056 0.728202 0.516831
vn 0.162450 0.850642 0.499985
vn 0.228523 0.673086 0.703330
vn 0.630634 0.728202 0.268288
vn 0.369274 0.889706 0.268288
vn 0.525712 0.850642 0.000000
vn 0.271279 0.962493 0.000000
vn 0.000000 1.000000 0.000000
vn 0.083834 0.962493 0.258003
vn 0.739525 0.673086 0.000000
vn -0.352458 0.728202 0.587725
vn -0.425306 0.850642 0.309000
vn -0.598285 0.673086 0.434675
vn -0.060305 0.728202 0.682669
vn -0.141057 0.889706 0.434126
vn -0.219459 0.962493 0.159459
vn -0.667898 0.728202 -0.153600
vn -0.425306 0.850642 -0.309000
vn -0.598285 0.673086 -0.434675
vn -0.667898 0.728202 0.153600
vn -0.456465 0.889706 0.000000
vn -0.219459 0.962493 -0.159459
vn -0.060305 0.728202 -0.682669
vn 0.162450 0.850642 -0.499985
vn 0.228523 0.673086 -0.703330
vn -0.352458 0.728202 -0.587725
vn -0.141057 0.889706 -0.434126
vn 0.083834 0.962493 -0.258003
vn 0.630634 0.728202 -0.268288
vn 0.450056 0.728202 -0.516831
vn 0.369274 0.889706 -0.268288
usemtl _normaltest
s 1
f 103/1/1 15/2/2 47/3/3
f 47/3/3 43/4/4 103/1/1
f 13/5/5 103/1/1 43/4/4
f 43/6/4 47/7/3 3/8/6
f 103/1/1 13/5/5 104/9/7
f 104/9/7 105/10/8 103/1/1
f 15/2/2 103/1/1 105/10/8
f 105/10/8 104/9/7 14/11/9
f 46/12/10 2/13/11 48/14/12
f 48/14/12 105/10/8 46/12/10
f 14/11/9 46/12/10 105/10/8
f 105/10/8 48/14/12 15/2/2
f 45/15/13 14/11/9 104/9/7
f 104/9/7 44/16/14 45/15/13
f 1/17/15 45/15/13 44/16/14
f 44/16/14 104/9/7 13/5/5
f 106/18/16 17/19/17 52/20/18
f 52/20/18 46/12/10 106/18/16
f 14/11/9 106/18/16 46/12/10
f 46/12/10 52/20/18 2/13/11
f 106/18/16 14/11/9 107/21/19
f 107/21/19 108/22/20 106/18/16
f 17/19/17 106/18/16 108/22/20
f 108/22/20 107/21/19 16/23/21
f 49/24/22 6/25/23 51/26/24
f 51/26/24 108/22/20 49/24/22
f 16/23/21 49/24/22 108/22/20
f 108/22/20 51/26/24 17/19/17
f 50/27/25 16/23/21 107/21/19
f 107/21/19 45/15/13 50/27/25
f 1/17/15 50/27/25 45/15/13
f 45/15/13 107/21/19 14/11/9
f 109/28/26 19/29/27 55/30/28
f 55/30/28 53/31/29 109/28/26
f 18/32/30 109/28/26 53/31/29
f 53/31/29 55/30/28 4/33/31
f 109/28/26 18/32/30 110/34/32
f 110/34/32 111/35/33 109/28/26
f 19/29/27 109/28/26 111/35/33
f 111/36/33 110/37/32 13/5/5
f 43/6/4 3/8/6 56/38/34
f 56/38/34 111/35/33 43/6/4
f 13/39/5 43/6/4 111/35/33
f 111/35/33 56/38/34 19/29/27
f 44/16/14 13/5/5 110/37/32
f 110/37/32 54/40/35 44/16/14
f 1/17/15 44/16/14 54/40/35
f 54/40/35 110/37/32 18/41/30
f 112/42/36 21/43/37 60/44/38
f 60/44/38 58/45/39 112/42/36
f 20/46/40 112/42/36 58/45/39
f 58/45/39 60/44/38 5/47/41
f 112/42/36 20/46/40 113/48/42
f 113/48/42 114/49/43 112/42/36
f 21/43/37 112/42/36 114/49/43
f 114/49/43 113/48/42 18/50/30
f 53/51/29 4/52/31 59/53/44
f 59/53/44 114/49/43 53/51/29
f 18/50/30 53/51/29 114/49/43
f 114/49/43 59/53/44 21/43/37
f 54/40/35 18/41/30 113/54/42
f 113/54/42 57/55/45 54/40/35
f 1/17/15 54/40/35 57/55/45
f 57/56/45 113/48/42 20/46/40
f 115/57/46 22/58/47 61/59/48
f 61/60/48 49/24/22 115/61/46
f 16/23/21 115/61/46 49/24/22
f 49/62/22 61/59/48 6/63/23
f 115/61/46 16/23/21 116/64/49
f 116/64/49 117/65/50 115/61/46
f 22/66/47 115/67/46 117/68/50
f 117/68/50 116/69/49 20/46/40
f 58/45/39 5/47/41 62/70/51
f 62/70/51 117/68/50 58/45/39
f 20/46/40 58/45/39 117/68/50
f 117/68/50 62/70/51 22/66/47
f 57/55/45 20/71/40 116/64/49
f 116/64/49 50/27/25 57/55/45
f 1/17/15 57/55/45 50/27/25
f 50/27/25 116/64/49 16/23/21
f 118/72/52 24/73/53 66/74/54
f 66/75/54 52/20/18 118/76/52
f 17/19/17 118/76/52 52/20/18
f 52/20/18 66/75/54 2/13/11
f 118/76/52 17/19/17 119/77/55
f 119/78/55 120/79/56 118/80/52
f 24/81/53 118/80/52 120/79/56
f 120/79/56 119/78/55 23/82/57
f 63/83/58 11/84/59 65/85/60
f 65/85/60 120/79/56 63/83/58
f 23/82/57 63/83/58 120/79/56
f 120/79/56 65/85/60 24/81/53
f 64/86/61 23/82/57 119/78/55
f 119/78/55 51/87/24 64/86/61
f 6/63/23 64/86/61 51/87/24
f 51/26/24 119/77/55 17/19/17
f 121/88/62 26/89/63 70/90/64
f 70/91/64 47/7/3 121/92/62
f 15/93/2 121/88/62 47/94/3
f 47/7/3 70/91/64 3/8/6
f 121/88/62 15/93/2 122/95/65
f 122/95/65 123/96/66 121/88/62
f 26/89/63 121/88/62 123/96/66
f 123/96/66 122/95/65 25/97/67
f 67/98/68 7/99/69 69/100/70
f 69/100/70 123/96/66 67/98/68
f 25/97/67 67/98/68 123/96/66
f 123/96/66 69/100/70 26/89/63
f 68/101/71 25/97/67 122/95/65
f 122/95/65 48/102/12 68/101/71
f 2/13/11 68/103/71 48/14/12
f 48/14/12 122/104/65 15/2/2
f 124/105/72 28/106/73 73/107/74
f 73/107/74 55/30/28 124/105/72
f 19/29/27 124/105/72 55/30/28
f 55/30/28 73/107/74 4/33/31
f 124/105/72 19/29/27 125/108/75
f 125/108/75 126/109/76 124/105/72
f 28/106/73 124/105/72 126/109/76
f 126/109/76 125/108/75 27/110/77
f 72/111/78 8/112/79 74/113/80
f 74/113/80 126/109/76 72/111/78
f 27/110/77 72/111/78 126/109/76
f 126/109/76 74/113/80 28/106/73
f 71/114/81 27/110/77 125/108/75
f 125/108/75 56/38/34 71/114/81
f 3/8/6 71/114/81 56/38/34
f 56/38/34 125/108/75 19/29/27
f 127/115/82 30/116/83 78/117/84
f 78/117/84 60/44/38 127/115/82
f 21/43/37 127/115/82 60/44/38
f 60/44/38 78/117/84 5/47/41
f 127/115/82 21/43/37 128/118/85
f 128/118/85 129/119/86 127/115/82
f 30/116/83 127/115/82 129/119/86
f 129/119/86 128/118/85 29/120/87
f 76/121/88 9/122/89 77/123/90
f 77/123/90 129/119/86 76/121/88
f 29/120/87 76/121/88 129/119/86
f 129/119/86 77/123/90 30/116/83
f 75/124/91 29/120/87 128/118/85
f 128/118/85 59/53/44 75/124/91
f 4/52/31 75/124/91 59/53/44
f 59/53/44 128/118/85 21/43/37
f 130/125/92 32/126/93 82/127/94
f 82/127/94 61/59/48 130/125/92
f 22/58/47 130/125/92 61/59/48
f 61/59/48 82/127/94 6/63/23
f 130/125/92 22/58/47 131/128/95
f 131/128/95 132/129/96 130/125/92
f 32/126/93 130/125/92 132/129/96
f 132/130/96 131/131/95 31/132/97
f 79/133/98 10/134/99 81/135/100
f 81/135/100 132/129/96 79/133/98
f 31/136/97 79/133/98 132/129/96
f 132/129/96 81/135/100 32/126/93
f 80/137/101 31/132/97 131/131/95
f 131/131/95 62/70/51 80/137/101
f 5/47/41 80/137/101 62/70/51
f 62/70/51 131/131/95 22/66/47
f 133/138/102 33/139/103 83/140/104
f 83/140/104 67/98/68 133/138/102
f 25/97/67 133/138/102 67/98/68
f 67/98/68 83/140/104 7/99/69
f 133/138/102 25/97/67 134/141/105
f 134/141/105 135/142/106 133/138/102
f 33/139/103 133/138/102 135/142/106
f 135/142/106 134/141/105 24/73/53
f 65/143/60 11/144/59 84/145/107
f 84/145/107 135/142/106 65/143/60
f 24/73/53 65/143/60 135/142/106
f 135/142/106 84/145/107 33/139/103
f 66/74/54 24/73/53 134/141/105
f 134/141/105 68/101/71 66/74/54
f 2/146/11 66/74/54 68/101/71
f 68/101/71 134/141/105 25/97/67
f 136/147/108 34/148/109 86/149/110
f 86/149/110 72/111/78 136/147/108
f 27/110/77 136/147/108 72/111/78
f 72/111/78 86/149/110 8/112/79
f 136/147/108 27/110/77 137/150/111
f 137/150/111 138/151/112 136/147/108
f 34/148/109 136/147/108 138/151/112
f 138/152/112 137/153/111 26/89/63
f 69/100/70 7/99/69 85/154/113
f 85/154/113 138/152/112 69/100/70
f 26/89/63 69/100/70 138/152/112
f 138/152/112 85/154/113 34/155/109
f 70/91/64 26/156/63 137/150/111
f 137/150/111 71/114/81 70/91/64
f 3/8/6 70/91/64 71/114/81
f 71/114/81 137/150/111 27/110/77
f 139/157/114 35/158/115 88/159/116
f 88/159/116 76/160/88 139/157/114
f 29/120/87 139/161/114 76/121/88
f 76/160/88 88/159/116 9/162/89
f 139/163/114 29/164/87 140/165/117
f 140/165/117 141/166/118 139/163/114
f 35/158/115 139/157/114 141/167/118
f 141/166/118 140/165/117 28/106/73
f 74/113/80 8/112/79 87/168/119
f 87/168/119 141/166/118 74/113/80
f 28/106/73 74/113/80 141/166/118
f 141/167/118 87/169/119 35/158/115
f 73/107/74 28/106/73 140/165/117
f 140/165/117 75/170/91 73/107/74
f 4/33/31 73/107/74 75/170/91
f 75/170/91 140/165/117 29/164/87
f 142/171/120 36/172/121 89/173/122
f 89/174/122 79/133/98 142/175/120
f 31/132/97 142/171/120 79/176/98
f 79/133/98 89/174/122 10/134/99
f 142/171/120 31/132/97 143/177/123
f 143/177/123 144/178/124 142/171/120
f 36/172/121 142/171/120 144/178/124
f 144/178/124 143/177/123 30/116/83
f 77/179/90 9/162/89 90/180/125
f 90/181/125 144/178/124 77/123/90
f 30/116/83 77/123/90 144/178/124
f 144/182/124 90/180/125 36/183/121
f 78/117/84 30/116/83 143/177/123
f 143/177/123 80/137/101 78/117/84
f 5/47/41 78/117/84 80/137/101
f 80/137/101 143/177/123 31/132/97
f 145/184/126 37/185/127 92/186/128
f 92/186/128 63/83/58 145/184/126
f 23/82/57 145/184/126 63/83/58
f 63/83/58 92/186/128 11/84/59
f 145/184/126 23/82/57 146/187/129
f 146/187/129 147/188/130 145/184/126
f 37/185/127 145/184/126 147/188/130
f 147/188/130 146/187/129 32/126/93
f 81/135/100 10/134/99 91/189/131
f 91/189/131 147/188/130 81/135/100
f 32/126/93 81/135/100 147/188/130
f 147/188/130 91/189/131 37/185/127
f 82/127/94 32/126/93 146/187/129
f 146/187/129 64/86/61 82/127/94
f 6/63/23 82/127/94 64/86/61
f 64/86/61 146/187/129 23/82/57
f 148/190/132 39/191/133 95/192/134
f 95/192/134 83/140/104 148/190/132
f 33/139/103 148/190/132 83/140/104
f 83/140/104 95/192/134 7/99/69
f 148/190/132 33/139/103 149/193/135
f 149/193/135 150/194/136 148/190/132
f 39/191/133 148/190/132 150/194/136
f 150/194/136 149/193/135 38/195/137
f 93/196/138 12/197/139 96/198/140
f 96/198/140 150/199/136 93/196/138
f 38/200/137 93/196/138 150/199/136
f 150/194/136 96/201/140 39/191/133
f 94/202/141 38/195/137 149/193/135
f 149/193/135 84/145/107 94/202/141
f 11/144/59 94/202/141 84/145/107
f 84/145/107 149/193/135 33/139/103
f 151/203/142 40/204/143 98/205/144
f 98/205/144 86/60/110 151/203/142
f 34/148/109 151/206/142 86/149/110
f 86/149/110 98/207/144 8/112/79
f 151/208/142 34/155/109 152/209/145
f 152/210/145 153/211/146 151/203/142
f 40/204/143 151/203/142 153/211/146
f 153/212/146 152/209/145 39/191/133
f 96/198/140 12/197/139 97/213/147
f 97/213/147 153/211/146 96/198/140
f 39/214/133 96/198/140 153/211/146
f 153/211/146 97/213/147 40/204/143
f 95/192/134 39/191/133 152/209/145
f 152/209/145 85/154/113 95/192/134
f 7/99/69 95/192/134 85/154/113
f 85/154/113 152/209/145 34/155/109
f 154/215/148 41/216/149 100/217/150
f 100/217/150 88/159/116 154/215/148
f 35/158/115 154/215/148 88/159/116
f 88/159/116 100/217/150 9/162/89
f 154/215/148 35/158/115 155/218/151
f 155/218/151 156/219/152 154/215/148
f 41/216/149 154/215/148 156/219/152
f 156/219/152 155/218/151 40/204/143
f 97/213/147 12/197/139 99/220/153
f 99/220/153 156/219/152 97/213/147
f 40/204/143 97/213/147 156/219/152
f 156/219/152 99/220/153 41/216/149
f 98/205/144 40/204/143 155/218/151
f 155/218/151 87/169/119 98/205/144
f 8/221/79 98/205/144 87/169/119
f 87/169/119 155/218/151 35/158/115
f 157/222/154 42/223/155 102/224/156
f 102/224/156 89/225/122 157/222/154
f 36/183/121 157/222/154 89/225/122
f 89/174/122 102/226/156 10/134/99
f 157/222/154 36/183/121 158/227/157
f 158/227/157 159/228/158 157/222/154
f 42/223/155 157/222/154 159/228/158
f 159/228/158 158/227/157 41/216/149
f 99/220/153 12/197/139 101/229/159
f 101/229/159 159/228/158 99/220/153
f 41/216/149 99/220/153 159/228/158
f 159/228/158 101/229/159 42/223/155
f 100/217/150 41/216/149 158/227/157
f 158/227/157 90/180/125 100/217/150
f 9/162/89 100/217/150 90/180/125
f 90/180/125 158/227/157 36/183/121
f 160/230/160 38/231/137 94/232/141
f 94/232/141 92/186/128 160/230/160
f 37/185/127 160/230/160 92/186/128
f 92/186/128 94/232/141 11/84/59
f 160/230/160 37/185/127 161/233/161
f 161/233/161 162/234/162 160/230/160
f 38/231/137 160/230/160 162/234/162
f 162/235/162 161/236/161 42/223/155
f 101/229/159 12/197/139 93/196/138
f 93/196/138 162/235/162 101/229/159
f 42/223/155 101/229/159 162/235/162
f 162/235/162 93/196/138 38/200/137
f 102/226/156 42/237/155 161/233/161
f 161/233/161 91/189/131 102/226/156
f 10/134/99 102/226/156 91/189/131
f 91/189/131 161/233/161 37/185/127
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.
+18
View File
@@ -0,0 +1,18 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 04.05.2010 13:43:14
newmtl shipA_mat
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.0000 0.0000 0.0000
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka s_1024_C.tga
map_Kd s_1024_C.tga
map_Ke s_1024_I.tga
map_bump s_1024_N.tga
File diff suppressed because it is too large Load Diff
+6755
View File
File diff suppressed because it is too large Load Diff
+79
View File
@@ -0,0 +1,79 @@
#include "HeightMap.h"
#include "stb_image.h"
#include <GL/freeglut.h>
#include <iostream>
#include <string>
GLuint imageIndex;
int scale = 50;
HeightMap::HeightMap(const std::string &file)
{
int bpp;
unsigned char* imgData = stbi_load(file.c_str(), &width, &height, &bpp, 4);
for (int h = 0; h < height; h++)
{
for (int w = 0; w < width; w++)
{
int offsets[4][2] = { { 0, 0 },{ 1, 0 },{ 1, 1 },{ 0, 1 } };
for (int i = 0; i < 4; i++)
{
float y = ((float)imgData[((h + offsets[i][0]) + (w + offsets[i][1]) * width) * 4]);
y = (y / 256.0f) * 100.0f;
vertices.push_back(Vertex{ (float)(h + offsets[i][0])*scale, y*scale, (float)(w + offsets[i][1])*scale,
0, 1, 0,
(h + offsets[i][0]) / (float)height, (w + offsets[i][1]) / (float)width } );
}
}
}
glGenTextures(1, &imageIndex);
glBindTexture(GL_TEXTURE_2D, imageIndex);
glTexImage2D(GL_TEXTURE_2D,
0, //level
GL_RGBA, //internal format
width, //width
height, //height
0, //border
GL_RGBA, //data format
GL_UNSIGNED_BYTE, //data type
imgData); //data
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
stbi_image_free(imgData);
}
HeightMap::~HeightMap()
{
}
void HeightMap::Draw()
{
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, imageIndex);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
//glEnableClientState(GL_COLOR_ARRAY);
//glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_FLOAT, sizeof(Vertex), ((float*)vertices.data()) + 0);
glTexCoordPointer(2, GL_FLOAT, sizeof(Vertex), ((float*)vertices.data()) + 6);
//glNormalPointer(GL_FLOAT, sizeof(Vertex), ((float*)cubeVertices.data()) + 3);
glDrawArrays(GL_QUADS, 0, vertices.size());
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
//glDisableClientState(GL_COLOR_ARRAY);
//glDisableClientState(GL_NORMAL_ARRAY);
}
void HeightMap::GetHeigth(float x, float z)
{
}
+32
View File
@@ -0,0 +1,32 @@
#pragma once
#include <string>
#include <vector>
class HeightMap
{
private:
int height;
int width;
public:
HeightMap(const std::string &file);
~HeightMap();
void Draw();
void GetHeigth(float x, float z);
struct Vertex {
float x;
float y;
float z;
float normalX;
float normalY;
float normalZ;
float texX;
float texY;
};
std::vector<Vertex> vertices;
};
+231
View File
@@ -0,0 +1,231 @@
#include <GL/freeglut.h>
#include <cstdio>
#define _USE_MATH_DEFINES
#include <cmath>
#include <vector>
#include "ObjModel.h"
#include "HeightMap.h"
float lastFrameTime = 0;
int width, height;
int currentModel = 0;
vector<ObjModel*> models;
HeightMap *heightmap;
struct Camera
{
float posX = 0;
float posY = -4;
float posZ = 0;
float rotX = 0;
float rotY = 0;
} camera;
bool keys[255];
struct Vertex
{
float x, y, z;
float nx, ny, nz;
float r, g, b, a;
};
std::vector<Vertex> cubeVertices;
float speed = 1000;
void drawCube()
{
glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_FLOAT, sizeof(Vertex), ((float*)cubeVertices.data()) + 0);
glNormalPointer(GL_FLOAT, sizeof(Vertex), ((float*)cubeVertices.data()) + 3);
glColorPointer(4, GL_FLOAT, sizeof(Vertex), ((float*)cubeVertices.data()) + 6);
glDrawArrays(GL_QUADS, 0, cubeVertices.size());
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
}
void display()
{
glClearColor(0.6f, 0.6f, 1, 1);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0f, (float)width/height, 0.1, 100000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef(camera.rotX, 1, 0, 0);
glRotatef(camera.rotY, 0, 1, 0);
glTranslatef(camera.posX, camera.posZ, camera.posY);
float pos[4] = { 0.5, 1, -1, 0 };
glLightfv(GL_LIGHT0, GL_POSITION, pos);
/*
glColor3f(0.1f, 1.0f, 0.2f);
glBegin(GL_QUADS);
glVertex3f(-15, -1, -15);
glVertex3f( 15, -1, -15);
glVertex3f( 15, -1, 15);
glVertex3f(-15, -1, 15);
glEnd();
for (int x = -10; x <= 10; x += 5)
{
for (int y = -10; y <= 10; y += 5)
{
glPushMatrix();
glTranslatef((float)x, 0.0f, (float)y);
drawCube();
glPopMatrix();
}
}
glColor3f(0.1f, 1.0f, 1.0f);
models[currentModel]->draw();
*/
glColor3f(1.0f, 1.0f, 1.0f);
heightmap->Draw();
glutSwapBuffers();
}
void move(float angle, float fac)
{
camera.posX += (float)cos((camera.rotY + angle) / 180 * M_PI) * fac;
camera.posY += (float)sin((camera.rotY + angle) / 180 * M_PI) * fac;
}
void moveVert(float angle, float fac)
{
camera.posZ += angle * fac;
}
void idle()
{
float frameTime = glutGet(GLUT_ELAPSED_TIME)/1000.0f;
float deltaTime = frameTime - lastFrameTime;
lastFrameTime = frameTime;
if (keys['a']) move(0, deltaTime*speed);
if (keys['d']) move(180, deltaTime*speed);
if (keys['w']) move(90, deltaTime*speed);
if (keys['s']) move(270, deltaTime*speed);
if (keys['q']) moveVert(1, deltaTime*speed);
if (keys['e']) moveVert(-1, deltaTime*speed);
if (keys['+']) speed += 100;
if (keys['-']) speed -= speed <= 100 ? 0 : 100;
glutPostRedisplay();
}
bool justMoved = false;
void mousePassiveMotion(int x, int y)
{
if (justMoved)
{
justMoved = false;
return;
}
int dx = x - width / 2;
int dy = y - height / 2;
if ((dx != 0 || dy != 0) && abs(dx) < 400 && abs(dy) < 400)
{
camera.rotY += dx / 10.0f;
camera.rotX += dy / 10.0f;
glutWarpPointer(width / 2, height / 2);
justMoved = true;
}
}
void keyboard(unsigned char key, int, int)
{
if (key == 27)
exit(0);
keys[key] = true;
}
void keyboardUp(unsigned char key, int,int)
{
keys[key] = false;
}
int main(int argc, char* argv[])
{
width = 800;
height = 600;
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(width, height);
glutInit(&argc, argv);
glutCreateWindow("Hello World");
memset(keys, 0, sizeof(keys));
glEnable(GL_DEPTH_TEST);
//glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glutIdleFunc(idle);
glutDisplayFunc(display);
glutReshapeFunc([](int w, int h) { width = w; height = h; glViewport(0, 0, w, h); });
glutKeyboardFunc(keyboard);
glutKeyboardUpFunc(keyboardUp);
glutPassiveMotionFunc(mousePassiveMotion);
heightmap = new HeightMap("worlds/alps.png");
cubeVertices.push_back(Vertex{ -1, -1, -1, 0,0,1, 1,1,1,1 });
cubeVertices.push_back(Vertex{ -1, 1, -1, 0,0,1, 1,1,1,1 });
cubeVertices.push_back(Vertex{ 1, 1, -1, 0,0,1, 1,1,1,1 });
cubeVertices.push_back(Vertex{ 1, -1, -1, 0,0,1, 1,1,1,1 });
cubeVertices.push_back(Vertex{ -1, -1, 1, 0,0,-1, 1,1,1,1 });
cubeVertices.push_back(Vertex{ -1, 1, 1, 0,0,-1, 1,1,1,1 });
cubeVertices.push_back(Vertex{ 1, 1, 1, 0,0,-1, 1,1,1,1 });
cubeVertices.push_back(Vertex{ 1, -1, 1, 0,0,-1, 1,1,1,1 });
cubeVertices.push_back(Vertex{ -1, -1, -1, 0,-1,0, 1,1,1,1 });
cubeVertices.push_back(Vertex{ -1, -1, 1, 0,-1,0, 1,1,1,1 });
cubeVertices.push_back(Vertex{ 1, -1, 1, 0,-1,0, 1,1,1,1 });
cubeVertices.push_back(Vertex{ 1, -1, -1, 0,-1,0, 1,1,1,1 });
cubeVertices.push_back(Vertex{ -1, 1, -1, 0,1,0, 1,1,1,1 });
cubeVertices.push_back(Vertex{ -1, 1, 1, 0,1,0, 1,1,1,1 });
cubeVertices.push_back(Vertex{ 1, 1, 1, 0,1,0, 1,1,1,1 });
cubeVertices.push_back(Vertex{ 1, 1, -1, 0,1,0, 1,1,1,1 });
cubeVertices.push_back(Vertex{ -1, -1, -1, -1,0,0, 1,1,1,1 });
cubeVertices.push_back(Vertex{ -1, -1, 1, -1,0,0, 1,1,1,1 });
cubeVertices.push_back(Vertex{ -1, 1, 1, -1,0,0, 1,1,1,1 });
cubeVertices.push_back(Vertex{ -1, 1, -1, -1,0,0, 1,1,1,1 });
cubeVertices.push_back(Vertex{ 1, -1, -1, 1,0,0, 1,1,1,1 });
cubeVertices.push_back(Vertex{ 1, -1, 1, 1,0,0, 1,1,1,1 });
cubeVertices.push_back(Vertex{ 1, 1, 1, 1,0,0, 1,1,1,1 });
cubeVertices.push_back(Vertex{ 1, 1, -1, 1,0,0, 1,1,1,1 });
models.push_back(new ObjModel("models/ship/shipA_OBJ.obj"));
glutWarpPointer(width / 2, height / 2);
glutMainLoop();
return 0;
}
+326
View File
@@ -0,0 +1,326 @@
#include "ObjModel.h"
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
std::string replace(std::string str, std::string toReplace, std::string replacement)
{
size_t index = 0;
while (true)
{
index = str.find(toReplace, index);
if (index == std::string::npos)
break;
str.replace(index, toReplace.length(), replacement);
++index;
}
return str;
}
std::vector<std::string> split(std::string str, std::string sep)
{
std::vector<std::string> ret;
size_t index;
while(true)
{
index = str.find(sep);
if(index == std::string::npos)
break;
ret.push_back(str.substr(0, index));
str = str.substr(index+1);
}
ret.push_back(str);
return ret;
}
inline std::string toLower(std::string data)
{
std::transform(data.begin(), data.end(), data.begin(), ::tolower);
return data;
}
ObjModel::ObjModel(std::string fileName)
{
std::string dirName = fileName;
if(dirName.rfind("/") != std::string::npos)
dirName = dirName.substr(0, dirName.rfind("/"));
if(dirName.rfind("\\") != std::string::npos)
dirName = dirName.substr(0, dirName.rfind("\\"));
if(fileName == dirName)
dirName = "";
std::ifstream pFile(fileName.c_str());
if (!pFile.is_open())
{
std::cout << "Could not open file " << fileName << std::endl;
return;
}
ObjGroup* currentGroup = new ObjGroup();
currentGroup->materialIndex = -1;
while(!pFile.eof())
{
std::string line;
std::getline(pFile, line);
line = replace(line, "\t", " ");
while(line.find(" ") != std::string::npos)
line = replace(line, " ", " ");
if(line == "")
continue;
if(line[0] == ' ')
line = line.substr(1);
if(line == "")
continue;
if(line[line.length()-1] == ' ')
line = line.substr(0, line.length()-1);
if(line == "")
continue;
if(line[0] == '#')
continue;
std::vector<std::string> params = split(line, " ");
params[0] = toLower(params[0]);
if(params[0] == "v")
vertices.push_back(Vec3f((float)atof(params[1].c_str()), (float)atof(params[2].c_str()), (float)atof(params[3].c_str())));
else if(params[0] == "vn")
normals.push_back(Vec3f((float)atof(params[1].c_str()), (float)atof(params[2].c_str()), (float)atof(params[3].c_str())));
else if(params[0] == "vt")
texcoords.push_back(Vec2f((float)atof(params[1].c_str()), (float)atof(params[2].c_str())));
else if(params[0] == "f")
{
for(size_t ii = 4; ii <= params.size(); ii++)
{
Face face;
for(size_t i = ii-3; i < ii; i++) //magische forlus om van quads triangles te maken ;)
{
Vertex vertex;
std::vector<std::string> indices = split(params[i == (ii-3) ? 1 : i], "/");
if (indices.size() >= 1) //er is een positie
vertex.position = atoi(indices[0].c_str()) - 1;
if(indices.size() == 2) //alleen texture
vertex.texcoord = atoi(indices[1].c_str())-1;
if(indices.size() == 3) //v/t/n of v//n
{
if( indices[1] != "")
vertex.texcoord = atoi(indices[1].c_str())-1;
vertex.normal = atoi(indices[2].c_str())-1;
}
face.vertices.push_back(vertex);
}
currentGroup->faces.push_back(face);
}
}
else if(params[0] == "s")
{//smoothing
}
else if(params[0] == "mtllib")
{
loadMaterialFile(dirName + "/" + params[1], dirName);
}
else if(params[0] == "usemtl")
{
if(currentGroup->faces.size() != 0)
groups.push_back(currentGroup);
currentGroup = new ObjGroup();
currentGroup->materialIndex = -1;
for(size_t i = 0; i < materials.size(); i++)
{
MaterialInfo* info = materials[i];
if(info->name == params[1])
{
currentGroup->materialIndex = i;
break;
}
}
if(currentGroup->materialIndex == -1)
std::cout<<"Could not find material name "<<params[1]<<std::endl;
}
}
groups.push_back(currentGroup);
}
ObjModel::~ObjModel(void)
{
}
void ObjModel::draw()
{
for(auto &g : groups)
{
if (materials[g->materialIndex]->hasTexture)
{
glEnable(GL_TEXTURE_2D);
materials[g->materialIndex]->texture->bind();
}
glBegin(GL_TRIANGLES);
for(auto &f : g->faces)
{
for(auto &v : f.vertices)
{
glNormal3f(normals[v.normal].x, normals[v.normal].y, normals[v.normal].z);
glTexCoord2f(texcoords[v.texcoord].x, texcoords[v.texcoord].y);
glVertex3f(vertices[v.position].x, vertices[v.position].y, vertices[v.position].z);
}
}
glEnd();
}
}
void ObjModel::loadMaterialFile( std::string fileName, std::string dirName )
{
std::ifstream pFile(fileName.c_str());
if (!pFile.is_open())
{
std::cout << "Could not open file " << fileName << std::endl;
return;
}
MaterialInfo* currentMaterial = NULL;
while(!pFile.eof())
{
std::string line;
std::getline(pFile, line);
line = replace(line, "\t", " ");
while(line.find(" ") != std::string::npos)
line = replace(line, " ", " ");
if(line == "")
continue;
if(line[0] == ' ')
line = line.substr(1);
if(line == "")
continue;
if(line[line.length()-1] == ' ')
line = line.substr(0, line.length()-1);
if(line == "")
continue;
if(line[0] == '#')
continue;
std::vector<std::string> params = split(line, " ");
params[0] = toLower(params[0]);
if(params[0] == "newmtl")
{
if(currentMaterial != NULL)
{
materials.push_back(currentMaterial);
}
currentMaterial = new MaterialInfo();
currentMaterial->name = params[1];
}
else if(params[0] == "map_kd")
{
currentMaterial->hasTexture = true;
currentMaterial->texture = new Texture(dirName + "/" + params[1]);
}
else
std::cout<<"Didn't parse "<<params[0]<<" in material file"<<std::endl;
}
if(currentMaterial != NULL)
materials.push_back(currentMaterial);
}
ObjModel::MaterialInfo::MaterialInfo()
{
Texture *texture;
hasTexture = false;
}
Vec3f::Vec3f(float x, float y, float z)
{
this->x = x;
this->y = y;
this->z = z;
}
Vec3f::Vec3f()
{
this->x = 0;
this->y = 0;
this->z = 0;
}
Vec3f::Vec3f(Vec3f &other)
{
this->x = other.x;
this->y = other.y;
this->z = other.z;
}
float& Vec3f::operator [](int index)
{
return v[index];
}
Vec2f::Vec2f(float x, float y)
{
this->x = x;
this->y = y;
}
Vec2f::Vec2f()
{
this->x = 0;
this->y = 0;
}
Vec2f::Vec2f(Vec2f &other)
{
this->x = other.x;
this->y = other.y;
}
float& Vec2f::operator [](int index)
{
return v[index];
}
ObjModel::Texture::Texture(const std::string & fileName)
{
int width, height, bpp;
stbi_set_flip_vertically_on_load(true);
unsigned char* imgData = stbi_load(fileName.c_str(), &width, &height, &bpp, 4);
glGenTextures(1, &index);
glBindTexture(GL_TEXTURE_2D, index);
glTexImage2D(GL_TEXTURE_2D,
0, //level
GL_RGBA, //internal format
width, //width
height, //height
0, //border
GL_RGBA, //data format
GL_UNSIGNED_BYTE, //data type
imgData); //data
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
stbi_image_free(imgData);
}
void ObjModel::Texture::bind()
{
glBindTexture(GL_TEXTURE_2D, index);
}
+101
View File
@@ -0,0 +1,101 @@
#pragma once
#include <string>
#include <vector>
#include <list>
#include <windows.h>
#include <gl/GL.h>
using namespace std;
class Vec3f
{
public:
union
{
struct
{
float x,y,z;
};
float v[3];
};
Vec3f();
Vec3f(Vec3f &other);
Vec3f(float x, float y, float z);
float& operator [](int);
};
class Vec2f
{
public:
union
{
struct
{
float x,y;
};
float v[2];
};
Vec2f();
Vec2f(float x, float y);
Vec2f(Vec2f &other);
float& operator [](int);
};
class ObjModel
{
private:
class Vertex
{
public:
int position;
int normal;
int texcoord;
};
class Face
{
public:
list<Vertex> vertices;
};
class Texture
{
GLuint index;
public:
Texture(const std::string &fileName);
void bind();
};
class MaterialInfo
{
public:
MaterialInfo();
std::string name;
Texture* texture;
bool hasTexture;
};
class ObjGroup
{
public:
std::string name;
int materialIndex;
list<Face> faces;
};
std::vector<Vec3f> vertices;
std::vector<Vec3f> normals;
std::vector<Vec2f> texcoords;
std::vector<ObjGroup*> groups;
std::vector<MaterialInfo*> materials;
void loadMaterialFile(std::string fileName, std::string dirName);
public:
ObjModel(std::string filename);
~ObjModel(void);
void draw();
};
+165
View File
@@ -0,0 +1,165 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{ADE3B882-A837-4B44-8B2F-645FE22BBB39}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>OpenGL4</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>freeglut/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>freeglut/lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>freeglut/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>freeglut/lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>freeglut/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>freeglut/lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>freeglut/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>freeglut/lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="HeightMap.cpp" />
<ClCompile Include="Main.cpp" />
<ClCompile Include="ObjModel.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="HeightMap.h" />
<ClInclude Include="ObjModel.h" />
<ClInclude Include="stb_image.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+39
View File
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ObjModel.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="HeightMap.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="ObjModel.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="stb_image.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="HeightMap.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
Binary file not shown.
+27
View File
@@ -0,0 +1,27 @@
Freeglut Copyright
------------------
Freeglut code without an explicit copyright is covered by the following
copyright:
Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Pawel W. Olszta shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from Pawel W. Olszta.
+106
View File
@@ -0,0 +1,106 @@
freeglut 3.0.0-1.mp for MSVC
This package contains freeglut import libraries, headers, and Windows DLLs.
These allow 32 and 64 bit GLUT applications to be compiled on Windows using
Microsoft Visual C++.
For more information on freeglut, visit http://freeglut.sourceforge.net/.
Installation
Create a folder on your PC which is readable by all users, for example
“C:\Program Files\Common Files\MSVC\freeglut\” on a typical Windows system. Copy
the “lib\” and “include\” folders from this zip archive to that location.
The appropriate freeglut DLL can either be placed in the same folder as your
application, or can be installed in a system-wide folder which appears in your
%PATH% environment variable. Be careful not to mix the 32 bit DLL up with the 64
bit DLL, as they are not interchangeable.
Compiling 32 bit Applications
To create a 32 bit freeglut application, create a new Win32 C++ project in MSVC.
From the “Win32 Application Wizard”, choose a “Windows application”, check the
“Empty project” box, and submit.
Youll now need to configure the compiler and linker settings. Open up the
project properties, and select “All Configurations” (this is necessary to ensure
our changes are applied for both debug and release builds). Open up the
“general” section under “C/C++”, and configure the “include\” folder you created
above as an “Additional Include Directory”. If you have more than one GLUT
package which contains a “glut.h” file, its important to ensure that the
freeglut include folder appears above all other GLUT include folders.
Now open up the “general” section under “Linker”, and configure the “lib\”
folder you created above as an “Additional Library Directory”. A freeglut
application depends on the import libraries “freeglut.lib” and “opengl32.lib”,
which can be configured under the “Input” section. However, it shouldnt be
necessary to explicitly state these dependencies, since the freeglut headers
handle this for you. Now open the “Advanced” section, and enter “mainCRTStartup”
as the “Entry Point” for your application. This is necessary because GLUT
applications use “main” as the application entry point, not “WinMain”—without it
youll get an undefined reference when you try to link your application.
Thats all of your project properties configured, so you can now add source
files to your project and build the application. If you want your application to
be compatible with GLUT, you should “#include <GL/glut.h>”. If you want to use
freeglut specific extensions, you should “#include <GL/freeglut.h>” instead.
Dont forget to either include the freeglut DLL when distributing applications,
or provide your users with some method of obtaining it if they dont already
have it!
Compiling 64 bit Applications
Building 64 bit applications is almost identical to building 32 bit applications.
When you use the configuration manager to add the x64 platform, its easiest to
copy the settings from the Win32 platform. If you do so, its then only necessary
to change the “Additional Library Directories” configuration so that it
references the directory containing the 64 bit import library rather
than the 32 bit one.
Problems?
If you have problems using this package (compiler / linker errors etc.), please
check that you have followed all of the steps in this readme file correctly.
Almost all of the problems which are reported with these packages are due to
missing a step or not doing it correctly, for example trying to build a 32 bit
app against the 64 bit import library. If you have followed all of the steps
correctly but your application still fails to build, try building a very simple
but functional program (the example at
http://www.transmissionzero.co.uk/computing/using-glut-with-mingw/ works fine
with MSVC). A lot of people try to build very complex applications after
installing these packages, and often the error is with the application code or
other library dependencies rather than freeglut.
If you still cant get it working after trying to compile a simple application,
then please get in touch via http://www.transmissionzero.co.uk/contact/,
providing as much detail as you can. Please dont complain to the freeglut guys
unless youre sure its a freeglut bug, and have reproduced the issue after
compiling freeglut from the latest SVN version—if thats still the case, Im
sure they would appreciate a bug report or a patch.
Changelog
20150722: Release 3.0.0-2.mp
• Modified the freeglut_std.h file so that it doesnt try to link against the
freeglutd.lib import library.
20150315: Release 3.0.0-1.mp
• First 3.0.0 MSVC release. Ive built the package using Visual Studio 2013,
and the only change Ive made is to the DLL version resource—Ive changed
the description so that my MinGW and MSVC builds are distinguishable from
each other (and other builds) using Windows Explorer.
Transmission Zero
20150722
http://www.transmissionzero.co.uk/
+22
View File
@@ -0,0 +1,22 @@
#ifndef __FREEGLUT_H__
#define __FREEGLUT_H__
/*
* freeglut.h
*
* The freeglut library include file
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "freeglut_std.h"
#include "freeglut_ext.h"
/*** END OF FILE ***/
#endif /* __FREEGLUT_H__ */
+271
View File
@@ -0,0 +1,271 @@
#ifndef __FREEGLUT_EXT_H__
#define __FREEGLUT_EXT_H__
/*
* freeglut_ext.h
*
* The non-GLUT-compatible extensions to the freeglut library include file
*
* Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
* Written by Pawel W. Olszta, <olszta@sourceforge.net>
* Creation date: Thu Dec 2 1999
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Additional GLUT Key definitions for the Special key function
*/
#define GLUT_KEY_NUM_LOCK 0x006D
#define GLUT_KEY_BEGIN 0x006E
#define GLUT_KEY_DELETE 0x006F
#define GLUT_KEY_SHIFT_L 0x0070
#define GLUT_KEY_SHIFT_R 0x0071
#define GLUT_KEY_CTRL_L 0x0072
#define GLUT_KEY_CTRL_R 0x0073
#define GLUT_KEY_ALT_L 0x0074
#define GLUT_KEY_ALT_R 0x0075
/*
* GLUT API Extension macro definitions -- behaviour when the user clicks on an "x" to close a window
*/
#define GLUT_ACTION_EXIT 0
#define GLUT_ACTION_GLUTMAINLOOP_RETURNS 1
#define GLUT_ACTION_CONTINUE_EXECUTION 2
/*
* Create a new rendering context when the user opens a new window?
*/
#define GLUT_CREATE_NEW_CONTEXT 0
#define GLUT_USE_CURRENT_CONTEXT 1
/*
* Direct/Indirect rendering context options (has meaning only in Unix/X11)
*/
#define GLUT_FORCE_INDIRECT_CONTEXT 0
#define GLUT_ALLOW_DIRECT_CONTEXT 1
#define GLUT_TRY_DIRECT_CONTEXT 2
#define GLUT_FORCE_DIRECT_CONTEXT 3
/*
* GLUT API Extension macro definitions -- the glutGet parameters
*/
#define GLUT_INIT_STATE 0x007C
#define GLUT_ACTION_ON_WINDOW_CLOSE 0x01F9
#define GLUT_WINDOW_BORDER_WIDTH 0x01FA
#define GLUT_WINDOW_BORDER_HEIGHT 0x01FB
#define GLUT_WINDOW_HEADER_HEIGHT 0x01FB /* Docs say it should always have been GLUT_WINDOW_BORDER_HEIGHT, keep this for backward compatibility */
#define GLUT_VERSION 0x01FC
#define GLUT_RENDERING_CONTEXT 0x01FD
#define GLUT_DIRECT_RENDERING 0x01FE
#define GLUT_FULL_SCREEN 0x01FF
#define GLUT_SKIP_STALE_MOTION_EVENTS 0x0204
#define GLUT_GEOMETRY_VISUALIZE_NORMALS 0x0205
#define GLUT_STROKE_FONT_DRAW_JOIN_DOTS 0x0206 /* Draw dots between line segments of stroke fonts? */
/*
* New tokens for glutInitDisplayMode.
* Only one GLUT_AUXn bit may be used at a time.
* Value 0x0400 is defined in OpenGLUT.
*/
#define GLUT_AUX 0x1000
#define GLUT_AUX1 0x1000
#define GLUT_AUX2 0x2000
#define GLUT_AUX3 0x4000
#define GLUT_AUX4 0x8000
/*
* Context-related flags, see fg_state.c
* Set the requested OpenGL version
*/
#define GLUT_INIT_MAJOR_VERSION 0x0200
#define GLUT_INIT_MINOR_VERSION 0x0201
#define GLUT_INIT_FLAGS 0x0202
#define GLUT_INIT_PROFILE 0x0203
/*
* Flags for glutInitContextFlags, see fg_init.c
*/
#define GLUT_DEBUG 0x0001
#define GLUT_FORWARD_COMPATIBLE 0x0002
/*
* Flags for glutInitContextProfile, see fg_init.c
*/
#define GLUT_CORE_PROFILE 0x0001
#define GLUT_COMPATIBILITY_PROFILE 0x0002
/*
* Process loop function, see fg_main.c
*/
FGAPI void FGAPIENTRY glutMainLoopEvent( void );
FGAPI void FGAPIENTRY glutLeaveMainLoop( void );
FGAPI void FGAPIENTRY glutExit ( void );
/*
* Window management functions, see fg_window.c
*/
FGAPI void FGAPIENTRY glutFullScreenToggle( void );
FGAPI void FGAPIENTRY glutLeaveFullScreen( void );
/*
* Menu functions
*/
FGAPI void FGAPIENTRY glutSetMenuFont( int menuID, void* font );
/*
* Window-specific callback functions, see fg_callbacks.c
*/
FGAPI void FGAPIENTRY glutMouseWheelFunc( void (* callback)( int, int, int, int ) );
FGAPI void FGAPIENTRY glutPositionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutCloseFunc( void (* callback)( void ) );
FGAPI void FGAPIENTRY glutWMCloseFunc( void (* callback)( void ) );
/* And also a destruction callback for menus */
FGAPI void FGAPIENTRY glutMenuDestroyFunc( void (* callback)( void ) );
/*
* State setting and retrieval functions, see fg_state.c
*/
FGAPI void FGAPIENTRY glutSetOption ( GLenum option_flag, int value );
FGAPI int * FGAPIENTRY glutGetModeValues(GLenum mode, int * size);
/* A.Donev: User-data manipulation */
FGAPI void* FGAPIENTRY glutGetWindowData( void );
FGAPI void FGAPIENTRY glutSetWindowData(void* data);
FGAPI void* FGAPIENTRY glutGetMenuData( void );
FGAPI void FGAPIENTRY glutSetMenuData(void* data);
/*
* Font stuff, see fg_font.c
*/
FGAPI int FGAPIENTRY glutBitmapHeight( void* font );
FGAPI GLfloat FGAPIENTRY glutStrokeHeight( void* font );
FGAPI void FGAPIENTRY glutBitmapString( void* font, const unsigned char *string );
FGAPI void FGAPIENTRY glutStrokeString( void* font, const unsigned char *string );
/*
* Geometry functions, see fg_geometry.c
*/
FGAPI void FGAPIENTRY glutWireRhombicDodecahedron( void );
FGAPI void FGAPIENTRY glutSolidRhombicDodecahedron( void );
FGAPI void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, double offset[3], double scale );
FGAPI void FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, double offset[3], double scale );
FGAPI void FGAPIENTRY glutWireCylinder( double radius, double height, GLint slices, GLint stacks);
FGAPI void FGAPIENTRY glutSolidCylinder( double radius, double height, GLint slices, GLint stacks);
/*
* Rest of functions for rendering Newell's teaset, found in fg_teapot.c
* NB: front facing polygons have clockwise winding, not counter clockwise
*/
FGAPI void FGAPIENTRY glutWireTeacup( double size );
FGAPI void FGAPIENTRY glutSolidTeacup( double size );
FGAPI void FGAPIENTRY glutWireTeaspoon( double size );
FGAPI void FGAPIENTRY glutSolidTeaspoon( double size );
/*
* Extension functions, see fg_ext.c
*/
typedef void (*GLUTproc)();
FGAPI GLUTproc FGAPIENTRY glutGetProcAddress( const char *procName );
/*
* Multi-touch/multi-pointer extensions
*/
#define GLUT_HAS_MULTI 1
/* TODO: add device_id parameter,
cf. http://sourceforge.net/mailarchive/forum.php?thread_name=20120518071314.GA28061%40perso.beuc.net&forum_name=freeglut-developer */
FGAPI void FGAPIENTRY glutMultiEntryFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutMultiButtonFunc( void (* callback)( int, int, int, int, int ) );
FGAPI void FGAPIENTRY glutMultiMotionFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutMultiPassiveFunc( void (* callback)( int, int, int ) );
/*
* Joystick functions, see fg_joystick.c
*/
/* USE OF THESE FUNCTIONS IS DEPRECATED !!!!! */
/* If you have a serious need for these functions in your application, please either
* contact the "freeglut" developer community at freeglut-developer@lists.sourceforge.net,
* switch to the OpenGLUT library, or else port your joystick functionality over to PLIB's
* "js" library.
*/
int glutJoystickGetNumAxes( int ident );
int glutJoystickGetNumButtons( int ident );
int glutJoystickNotWorking( int ident );
float glutJoystickGetDeadBand( int ident, int axis );
void glutJoystickSetDeadBand( int ident, int axis, float db );
float glutJoystickGetSaturation( int ident, int axis );
void glutJoystickSetSaturation( int ident, int axis, float st );
void glutJoystickSetMinRange( int ident, float *axes );
void glutJoystickSetMaxRange( int ident, float *axes );
void glutJoystickSetCenter( int ident, float *axes );
void glutJoystickGetMinRange( int ident, float *axes );
void glutJoystickGetMaxRange( int ident, float *axes );
void glutJoystickGetCenter( int ident, float *axes );
/*
* Initialization functions, see fg_init.c
*/
/* to get the typedef for va_list */
#include <stdarg.h>
FGAPI void FGAPIENTRY glutInitContextVersion( int majorVersion, int minorVersion );
FGAPI void FGAPIENTRY glutInitContextFlags( int flags );
FGAPI void FGAPIENTRY glutInitContextProfile( int profile );
FGAPI void FGAPIENTRY glutInitErrorFunc( void (* callback)( const char *fmt, va_list ap ) );
FGAPI void FGAPIENTRY glutInitWarningFunc( void (* callback)( const char *fmt, va_list ap ) );
/* OpenGL >= 2.0 support */
FGAPI void FGAPIENTRY glutSetVertexAttribCoord3(GLint attrib);
FGAPI void FGAPIENTRY glutSetVertexAttribNormal(GLint attrib);
FGAPI void FGAPIENTRY glutSetVertexAttribTexCoord2(GLint attrib);
/* Mobile platforms lifecycle */
FGAPI void FGAPIENTRY glutInitContextFunc(void (* callback)());
FGAPI void FGAPIENTRY glutAppStatusFunc(void (* callback)(int));
/* state flags that can be passed to callback set by glutAppStatusFunc */
#define GLUT_APPSTATUS_PAUSE 0x0001
#define GLUT_APPSTATUS_RESUME 0x0002
/*
* GLUT API macro definitions -- the display mode definitions
*/
#define GLUT_CAPTIONLESS 0x0400
#define GLUT_BORDERLESS 0x0800
#define GLUT_SRGB 0x1000
#ifdef __cplusplus
}
#endif
/*** END OF FILE ***/
#endif /* __FREEGLUT_EXT_H__ */
+638
View File
@@ -0,0 +1,638 @@
#ifndef __FREEGLUT_STD_H__
#define __FREEGLUT_STD_H__
/*
* freeglut_std.h
*
* The GLUT-compatible part of the freeglut library include file
*
* Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
* Written by Pawel W. Olszta, <olszta@sourceforge.net>
* Creation date: Thu Dec 2 1999
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Under windows, we have to differentiate between static and dynamic libraries
*/
#ifdef _WIN32
/* #pragma may not be supported by some compilers.
* Discussion by FreeGLUT developers suggests that
* Visual C++ specific code involving pragmas may
* need to move to a separate header. 24th Dec 2003
*/
/* Define FREEGLUT_LIB_PRAGMAS to 1 to include library
* pragmas or to 0 to exclude library pragmas.
* The default behavior depends on the compiler/platform.
*/
# ifndef FREEGLUT_LIB_PRAGMAS
# if ( defined(_MSC_VER) || defined(__WATCOMC__) ) && !defined(_WIN32_WCE)
# define FREEGLUT_LIB_PRAGMAS 1
# else
# define FREEGLUT_LIB_PRAGMAS 0
# endif
# endif
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN 1
# endif
# ifndef NOMINMAX
# define NOMINMAX
# endif
# include <windows.h>
/* Windows static library */
# ifdef FREEGLUT_STATIC
#error Static linking is not supported with this build. Please remove the FREEGLUT_STATIC preprocessor directive, or download the source code from http://freeglut.sf.net/ and build against that.
/* Windows shared library (DLL) */
# else
# define FGAPIENTRY __stdcall
# if defined(FREEGLUT_EXPORTS)
# define FGAPI __declspec(dllexport)
# else
# define FGAPI __declspec(dllimport)
/* Link with Win32 shared freeglut lib */
# if FREEGLUT_LIB_PRAGMAS
# pragma comment (lib, "freeglut.lib")
# endif
# endif
# endif
/* Drag in other Windows libraries as required by FreeGLUT */
# if FREEGLUT_LIB_PRAGMAS
# pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */
# pragma comment (lib, "opengl32.lib") /* link Microsoft OpenGL lib */
# pragma comment (lib, "gdi32.lib") /* link Windows GDI lib */
# pragma comment (lib, "winmm.lib") /* link Windows MultiMedia lib */
# pragma comment (lib, "user32.lib") /* link Windows user lib */
# endif
#else
/* Non-Windows definition of FGAPI and FGAPIENTRY */
# define FGAPI
# define FGAPIENTRY
#endif
/*
* The freeglut and GLUT API versions
*/
#define FREEGLUT 1
#define GLUT_API_VERSION 4
#define GLUT_XLIB_IMPLEMENTATION 13
/* Deprecated:
cf. http://sourceforge.net/mailarchive/forum.php?thread_name=CABcAi1hw7cr4xtigckaGXB5X8wddLfMcbA_rZ3NAuwMrX_zmsw%40mail.gmail.com&forum_name=freeglut-developer */
#define FREEGLUT_VERSION_2_0 1
/*
* Always include OpenGL and GLU headers
*/
/* Note: FREEGLUT_GLES is only used to cleanly bootstrap headers
inclusion here; use GLES constants directly
(e.g. GL_ES_VERSION_2_0) for all other needs */
#ifdef FREEGLUT_GLES
# include <EGL/egl.h>
# include <GLES/gl.h>
# include <GLES2/gl2.h>
#elif __APPLE__
# include <OpenGL/gl.h>
# include <OpenGL/glu.h>
#else
# include <GL/gl.h>
# include <GL/glu.h>
#endif
/*
* GLUT API macro definitions -- the special key codes:
*/
#define GLUT_KEY_F1 0x0001
#define GLUT_KEY_F2 0x0002
#define GLUT_KEY_F3 0x0003
#define GLUT_KEY_F4 0x0004
#define GLUT_KEY_F5 0x0005
#define GLUT_KEY_F6 0x0006
#define GLUT_KEY_F7 0x0007
#define GLUT_KEY_F8 0x0008
#define GLUT_KEY_F9 0x0009
#define GLUT_KEY_F10 0x000A
#define GLUT_KEY_F11 0x000B
#define GLUT_KEY_F12 0x000C
#define GLUT_KEY_LEFT 0x0064
#define GLUT_KEY_UP 0x0065
#define GLUT_KEY_RIGHT 0x0066
#define GLUT_KEY_DOWN 0x0067
#define GLUT_KEY_PAGE_UP 0x0068
#define GLUT_KEY_PAGE_DOWN 0x0069
#define GLUT_KEY_HOME 0x006A
#define GLUT_KEY_END 0x006B
#define GLUT_KEY_INSERT 0x006C
/*
* GLUT API macro definitions -- mouse state definitions
*/
#define GLUT_LEFT_BUTTON 0x0000
#define GLUT_MIDDLE_BUTTON 0x0001
#define GLUT_RIGHT_BUTTON 0x0002
#define GLUT_DOWN 0x0000
#define GLUT_UP 0x0001
#define GLUT_LEFT 0x0000
#define GLUT_ENTERED 0x0001
/*
* GLUT API macro definitions -- the display mode definitions
*/
#define GLUT_RGB 0x0000
#define GLUT_RGBA 0x0000
#define GLUT_INDEX 0x0001
#define GLUT_SINGLE 0x0000
#define GLUT_DOUBLE 0x0002
#define GLUT_ACCUM 0x0004
#define GLUT_ALPHA 0x0008
#define GLUT_DEPTH 0x0010
#define GLUT_STENCIL 0x0020
#define GLUT_MULTISAMPLE 0x0080
#define GLUT_STEREO 0x0100
#define GLUT_LUMINANCE 0x0200
/*
* GLUT API macro definitions -- windows and menu related definitions
*/
#define GLUT_MENU_NOT_IN_USE 0x0000
#define GLUT_MENU_IN_USE 0x0001
#define GLUT_NOT_VISIBLE 0x0000
#define GLUT_VISIBLE 0x0001
#define GLUT_HIDDEN 0x0000
#define GLUT_FULLY_RETAINED 0x0001
#define GLUT_PARTIALLY_RETAINED 0x0002
#define GLUT_FULLY_COVERED 0x0003
/*
* GLUT API macro definitions -- fonts definitions
*
* Steve Baker suggested to make it binary compatible with GLUT:
*/
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__WATCOMC__)
# define GLUT_STROKE_ROMAN ((void *)0x0000)
# define GLUT_STROKE_MONO_ROMAN ((void *)0x0001)
# define GLUT_BITMAP_9_BY_15 ((void *)0x0002)
# define GLUT_BITMAP_8_BY_13 ((void *)0x0003)
# define GLUT_BITMAP_TIMES_ROMAN_10 ((void *)0x0004)
# define GLUT_BITMAP_TIMES_ROMAN_24 ((void *)0x0005)
# define GLUT_BITMAP_HELVETICA_10 ((void *)0x0006)
# define GLUT_BITMAP_HELVETICA_12 ((void *)0x0007)
# define GLUT_BITMAP_HELVETICA_18 ((void *)0x0008)
#else
/*
* I don't really know if it's a good idea... But here it goes:
*/
extern void* glutStrokeRoman;
extern void* glutStrokeMonoRoman;
extern void* glutBitmap9By15;
extern void* glutBitmap8By13;
extern void* glutBitmapTimesRoman10;
extern void* glutBitmapTimesRoman24;
extern void* glutBitmapHelvetica10;
extern void* glutBitmapHelvetica12;
extern void* glutBitmapHelvetica18;
/*
* Those pointers will be used by following definitions:
*/
# define GLUT_STROKE_ROMAN ((void *) &glutStrokeRoman)
# define GLUT_STROKE_MONO_ROMAN ((void *) &glutStrokeMonoRoman)
# define GLUT_BITMAP_9_BY_15 ((void *) &glutBitmap9By15)
# define GLUT_BITMAP_8_BY_13 ((void *) &glutBitmap8By13)
# define GLUT_BITMAP_TIMES_ROMAN_10 ((void *) &glutBitmapTimesRoman10)
# define GLUT_BITMAP_TIMES_ROMAN_24 ((void *) &glutBitmapTimesRoman24)
# define GLUT_BITMAP_HELVETICA_10 ((void *) &glutBitmapHelvetica10)
# define GLUT_BITMAP_HELVETICA_12 ((void *) &glutBitmapHelvetica12)
# define GLUT_BITMAP_HELVETICA_18 ((void *) &glutBitmapHelvetica18)
#endif
/*
* GLUT API macro definitions -- the glutGet parameters
*/
#define GLUT_WINDOW_X 0x0064
#define GLUT_WINDOW_Y 0x0065
#define GLUT_WINDOW_WIDTH 0x0066
#define GLUT_WINDOW_HEIGHT 0x0067
#define GLUT_WINDOW_BUFFER_SIZE 0x0068
#define GLUT_WINDOW_STENCIL_SIZE 0x0069
#define GLUT_WINDOW_DEPTH_SIZE 0x006A
#define GLUT_WINDOW_RED_SIZE 0x006B
#define GLUT_WINDOW_GREEN_SIZE 0x006C
#define GLUT_WINDOW_BLUE_SIZE 0x006D
#define GLUT_WINDOW_ALPHA_SIZE 0x006E
#define GLUT_WINDOW_ACCUM_RED_SIZE 0x006F
#define GLUT_WINDOW_ACCUM_GREEN_SIZE 0x0070
#define GLUT_WINDOW_ACCUM_BLUE_SIZE 0x0071
#define GLUT_WINDOW_ACCUM_ALPHA_SIZE 0x0072
#define GLUT_WINDOW_DOUBLEBUFFER 0x0073
#define GLUT_WINDOW_RGBA 0x0074
#define GLUT_WINDOW_PARENT 0x0075
#define GLUT_WINDOW_NUM_CHILDREN 0x0076
#define GLUT_WINDOW_COLORMAP_SIZE 0x0077
#define GLUT_WINDOW_NUM_SAMPLES 0x0078
#define GLUT_WINDOW_STEREO 0x0079
#define GLUT_WINDOW_CURSOR 0x007A
#define GLUT_SCREEN_WIDTH 0x00C8
#define GLUT_SCREEN_HEIGHT 0x00C9
#define GLUT_SCREEN_WIDTH_MM 0x00CA
#define GLUT_SCREEN_HEIGHT_MM 0x00CB
#define GLUT_MENU_NUM_ITEMS 0x012C
#define GLUT_DISPLAY_MODE_POSSIBLE 0x0190
#define GLUT_INIT_WINDOW_X 0x01F4
#define GLUT_INIT_WINDOW_Y 0x01F5
#define GLUT_INIT_WINDOW_WIDTH 0x01F6
#define GLUT_INIT_WINDOW_HEIGHT 0x01F7
#define GLUT_INIT_DISPLAY_MODE 0x01F8
#define GLUT_ELAPSED_TIME 0x02BC
#define GLUT_WINDOW_FORMAT_ID 0x007B
/*
* GLUT API macro definitions -- the glutDeviceGet parameters
*/
#define GLUT_HAS_KEYBOARD 0x0258
#define GLUT_HAS_MOUSE 0x0259
#define GLUT_HAS_SPACEBALL 0x025A
#define GLUT_HAS_DIAL_AND_BUTTON_BOX 0x025B
#define GLUT_HAS_TABLET 0x025C
#define GLUT_NUM_MOUSE_BUTTONS 0x025D
#define GLUT_NUM_SPACEBALL_BUTTONS 0x025E
#define GLUT_NUM_BUTTON_BOX_BUTTONS 0x025F
#define GLUT_NUM_DIALS 0x0260
#define GLUT_NUM_TABLET_BUTTONS 0x0261
#define GLUT_DEVICE_IGNORE_KEY_REPEAT 0x0262
#define GLUT_DEVICE_KEY_REPEAT 0x0263
#define GLUT_HAS_JOYSTICK 0x0264
#define GLUT_OWNS_JOYSTICK 0x0265
#define GLUT_JOYSTICK_BUTTONS 0x0266
#define GLUT_JOYSTICK_AXES 0x0267
#define GLUT_JOYSTICK_POLL_RATE 0x0268
/*
* GLUT API macro definitions -- the glutLayerGet parameters
*/
#define GLUT_OVERLAY_POSSIBLE 0x0320
#define GLUT_LAYER_IN_USE 0x0321
#define GLUT_HAS_OVERLAY 0x0322
#define GLUT_TRANSPARENT_INDEX 0x0323
#define GLUT_NORMAL_DAMAGED 0x0324
#define GLUT_OVERLAY_DAMAGED 0x0325
/*
* GLUT API macro definitions -- the glutVideoResizeGet parameters
*/
#define GLUT_VIDEO_RESIZE_POSSIBLE 0x0384
#define GLUT_VIDEO_RESIZE_IN_USE 0x0385
#define GLUT_VIDEO_RESIZE_X_DELTA 0x0386
#define GLUT_VIDEO_RESIZE_Y_DELTA 0x0387
#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 0x0388
#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 0x0389
#define GLUT_VIDEO_RESIZE_X 0x038A
#define GLUT_VIDEO_RESIZE_Y 0x038B
#define GLUT_VIDEO_RESIZE_WIDTH 0x038C
#define GLUT_VIDEO_RESIZE_HEIGHT 0x038D
/*
* GLUT API macro definitions -- the glutUseLayer parameters
*/
#define GLUT_NORMAL 0x0000
#define GLUT_OVERLAY 0x0001
/*
* GLUT API macro definitions -- the glutGetModifiers parameters
*/
#define GLUT_ACTIVE_SHIFT 0x0001
#define GLUT_ACTIVE_CTRL 0x0002
#define GLUT_ACTIVE_ALT 0x0004
/*
* GLUT API macro definitions -- the glutSetCursor parameters
*/
#define GLUT_CURSOR_RIGHT_ARROW 0x0000
#define GLUT_CURSOR_LEFT_ARROW 0x0001
#define GLUT_CURSOR_INFO 0x0002
#define GLUT_CURSOR_DESTROY 0x0003
#define GLUT_CURSOR_HELP 0x0004
#define GLUT_CURSOR_CYCLE 0x0005
#define GLUT_CURSOR_SPRAY 0x0006
#define GLUT_CURSOR_WAIT 0x0007
#define GLUT_CURSOR_TEXT 0x0008
#define GLUT_CURSOR_CROSSHAIR 0x0009
#define GLUT_CURSOR_UP_DOWN 0x000A
#define GLUT_CURSOR_LEFT_RIGHT 0x000B
#define GLUT_CURSOR_TOP_SIDE 0x000C
#define GLUT_CURSOR_BOTTOM_SIDE 0x000D
#define GLUT_CURSOR_LEFT_SIDE 0x000E
#define GLUT_CURSOR_RIGHT_SIDE 0x000F
#define GLUT_CURSOR_TOP_LEFT_CORNER 0x0010
#define GLUT_CURSOR_TOP_RIGHT_CORNER 0x0011
#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 0x0012
#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 0x0013
#define GLUT_CURSOR_INHERIT 0x0064
#define GLUT_CURSOR_NONE 0x0065
#define GLUT_CURSOR_FULL_CROSSHAIR 0x0066
/*
* GLUT API macro definitions -- RGB color component specification definitions
*/
#define GLUT_RED 0x0000
#define GLUT_GREEN 0x0001
#define GLUT_BLUE 0x0002
/*
* GLUT API macro definitions -- additional keyboard and joystick definitions
*/
#define GLUT_KEY_REPEAT_OFF 0x0000
#define GLUT_KEY_REPEAT_ON 0x0001
#define GLUT_KEY_REPEAT_DEFAULT 0x0002
#define GLUT_JOYSTICK_BUTTON_A 0x0001
#define GLUT_JOYSTICK_BUTTON_B 0x0002
#define GLUT_JOYSTICK_BUTTON_C 0x0004
#define GLUT_JOYSTICK_BUTTON_D 0x0008
/*
* GLUT API macro definitions -- game mode definitions
*/
#define GLUT_GAME_MODE_ACTIVE 0x0000
#define GLUT_GAME_MODE_POSSIBLE 0x0001
#define GLUT_GAME_MODE_WIDTH 0x0002
#define GLUT_GAME_MODE_HEIGHT 0x0003
#define GLUT_GAME_MODE_PIXEL_DEPTH 0x0004
#define GLUT_GAME_MODE_REFRESH_RATE 0x0005
#define GLUT_GAME_MODE_DISPLAY_CHANGED 0x0006
/*
* Initialization functions, see fglut_init.c
*/
FGAPI void FGAPIENTRY glutInit( int* pargc, char** argv );
FGAPI void FGAPIENTRY glutInitWindowPosition( int x, int y );
FGAPI void FGAPIENTRY glutInitWindowSize( int width, int height );
FGAPI void FGAPIENTRY glutInitDisplayMode( unsigned int displayMode );
FGAPI void FGAPIENTRY glutInitDisplayString( const char* displayMode );
/*
* Process loop function, see fg_main.c
*/
FGAPI void FGAPIENTRY glutMainLoop( void );
/*
* Window management functions, see fg_window.c
*/
FGAPI int FGAPIENTRY glutCreateWindow( const char* title );
FGAPI int FGAPIENTRY glutCreateSubWindow( int window, int x, int y, int width, int height );
FGAPI void FGAPIENTRY glutDestroyWindow( int window );
FGAPI void FGAPIENTRY glutSetWindow( int window );
FGAPI int FGAPIENTRY glutGetWindow( void );
FGAPI void FGAPIENTRY glutSetWindowTitle( const char* title );
FGAPI void FGAPIENTRY glutSetIconTitle( const char* title );
FGAPI void FGAPIENTRY glutReshapeWindow( int width, int height );
FGAPI void FGAPIENTRY glutPositionWindow( int x, int y );
FGAPI void FGAPIENTRY glutShowWindow( void );
FGAPI void FGAPIENTRY glutHideWindow( void );
FGAPI void FGAPIENTRY glutIconifyWindow( void );
FGAPI void FGAPIENTRY glutPushWindow( void );
FGAPI void FGAPIENTRY glutPopWindow( void );
FGAPI void FGAPIENTRY glutFullScreen( void );
/*
* Display-related functions, see fg_display.c
*/
FGAPI void FGAPIENTRY glutPostWindowRedisplay( int window );
FGAPI void FGAPIENTRY glutPostRedisplay( void );
FGAPI void FGAPIENTRY glutSwapBuffers( void );
/*
* Mouse cursor functions, see fg_cursor.c
*/
FGAPI void FGAPIENTRY glutWarpPointer( int x, int y );
FGAPI void FGAPIENTRY glutSetCursor( int cursor );
/*
* Overlay stuff, see fg_overlay.c
*/
FGAPI void FGAPIENTRY glutEstablishOverlay( void );
FGAPI void FGAPIENTRY glutRemoveOverlay( void );
FGAPI void FGAPIENTRY glutUseLayer( GLenum layer );
FGAPI void FGAPIENTRY glutPostOverlayRedisplay( void );
FGAPI void FGAPIENTRY glutPostWindowOverlayRedisplay( int window );
FGAPI void FGAPIENTRY glutShowOverlay( void );
FGAPI void FGAPIENTRY glutHideOverlay( void );
/*
* Menu stuff, see fg_menu.c
*/
FGAPI int FGAPIENTRY glutCreateMenu( void (* callback)( int menu ) );
FGAPI void FGAPIENTRY glutDestroyMenu( int menu );
FGAPI int FGAPIENTRY glutGetMenu( void );
FGAPI void FGAPIENTRY glutSetMenu( int menu );
FGAPI void FGAPIENTRY glutAddMenuEntry( const char* label, int value );
FGAPI void FGAPIENTRY glutAddSubMenu( const char* label, int subMenu );
FGAPI void FGAPIENTRY glutChangeToMenuEntry( int item, const char* label, int value );
FGAPI void FGAPIENTRY glutChangeToSubMenu( int item, const char* label, int value );
FGAPI void FGAPIENTRY glutRemoveMenuItem( int item );
FGAPI void FGAPIENTRY glutAttachMenu( int button );
FGAPI void FGAPIENTRY glutDetachMenu( int button );
/*
* Global callback functions, see fg_callbacks.c
*/
FGAPI void FGAPIENTRY glutTimerFunc( unsigned int time, void (* callback)( int ), int value );
FGAPI void FGAPIENTRY glutIdleFunc( void (* callback)( void ) );
/*
* Window-specific callback functions, see fg_callbacks.c
*/
FGAPI void FGAPIENTRY glutKeyboardFunc( void (* callback)( unsigned char, int, int ) );
FGAPI void FGAPIENTRY glutSpecialFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutReshapeFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutVisibilityFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutDisplayFunc( void (* callback)( void ) );
FGAPI void FGAPIENTRY glutMouseFunc( void (* callback)( int, int, int, int ) );
FGAPI void FGAPIENTRY glutMotionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutPassiveMotionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutEntryFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutKeyboardUpFunc( void (* callback)( unsigned char, int, int ) );
FGAPI void FGAPIENTRY glutSpecialUpFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutJoystickFunc( void (* callback)( unsigned int, int, int, int ), int pollInterval );
FGAPI void FGAPIENTRY glutMenuStateFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutMenuStatusFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutOverlayDisplayFunc( void (* callback)( void ) );
FGAPI void FGAPIENTRY glutWindowStatusFunc( void (* callback)( int ) );
FGAPI void FGAPIENTRY glutSpaceballMotionFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutSpaceballRotateFunc( void (* callback)( int, int, int ) );
FGAPI void FGAPIENTRY glutSpaceballButtonFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutButtonBoxFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutDialsFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutTabletMotionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutTabletButtonFunc( void (* callback)( int, int, int, int ) );
/*
* State setting and retrieval functions, see fg_state.c
*/
FGAPI int FGAPIENTRY glutGet( GLenum query );
FGAPI int FGAPIENTRY glutDeviceGet( GLenum query );
FGAPI int FGAPIENTRY glutGetModifiers( void );
FGAPI int FGAPIENTRY glutLayerGet( GLenum query );
/*
* Font stuff, see fg_font.c
*/
FGAPI void FGAPIENTRY glutBitmapCharacter( void* font, int character );
FGAPI int FGAPIENTRY glutBitmapWidth( void* font, int character );
FGAPI void FGAPIENTRY glutStrokeCharacter( void* font, int character );
FGAPI int FGAPIENTRY glutStrokeWidth( void* font, int character );
FGAPI GLfloat FGAPIENTRY glutStrokeWidthf( void* font, int character ); /* GLUT 3.8 */
FGAPI int FGAPIENTRY glutBitmapLength( void* font, const unsigned char* string );
FGAPI int FGAPIENTRY glutStrokeLength( void* font, const unsigned char* string );
FGAPI GLfloat FGAPIENTRY glutStrokeLengthf( void* font, const unsigned char *string ); /* GLUT 3.8 */
/*
* Geometry functions, see fg_geometry.c
*/
FGAPI void FGAPIENTRY glutWireCube( double size );
FGAPI void FGAPIENTRY glutSolidCube( double size );
FGAPI void FGAPIENTRY glutWireSphere( double radius, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutSolidSphere( double radius, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutWireCone( double base, double height, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutSolidCone( double base, double height, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutWireTorus( double innerRadius, double outerRadius, GLint sides, GLint rings );
FGAPI void FGAPIENTRY glutSolidTorus( double innerRadius, double outerRadius, GLint sides, GLint rings );
FGAPI void FGAPIENTRY glutWireDodecahedron( void );
FGAPI void FGAPIENTRY glutSolidDodecahedron( void );
FGAPI void FGAPIENTRY glutWireOctahedron( void );
FGAPI void FGAPIENTRY glutSolidOctahedron( void );
FGAPI void FGAPIENTRY glutWireTetrahedron( void );
FGAPI void FGAPIENTRY glutSolidTetrahedron( void );
FGAPI void FGAPIENTRY glutWireIcosahedron( void );
FGAPI void FGAPIENTRY glutSolidIcosahedron( void );
/*
* Teapot rendering functions, found in fg_teapot.c
* NB: front facing polygons have clockwise winding, not counter clockwise
*/
FGAPI void FGAPIENTRY glutWireTeapot( double size );
FGAPI void FGAPIENTRY glutSolidTeapot( double size );
/*
* Game mode functions, see fg_gamemode.c
*/
FGAPI void FGAPIENTRY glutGameModeString( const char* string );
FGAPI int FGAPIENTRY glutEnterGameMode( void );
FGAPI void FGAPIENTRY glutLeaveGameMode( void );
FGAPI int FGAPIENTRY glutGameModeGet( GLenum query );
/*
* Video resize functions, see fg_videoresize.c
*/
FGAPI int FGAPIENTRY glutVideoResizeGet( GLenum query );
FGAPI void FGAPIENTRY glutSetupVideoResizing( void );
FGAPI void FGAPIENTRY glutStopVideoResizing( void );
FGAPI void FGAPIENTRY glutVideoResize( int x, int y, int width, int height );
FGAPI void FGAPIENTRY glutVideoPan( int x, int y, int width, int height );
/*
* Colormap functions, see fg_misc.c
*/
FGAPI void FGAPIENTRY glutSetColor( int color, GLfloat red, GLfloat green, GLfloat blue );
FGAPI GLfloat FGAPIENTRY glutGetColor( int color, int component );
FGAPI void FGAPIENTRY glutCopyColormap( int window );
/*
* Misc keyboard and joystick functions, see fg_misc.c
*/
FGAPI void FGAPIENTRY glutIgnoreKeyRepeat( int ignore );
FGAPI void FGAPIENTRY glutSetKeyRepeat( int repeatMode );
FGAPI void FGAPIENTRY glutForceJoystickFunc( void );
/*
* Misc functions, see fg_misc.c
*/
FGAPI int FGAPIENTRY glutExtensionSupported( const char* extension );
FGAPI void FGAPIENTRY glutReportErrors( void );
/* Comment from glut.h of classic GLUT:
Win32 has an annoying issue where there are multiple C run-time
libraries (CRTs). If the executable is linked with a different CRT
from the GLUT DLL, the GLUT DLL will not share the same CRT static
data seen by the executable. In particular, atexit callbacks registered
in the executable will not be called if GLUT calls its (different)
exit routine). GLUT is typically built with the
"/MD" option (the CRT with multithreading DLL support), but the Visual
C++ linker default is "/ML" (the single threaded CRT).
One workaround to this issue is requiring users to always link with
the same CRT as GLUT is compiled with. That requires users supply a
non-standard option. GLUT 3.7 has its own built-in workaround where
the executable's "exit" function pointer is covertly passed to GLUT.
GLUT then calls the executable's exit function pointer to ensure that
any "atexit" calls registered by the application are called if GLUT
needs to exit.
Note that the __glut*WithExit routines should NEVER be called directly.
To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */
/* to get the prototype for exit() */
#include <stdlib.h>
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) && !defined(__WATCOMC__)
FGAPI void FGAPIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
FGAPI int FGAPIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int));
FGAPI int FGAPIENTRY __glutCreateMenuWithExit(void (* func)(int), void (__cdecl *exitfunc)(int));
#ifndef FREEGLUT_BUILDING_LIB
#if defined(__GNUC__)
#define FGUNUSED __attribute__((unused))
#else
#define FGUNUSED
#endif
static void FGAPIENTRY FGUNUSED glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); }
#define glutInit glutInit_ATEXIT_HACK
static int FGAPIENTRY FGUNUSED glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); }
#define glutCreateWindow glutCreateWindow_ATEXIT_HACK
static int FGAPIENTRY FGUNUSED glutCreateMenu_ATEXIT_HACK(void (* func)(int)) { return __glutCreateMenuWithExit(func, exit); }
#define glutCreateMenu glutCreateMenu_ATEXIT_HACK
#endif
#endif
#ifdef __cplusplus
}
#endif
/*** END OF FILE ***/
#endif /* __FREEGLUT_STD_H__ */
+21
View File
@@ -0,0 +1,21 @@
#ifndef __GLUT_H__
#define __GLUT_H__
/*
* glut.h
*
* The freeglut library include file
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "freeglut_std.h"
/*** END OF FILE ***/
#endif /* __GLUT_H__ */
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More