当前位置: 首页>>代码示例>>C++>>正文


C++ LoadGLTextures函数代码示例

本文整理汇总了C++中LoadGLTextures函数的典型用法代码示例。如果您正苦于以下问题:C++ LoadGLTextures函数的具体用法?C++ LoadGLTextures怎么用?C++ LoadGLTextures使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LoadGLTextures函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

GLvoid NEHE17::InitGL(){
	if(!LoadGLTextures("NeheGL/img/Font.bmp", 0)){
        cout<<"Fail to load font texture"<<endl;
    }
	
	if(!LoadGLTextures("NeheGL/img/Bumps.bmp", 1)){
        cout<<"Fail to load bumps texture"<<endl;
    }
	
	buildFont();
	
	// Enable Texture Mapping
	glEnable(GL_TEXTURE_2D);
	
	// Enables Smooth Shading
	glShadeModel(GL_SMOOTH);
	
	// clear background as black
	glClearColor(0.0f,0.0f,0.0f,0.0f);
	
	glClearDepth(1.0f);
	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LEQUAL);
	
	// want the best perspective correction to be done
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
	
	glBlendFunc(GL_SRC_ALPHA,GL_ONE);	// Select The Type Of Blending
	
}
开发者ID:HVisionSensing,项目名称:NeheGL_XCode,代码行数:30,代码来源:nehe17.cpp

示例2: InitGL

/* A general OpenGL initialization function.  Sets all of the initial parameters. */
GLvoid InitGL(GLsizei Width, GLsizei Height)	// We call this right after our OpenGL window is created.
{
	LoadGLTextures();                           // load the textures.
	glEnable(GL_TEXTURE_2D);                    // Enable texture mapping.

	glBlendFunc(GL_SRC_ALPHA, GL_ONE);          // Set the blending function for translucency (note off at init time)
	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);	// This Will Clear The Background Color To Black
	glClearDepth(1.0);				// Enables Clearing Of The Depth Buffer
	glDepthFunc(GL_LESS);                       // type of depth test to do.
	glEnable(GL_DEPTH_TEST);                    // enables depth testing.
	glShadeModel(GL_SMOOTH);			// Enables Smooth Color Shading

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();				// Reset The Projection Matrix

	gluPerspective(45.0f,(GLfloat)Width/(GLfloat)Height,0.1f,100.0f);	// Calculate The Aspect Ratio Of The Window

	glMatrixMode(GL_MODELVIEW);

	// set up lights.
	glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient);
	glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse);
	glLightfv(GL_LIGHT1, GL_POSITION, LightPosition);
	glEnable(GL_LIGHT1);
}
开发者ID:akshat08,项目名称:Virtual-Walkthrough,代码行数:26,代码来源:lesson10.c

示例3: InitGL

int InitGL(GLvoid) {                                    // Все настройки OpenGL начинаются здесь
    if (!LoadGLTextures()) {                            // Переход к процедуре загрузки текстуры
        return FALSE;                                   // Если текстура не загружена возращает FALSE
    }

    glEnable(GL_TEXTURE_2D);                            // Включение нанесения текстур
    glShadeModel(GL_SMOOTH);                            // Включение гладкой закраски (smooth shading)
    glClearColor(0.5f, 0.5f, 0.5f, 1.0f);               // Очиска экрана, с заполнием его цветом тумана. ( Изменено )
    glClearDepth(1.0f);                                 // Установка буфера глубины
    glEnable(GL_DEPTH_TEST);                            // Включение проверки глубины
    glDepthFunc(GL_LEQUAL);                             // Тип выполняемой проверки глубины
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);  // Изящная коррекция перспективы

    glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient);     // Установить цвет среды
    glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse);     // Установить диффузный (рассеиваемый) цвет
    glLightfv(GL_LIGHT1, GL_POSITION, LightPosition);   // Разместить источник
    glEnable(GL_LIGHT1);                                // Включить Источник света #1

    glFogi(GL_FOG_MODE, fogMode[fogfilter]);            // Режим тумана
    glFogfv(GL_FOG_COLOR, fogColor);                    // Цвет тумана
    glFogf(GL_FOG_DENSITY, 0.35f);                      // Насколько густым будет туман
    glHint(GL_FOG_HINT, GL_DONT_CARE);                  // Вспомогательная установка тумана
    glFogf(GL_FOG_START, 1.0f);                         // Глубина, с которой начинается туман
    glFogf(GL_FOG_END, 5.0f);                           // Глубина, где туман заканчивается.
    glEnable(GL_FOG);                                   // Включает туман (GL_FOG)
    return TRUE;                                        // Инициализация прошла OK
}
开发者ID:stden,项目名称:comp_graph,代码行数:27,代码来源:nehe-ogl16.cpp

