Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file added 21551005胡彬/homework2/Debug/homework2.exe
Binary file not shown.
Binary file added 21551005胡彬/homework2/Debug/homework2.ilk
Binary file not shown.
Binary file added 21551005胡彬/homework2/Debug/homework2.pdb
Binary file not shown.
Binary file added 21551005胡彬/homework2/homework2.opensdf
Binary file not shown.
Binary file added 21551005胡彬/homework2/homework2.sdf
Binary file not shown.
28 changes: 28 additions & 0 deletions 21551005胡彬/homework2/homework2.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "homework2", "homework2\homework2.vcxproj", "{25C2F559-CAF1-49EE-AA43-8F9D0B866796}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{25C2F559-CAF1-49EE-AA43-8F9D0B866796}.Debug|x64.ActiveCfg = Debug|x64
{25C2F559-CAF1-49EE-AA43-8F9D0B866796}.Debug|x64.Build.0 = Debug|x64
{25C2F559-CAF1-49EE-AA43-8F9D0B866796}.Debug|x86.ActiveCfg = Debug|Win32
{25C2F559-CAF1-49EE-AA43-8F9D0B866796}.Debug|x86.Build.0 = Debug|Win32
{25C2F559-CAF1-49EE-AA43-8F9D0B866796}.Release|x64.ActiveCfg = Release|x64
{25C2F559-CAF1-49EE-AA43-8F9D0B866796}.Release|x64.Build.0 = Release|x64
{25C2F559-CAF1-49EE-AA43-8F9D0B866796}.Release|x86.ActiveCfg = Release|Win32
{25C2F559-CAF1-49EE-AA43-8F9D0B866796}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
16 changes: 16 additions & 0 deletions 21551005胡彬/homework2/homework2/Debug/homework2.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
生成启动时间为 2016/1/13 21:26:53。
1>项目“C:\Users\zz0292\Documents\Visual Studio 2015\Projects\homework2\homework2\homework2.vcxproj”在节点 2 上(Build 个目标)。
1>ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.exe /c /ZI /nologo /W3 /WX- /sdl /Od /Oy- /D WIN32 /D _DEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Yu"stdafx.h" /Fp"Debug\homework2.pch" /Fo"Debug\\" /Fd"Debug\vc140.pdb" /Gd /TP /analyze- /errorReport:prompt /D _CRT_SECURE_NO_WARNINGS homework2.cpp
homework2.cpp
1>c:\users\zz0292\documents\visual studio 2015\projects\homework2\homework2\homework2.cpp(68): warning C4838: 从“double”转换到“GLfloat”需要收缩转换
Link:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"C:\Users\zz0292\Documents\Visual Studio 2015\Projects\homework2\Debug\homework2.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /Debug /PDB:"C:\Users\zz0292\Documents\Visual Studio 2015\Projects\homework2\Debug\homework2.pdb" /SUBSYSTEM:WINDOWS /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Users\zz0292\Documents\Visual Studio 2015\Projects\homework2\Debug\homework2.lib" /MACHINE:X86 Debug\homework2.res
Debug\homework2.obj
Debug\stdafx.obj
homework2.vcxproj -> C:\Users\zz0292\Documents\Visual Studio 2015\Projects\homework2\Debug\homework2.exe
1>已完成生成项目“C:\Users\zz0292\Documents\Visual Studio 2015\Projects\homework2\homework2\homework2.vcxproj”(Build 个目标)的操作。

已成功生成。

已用时间 00:00:01.44
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit
Debug|Win32|C:\Users\zz0292\Documents\Visual Studio 2015\Projects\homework2\|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
30 changes: 30 additions & 0 deletions 21551005胡彬/homework2/homework2/ReadMe.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
========================================================================
控制台应用程序:homework2 项目概述
========================================================================

应用程序向导已为您创建了此 homework2 应用程序。

本文件概要介绍组成 homework2 应用程序的每个文件的内容。


homework2.vcxproj
这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。

homework2.vcxproj.filters
这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。

homework2.cpp
这是主应用程序源文件。

/////////////////////////////////////////////////////////////////////////////
其他标准文件:

StdAfx.h, StdAfx.cpp
这些文件用于生成名为 homework2.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。

/////////////////////////////////////////////////////////////////////////////
其他注释:

应用程序向导使用“TODO:”注释来指示应添加或自定义的源代码部分。

