当前位置:  编程技术>移动开发
本页文章导读:
    ▪应用深度缓冲区进行三维混合代码        使用深度缓冲区进行三维混合代码 #include <GLUT.H> #include <stdio.h> #include <tchar.h> GLuint sphereList, cubeList; static float solidZ = 8.0; static float transparentZ = -8.0; #define ZINC 0.4 void init() { GLfloa.........
    ▪ 测试文件        测试资料 http://mintelong.iteye.com/blog/460903 ......
    ▪ What is Core Data       What is Core Data? Path to SuccessThe Core Data Programming Guide is primarily a reference volume. You should not simply try to read it straight through to understand Core Data.To learn about Core Data, you should typically follow this path:Start .........

[1]应用深度缓冲区进行三维混合代码
    来源: 互联网  发布时间: 2014-02-18
使用深度缓冲区进行三维混合代码
#include <GLUT.H>
#include <stdio.h>
#include <tchar.h>

GLuint sphereList, cubeList;

static float solidZ = 8.0;
static float transparentZ = -8.0;
#define ZINC 0.4

void init()
{
	GLfloat mat_specular[] = {1.0f, 1.0f, 1.0f, 0.15f};
	GLfloat mat_shininess[] = {100.0};
	
	glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
	glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);

	GLfloat position[] = {0.5f, 0.5f, 1.0f, 0.0};
	glLightfv(GL_LIGHT0, GL_POSITION, position);

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

	sphereList = glGenLists(1);
	glNewList(sphereList, GL_COMPILE);
	glutSolidSphere(0.4, 16, 16);
	glEndList();

	cubeList = glGenLists(1);
	glNewList(cubeList, GL_COMPILE);
	glutSolidCube(0.6);
	glEndList();
	//glEnable(GL_POLYGON_SMOOTH);
}

void display()
{	
	GLfloat mat_solid[] = {0.75, 0.75, 0.0, 1.0};
	GLfloat mat_zero[] = {0.0, 0.0, 0.0, 1.0};
	GLfloat mat_transparent[] = {0.0, 0.8, 0.8, 0.6};
	GLfloat mat_emission[] = {0.0, 0.3, 0.3, 0.6};

	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
	glPushMatrix();
		glTranslatef(-0.15, -0.15, solidZ);
		glMaterialfv(GL_FRONT, GL_EMISSION, mat_zero);
		glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_solid);
		glCallList(sphereList);
	glPopMatrix();

	glPushMatrix();
		glTranslatef(0.15, 0.15, transparentZ);
		glRotatef(15.0, 1.0, 1.0, 0.0);
		glRotatef(30.0, 0.0, 1.0, 0.0);
		glMaterialfv(GL_FRONT, GL_EMISSION, mat_emission);
		glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_transparent);
		glEnable(GL_BLEND);
		glDepthMask(GL_FALSE);
		glBlendFunc(GL_SRC_ALPHA, GL_ONE);
		glCallList(cubeList);
		glDepthMask(GL_TRUE);
		glDisable(GL_BLEND);
	glPopMatrix();
	
	glutSwapBuffers();
	glFlush();
}
void idleFunc()
{
	if(solidZ<=-8.0 || transparentZ>=8.0)
	{
		glutIdleFunc(NULL);
	}
	else
	{
		solidZ -= ZINC;
		transparentZ += ZINC;
		glutPostRedisplay();
	}	
}
void reshape(int width, int height)
{
	glViewport(0, 0, width, height);
	float ratio = (float)width/(float)height;
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	//glFrustum(-ratio, ratio, -1, 1, 1, 100);
	if(width<= height)
		glOrtho(-1.5, 1.5, -1.5*(GLfloat)height/(GLfloat)width,
			1.5*(GLfloat)height/(GLfloat)width, -10.0, 10.0);
	else
		glOrtho(-1.5*(GLfloat)width/(GLfloat)height, 1.5*(GLfloat)width/(GLfloat)height, -1.5, 1.5, -10.0, 10.0);
	
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}
void keyboard(unsigned char key, int x, int y)
{
	switch(key)
	{
	case 'r':
		solidZ = 8.0;
		transparentZ = -8.0;
		glutPostRedisplay();
		break;
	case 'a':
		solidZ = 8.0;
		transparentZ = -8.0;
		glutIdleFunc(idleFunc);
		break;
	case 27: exit(0);
	default: break;
	}
	
}