示例4: InitGL

GLvoid InitGL(GLsizei Width, GLsizei Height)	// This Will Be Called Right After The GL Window Is Created
{
	LoadGLTextures();							// Load The Texture(s)
	glEnable(GL_TEXTURE_2D);					// Enable Texture Mapping

	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);		// This Will Clear The Background Color To Black
	glClearDepth(1.0);							// Enables Clearing Of The Depth Buffer
	glShadeModel(GL_SMOOTH);					// Enables Smooth Color Shading

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();							// Reset The Projection Matrix

	gluPerspective(45.0f,(GLfloat)Width/(GLfloat)Height,0.1f,100.0f);	// Calculate The Aspect Ratio Of The Window

	glMatrixMode(GL_MODELVIEW);
	glBlendFunc(GL_SRC_ALPHA,GL_ONE);			// Set The Blending Function For Translucency
	glEnable(GL_BLEND);

	for (loop=0; loop<num; loop++)
	{
		star[loop].angle=0.0f;
		star[loop].dist=(float(loop)/num)*5.0f;
		star[loop].r=rand()%256;
		star[loop].g=rand()%256;
		star[loop].b=rand()%256;
	}
}
开发者ID:aalbertini,项目名称:opengl-win32-nehe,代码行数:27,代码来源:lesson9.cpp

示例5: InitGL

/* A general OpenGL initialization function.  Sets all of the initial parameters. */
void InitGL(int Width, int Height)	        // We call this right after our OpenGL window is created.
{
    float float_x, float_y;                     // loop counters.
    LoadGLTextures();				// Load The Texture(s) 
    glEnable(GL_TEXTURE_2D);			// Enable Texture Mapping
    glClearColor(0.0f, 0.0f, 1.0f, 0.0f);	// Clear The Background Color To Blue 
    glClearDepth(1.0);				// Enables Clearing Of The Depth Buffer
    glDepthFunc(GL_LESS);			// The Type Of Depth Test To Do
    glEnable(GL_DEPTH_TEST);			// Enables Depth Testing
    glShadeModel(GL_SMOOTH);			// Enables Smooth Color Shading
    
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();				// Reset The Projection Matrix
    
    gluPerspective(45.0f,(GLfloat)Width/(GLfloat)Height,0.1f,100.0f);	// Calculate The Aspect Ratio Of The Window
    
    glMatrixMode(GL_MODELVIEW);

    for(float_x = 0.0f; float_x < 9.0f; float_x +=  0.2f )	{
	for(float_y = 0.0f; float_y < 9.0f; float_y += 0.2f)		{
	    points[ (int) (float_x*5) ][ (int) (float_y*5) ][0] = float_x - 4.4f;
	    points[ (int) (float_x*5) ][ (int) (float_y*5) ][1] = float_y - 4.4f;
	    points[ (int) (float_x*5) ][ (int) (float_y*5) ][2] = (float) (sin( ( (float_x*5*8)/360 ) * 3.14159 * 2 ));
	}
    }
}
开发者ID:sunzhiyuan,项目名称:NEHE,代码行数:27,代码来源:lesson11.c

示例6: InitGL