/////////////////////////////////////////////////////////////////////////////
Binary file added 21551005胡彬/homework2/homework2/earth.bmp
Binary file not shown.
Binary file added 21551005胡彬/homework2/homework2/homework2.aps
Binary file not shown.
140 changes: 140 additions & 0 deletions 21551005胡彬/homework2/homework2/homework2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
// homework2.cpp : �������̨Ӧ�ó������ڵ㡣
//

#include "stdafx.h"


#include "LoadBMP.h"

void myinit(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);

glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D); //���ö�ά����

GLfloat light0_ambient[] = { 1, 1, 1, 1 }; //������
GLfloat light0_diffuse[] = { 1, 1, 1, 1 }; //ɢ���
GLfloat light0_position[] = { 0, 0, 0, 1 }; //��Դλ��

glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
glLightfv(GL_LIGHT0, GL_POSITION, light0_position);

LoadAllTextures(); //��������
}

void myidle()
{
day += angle;
glutPostRedisplay();

}

void mymouse(int button, int state, int x, int y)
{
if (state == GLUT_DOWN && button == GLUT_LEFT_BUTTON) {
if (first)
{
glutIdleFunc(myidle);
first = !first;
}
else
{
glutIdleFunc(0);
first = !first;
}
}
}

void mykeyboard(unsigned char key, int x, int y)
{
if (key == 27)
exit(0);
}

void mydisplay(void)
{
year = day / 365;
month = day / 30;

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

GLfloat mat_ambient1[] = { 1,0,0,1 };
GLfloat mat_emission[] = { 1,1,1,0 };

GLfloat mat_ambient2[] = { 0.4,0.4,0.8,1 };
GLfloat no_emission[] = { 0,0,0,1 };

glPushMatrix();
glBindTexture(GL_TEXTURE_2D, sun->texID);
glRotatef(month, 0.0, 1.0, 0.0); //̫����ת
glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient1);
glMaterialfv(GL_FRONT, GL_EMISSION, mat_emission);
glRotatef(90, -1, 0, 0);
gltDrawSphere(1.0, 40, 40); //����̫��
glPopMatrix();

glPushMatrix();
glRotatef(year, 0.0, 1.0, 0.0); //���������һ����̫��ת������ת��
glPushMatrix();
glBindTexture(GL_TEXTURE_2D, earth->texID);
glTranslatef(3.0, 0.0, 0.0);
glRotatef(month, 0.0, 1.0, 0.0); //������ת
glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient2);
glMaterialfv(GL_FRONT, GL_EMISSION, no_emission);
glRotatef(90, -1, 0, 0);
gltDrawSphere(0.4, 40, 40); //���Ƶ���
glPopMatrix();

glPushMatrix();
glBindTexture(GL_TEXTURE_2D, moon->texID);
glTranslatef(3.0, 0.0, 0.0);
glRotatef(60, -1, 1, 0);
glRotatef(month, 0, 1.0, 0); //�����Ƶ���ת
glTranslatef(0.6, 0.0, 0.0);
glRotatef(90, -1, 0, 0);
gltDrawSphere(0.07, 20, 20); //��������
glPopMatrix();
glPopMatrix();

glFlush();
glutSwapBuffers();
}

void myreshape(int w, int h)
{
glViewport(0, 0, (GLsizei)w, (GLsizei)h); //ָ���ӿڴ�С
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

gluPerspective(60.0, (GLfloat)w / (GLfloat)h, 1, 20); //͸��ͶӰ

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

gluLookAt(0.0, -5.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); //ָ���������λ��
}

int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(1000, 600);
glutInitWindowPosition(100, 100);
glutCreateWindow("������������̫�����������ģ��");
myinit();

glutDisplayFunc(mydisplay);
glutReshapeFunc(myreshape);
glutIdleFunc(myidle);
glutMouseFunc(mymouse);
glutKeyboardFunc(mykeyboard);

glutMainLoop();
return 0;
}


Binary file added 21551005胡彬/homework2/homework2/homework2.rc
Binary file not shown.
169 changes: 169 additions & 0 deletions 21551005胡彬/homework2/homework2/homework2.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
<?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>{25C2F559-CAF1-49EE-AA43-8F9D0B866796}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>homework2</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>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalOptions>/D _CRT_SECURE_NO_WARNINGS %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="loadbmp.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="homework2.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="homework2.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
Loading