int main(int argc, char* argv[])
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutInitWindowPosition(100, 100);
	glutInitWindowSize(600, 600);
	glutCreateWindow(argv[0]);
	init();
	glutDisplayFunc(display);
	glutReshapeFunc(reshape);
	//glutIdleFunc(idleFunc);
	glutKeyboardFunc(keyboard);
	glutMainLoop();
	return 0;
}
 

    
[2] 测试文件
    来源: 互联网  发布时间: 2014-02-18
测试资料
http://mintelong.iteye.com/blog/460903

    
[3] What is Core Data
    来源: 互联网  发布时间: 2014-02-18
What is Core Data?
Path to Success
The Core Data Programming Guide is primarily a reference volume. You should not simply try to read it straight through to understand Core Data.

To learn about Core Data, you should typically follow this path:

Start by reading the overview in Core Data Basics (in Core Data Programming Guide).
This will give you a basic understanding of what Core Data is and why you might want to use it.

Work through the Core Data Tutorial for iPhone OS.
This provides a good introduction to the fundamentals of application development using Core Data.

Work through the Core Data Utility Tutorial.
This will give you a greater appreciation of the different components of the framework—in particular the managed object model—without the distraction of a user interface.

Work through the tutorial described in Creating a Managed Object Model with Xcode.
This introduces the major user interface elements of, and teaches you how to use, the Xcode modeling tool.

When specific areas need greater explanation, refer to the Core Data Programming Guide.

After you’ve worked through the introductory materials, try creating more complex applications (using, for example, two related entities) as suggested in Core Data Tutorial for iPhone OS. The Core Data Programming Guide will be increasingly useful as you continue your exploration, as will Model Object Implementation Guide and Predicate Programming Guide.

As you progress, it is important to bear in mind that Core Data objects are still just objects, and have little influence on the user interface parts of your application simply by virtue of being Core Data objects. (In fact, the reverse is true—you may find that your user interface affects the way you structure your data.) You should practice creating Core Data applications using traditional Cocoa techniques such as target-action and delegation just as you would in a non-Core Data application.

Core Data in Depth
There are several documents that describe particular aspects of Core Data in greater depth than in the Programming Guide. You should use these documents only when you have a firm understanding of how Core Data works, and then only if and when you need to:

Core Data Model Versioning and Data Migration Programming Guide
Read this document to learn how to support versioning.

Atomic Store Programming Topics
Read this document to understand how to create your own type of persistent store.

    
最新技术文章:
▪Android开发之登录验证实例教程
▪Android开发之注册登录方法示例
▪Android获取手机SIM卡运营商信息的方法
▪Android实现将已发送的短信写入短信数据库的...
▪Android发送短信功能代码
▪Android根据电话号码获得联系人头像实例代码
▪Android中GPS定位的用法实例
▪Android实现退出时关闭所有Activity的方法
▪Android实现文件的分割和组装
▪Android录音应用实例教程
▪Android双击返回键退出程序的实现方法
▪Android实现侦听电池状态显示、电量及充电动...
▪Android获取当前已连接的wifi信号强度的方法
▪Android实现动态显示或隐藏密码输入框的内容
▪根据USER-AGENT判断手机类型并跳转到相应的app...
▪Android Touch事件分发过程详解
▪Android中实现为TextView添加多个可点击的文本
▪Android程序设计之AIDL实例详解
▪Android显式启动与隐式启动Activity的区别介绍
▪Android按钮单击事件的四种常用写法总结
▪Android消息处理机制Looper和Handler详解
▪Android实现Back功能代码片段总结
▪Android实用的代码片段 常用代码总结
▪Android实现弹出键盘的方法
▪Android中通过view方式获取当前Activity的屏幕截...
▪Android提高之自定义Menu(TabMenu)实现方法
▪Android提高之多方向抽屉实现方法
▪Android获取当前已连接的wifi信号强度的方法 iis7站长之家
▪Android提高之MediaPlayer播放网络视频的实现方法...
▪Android提高之手游转电视游戏的模拟操控
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3