void InitGL(int width, int height )
{

    LoadGLTextures();
    glEnable(GL_TEXTURE_2D);


	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

	glClearDepth( 1.0 );
	glDepthFunc( GL_LESS );
	glEnable( GL_DEPTH_TEST );
	glShadeModel( GL_SMOOTH );

	glMatrixMode( GL_PROJECTION );
	glLoadIdentity();
	gluPerspective( 45.0f, ( (GLfloat)width / (GLfloat)height ), 0.1f, 100.0f);

	glMatrixMode( GL_MODELVIEW );

    glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient);  // add lighting. (ambient)
    glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse);  // add lighting. (diffuse).
    glLightfv(GL_LIGHT1, GL_POSITION,LightPosition); // set light position.
    glEnable(GL_LIGHT1);                             // turn light 1 on.


}
开发者ID:aryaro,项目名称:gpu,代码行数:27,代码来源:main.cpp

示例7:

GLvoid NEHE22::InitGL(){
	
	multitextureSupported=initMultitexture();
	
	if(!LoadGLTextures()){
        cout<<"Fail to load textures"<<endl;
    }
	
	// Enable Texture Mapping
	glEnable(GL_TEXTURE_2D);
	
	// Enables Smooth Shading
	glShadeModel(GL_SMOOTH);
	
	// clear background as black
	glClearColor(0.0f,0.0f,0.0f,0.5f);
	
	glClearDepth(1.0f);
	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LEQUAL);
	
	// want the best perspective correction to be done
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
	
	initLights();
}
开发者ID:HVisionSensing,项目名称:NeheGL_XCode,代码行数:26,代码来源:nehe22.cpp

示例8: InitGL

int InitGL(GLvoid)
{
    if (!LoadGLTextures())
    {
        return FALSE;
    }

    glEnable(GL_TEXTURE_2D);
    glShadeModel(GL_SMOOTH);
    glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
    glClearDepth(1.0f);
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
    glBlendFunc(GL_SRC_ALPHA,GL_ONE);
    glEnable(GL_BLEND);

    for (loop=0; loop<num; loop++)
    {
        star[loop].angle=0.0f;
        star[loop].dist=(float(loop)/num)*5.0f;
        star[loop].r=rand()%256;
        star[loop].g=rand()%256;
        star[loop].b=rand()%256;
    }
    return TRUE;
}
开发者ID:caitouda,项目名称:BNUCourses,代码行数:25,代码来源:main.cpp

示例9: InitGL

int InitGL(GLvoid)										// All Setup For OpenGL Goes Here
{
	if(!LoadGLTextures())
	{
		return FALSE;
	}
	glEnable(GL_TEXTURE_2D);
	glShadeModel(GL_SMOOTH);							// Enable Smooth Shading
	glClearColor(0.0f, 0.0f, 0.0f, 0.5f);				// Black Background
	glClearDepth(1.0f);									// Depth Buffer Setup
	//glEnable(GL_DEPTH_TEST);							// Enables Depth Testing
	//glDepthFunc(GL_LEQUAL);								// The Type Of Depth Testing To Do
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	// Really Nice Perspective Calculations
	glBlendFunc(GL_SRC_ALPHA,GL_ONE);				//设置混色函数设置半透明效果
	glEnable(GL_BLEND);							//启用混色
	for(loop = 0; loop < num; loop ++)
	{
		star[loop].angle = 0.0f;
		star[loop].dist = (float(loop)/num) * 5.0f;
		star[loop].r = rand()%256;
		star[loop].g = rand()%256;
		star[loop].b = rand()%256;
	}
	
	return TRUE;										// Initialization Went OK
}
开发者ID:jacksunsea,项目名称:OpenGLTest,代码行数:26,代码来源:lesson9.cpp

示例10: InitGL

int InitGL()										    // All Setup For OpenGL Goes Here
{
	if (!LoadGLTextures())								// Jump To Texture Loading Routine ( NEW )
	{
		return false;									// If Texture Didn't Load Return false
	}

	glEnable(GL_TEXTURE_2D);							// Enable Texture Mapping ( NEW )
	glShadeModel(GL_SMOOTH);							// Enable Smooth Shading
	glClearColor(0.0f, 0.0f, 0.0f, 0.5f);				// Black Background
	glClearDepth(1.0f);									// Depth Buffer Setup
	glEnable(GL_DEPTH_TEST);							// Enables Depth Testing
	glDepthFunc(GL_LEQUAL);								// The type Of Depth Testing To Do
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	// Really Nice Perspective Calculations
	glPolygonMode( GL_BACK, GL_FILL );					// Back Face Is Solid
	glPolygonMode( GL_FRONT, GL_LINE );					// Front Face Is Made Of Lines

	for(int x=0; x<45; x++)
	{
		for(int y=0; y<45; y++)
		{
			points[x][y][0]=float((x/5.0f)-4.5f);
			points[x][y][1]=float((y/5.0f)-4.5f);
			points[x][y][2]=float(sin((((x/5.0f)*40.0f)/360.0f)*3.141592654*2.0f));
		}
	}

	return true;										// Initialization Went OK
}
开发者ID:xerpi,项目名称:NeHe-SFML2.0,代码行数:29,代码来源:nehe_lesson11.cpp

示例11: InitGL

int InitGL(GLvoid)										// 此处开始对OpenGL进行所有设置
{
	glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE);

	if (!LoadGLTextures())
	{
		return FALSE;
	}
	glEnable(GL_TEXTURE_2D);
	glShadeModel(GL_SMOOTH);							// 启用阴影平滑
	glClearColor(0.0f, 0.0f, 0.0f, 0.5f);				// 黑色背景
	glClearDepth(1.0f);									// 设置深度缓存
	glEnable(GL_DEPTH_TEST);							// 启用深度测试
	glDepthFunc(GL_LEQUAL);								// 所作深度测试的类型
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	// 告诉系统对透视进行修正

	glLightfv(GL_LIGHT1, GL_AMBIENT, g_lightAmbient);
	glLightfv(GL_LIGHT1, GL_DIFFUSE, g_lightDiffuse);
	glLightfv(GL_LIGHT1, GL_POSITION, g_lightPosition);
	glEnable(GL_LIGHT1);

	
	return TRUE;										// 初始化 OK
}
开发者ID:nusus,项目名称:VS2012Workspace,代码行数:25,代码来源:main.cpp

示例12: InitGL

int InitGL(GLvoid)										// All Setup For OpenGL Goes Here
{
	if (!LoadGLTextures())								// Jump To Texture Loading Routine
	{
		return FALSE;									// If Texture Didn't Load Return FALSE
	}

	glEnable(GL_TEXTURE_2D);							// Enable Texture Mapping
	glShadeModel(GL_SMOOTH);							// Enable Smooth Shading
	glClearColor(0.0f, 0.0f, 0.0f, 0.5f);				// Black Background
	glClearDepth(1.0f);									// Depth Buffer Setup
	glEnable(GL_DEPTH_TEST);							// Enables Depth Testing
	glDepthFunc(GL_LEQUAL);								// The Type Of Depth Testing To Do
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	// Really Nice Perspective Calculations

	glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient);		// Setup The Ambient Light
	glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse);		// Setup The Diffuse Light
	glLightfv(GL_LIGHT1, GL_POSITION,LightPosition);	// Position The Light
	glEnable(GL_LIGHT1);								// Enable Light One

	quadratic=gluNewQuadric();							// Create A Pointer To The Quadric Object (Return 0 If No Memory)
	gluQuadricNormals(quadratic, GLU_SMOOTH);			// Create Smooth Normals 
	gluQuadricTexture(quadratic, GL_TRUE);				// Create Texture Coords 

	glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); // Set The Texture Generation Mode For S To Sphere Mapping (NEW)
	glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); // Set The Texture Generation Mode For T To Sphere Mapping (NEW)

	return TRUE;										// Initialization Went OK
}
开发者ID:asion0,项目名称:AsionGitCodes,代码行数:29,代码来源:Lesson23.cpp

示例13: InitGL

/* A general OpenGL initialization function.  Sets all of the initial parameters. */
GLvoid InitGL(GLsizei Width, GLsizei Height)  // We call this right after our OpenGL window is created.
{
    LoadGLTextures();                        // Load the textures
    
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);    // This Will Clear The Background Color To Black
    glClearDepth(1.0);                       // Enables Clearing Of The Depth Buffer
    glDepthFunc(GL_LESS);                    // The Type Of Depth Test To Do
    glEnable(GL_DEPTH_TEST);                 // Enables Depth Testing
    glShadeModel(GL_SMOOTH);                 // Enables Smooth Color Shading
    
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();                        // Reset The Projection Matrix
    
    gluPerspective(45.0, GLfloat(Width)/GLfloat(Height),0.1f,100.0f);    // Calculate The Aspect Ratio Of The Window  
    quadric=gluNewQuadric();                  // Create A Pointer To The Quadric Object ( NEW )
    
    // Can also use GLU_NONE, GLU_FLAT
    gluQuadricNormals(quadric, GLU_SMOOTH);   // Create Smooth Normals
    gluQuadricTexture(quadric, GL_TRUE);      // Create Texture Coords ( NEW )
    
    m_bFullscreen = false;
    m_mouseX = 0;
    m_mouseY = 0;
    m_tiltAngle = -70.0f;
    m_twistAngle = -45.0f;
    m_distance = 270.0f;
    m_bLeftMouseButtonDown = false;
    m_bRightMouseButtonDown = false;
    m_lastTick = 0;
    m_lastRenderTick = 0;
    m_bPaused = false;
}
开发者ID:DaveHarrison,项目名称:OpenSGDevMaster,代码行数:33,代码来源:openglslave.cpp

示例14: InitGL

int InitGL(GLvoid)										// All Setup For OpenGL Goes Here
{
    if (!LoadGLTextures())								// If Loading The Textures Failed
    {
        return false;									// Return false
    }
    glShadeModel(GL_SMOOTH);							// Enable Smooth Shading
    glClearColor(0.2f, 0.5f, 1.0f, 1.0f);				// Background
    glClearDepth(1.0f);									// Depth Buffer Setup
    glClearStencil(0);									// Clear The Stencil Buffer To 0
    glEnable(GL_DEPTH_TEST);							// Enables Depth Testing
    glDepthFunc(GL_LEQUAL);								// The Type Of Depth Testing To Do
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	// Really Nice Perspective Calculations
    glEnable(GL_TEXTURE_2D);							// Enable 2D Texture Mapping

    glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmb);			// Set The Ambient Lighting For Light0
    glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDif);			// Set The Diffuse Lighting For Light0
    glLightfv(GL_LIGHT0, GL_POSITION, LightPos);		// Set The Position For Light0

    glEnable(GL_LIGHT0);								// Enable Light 0
    glEnable(GL_LIGHTING);								// Enable Lighting

    q = gluNewQuadric();								// Create A New Quadratic
    gluQuadricNormals(q, GL_SMOOTH);					// Generate Smooth Normals For The Quad
    gluQuadricTexture(q, GL_TRUE);						// Enable Texture Coords For The Quad

    glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);	// Set Up Sphere Mapping
    glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);	// Set Up Sphere Mapping

    return true;										// Initialization Went OK
}
开发者ID:ventureheart,项目名称:opengl,代码行数:31,代码来源:Lesson26.cpp

示例15: glShadeModel

GLvoid NEHE09::InitGL(){
	
	//give the relative directory of image under current project folder
	if(!LoadGLTextures("NeheGL/img/star.bmp")){
        cout<<"Fail to load textures"<<endl;
    }
	
	glEnable(GL_TEXTURE_2D);	// Enable Texture Mapping
    glShadeModel(GL_SMOOTH);	// Enable Smooth Shading
    glClearColor(0.0f, 0.0f, 0.0f, 0.5f);	// Black Background
    glClearDepth(1.0f);	// Depth Buffer Setup
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
    glBlendFunc(GL_SRC_ALPHA,GL_ONE);	// Set The Blending Function For Translucency
    glEnable(GL_BLEND);	// Enable Blending
	
	//initial stars
	for(loop=0; loop<num; loop++){
		star[loop].angle=0.0f;
		star[loop].dist=(float(loop)/num)*5.0f;
		star[loop].r=rand()%256;
		star[loop].g=rand()%256;
		star[loop].b=rand()%256;
	}
	
}
开发者ID:HVisionSensing,项目名称:NeheGL_XCode,代码行数:25,代码来源:nehe09.cpp


注:本文中的LoadGLTextures函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。