64位系统运行nehe opengl

作者:用户 来源:互联网 浏览:351 次 时间:2016-10-31 09:29:47

opengl

64位系统运行nehe opengl - 摘要: 64位系统运行neheopengl我按照网上下载的nehesdk进行配置以后,运行以后不出现opengl的窗口。但使用网上另外一段opengl代码就运行成功了,不知道是不是因为64位系统的问题,用的是

问题描述

64位系统运行nehe opengl

我按照网上下载的nehe sdk进行配置以后,运行以后不出现opengl的窗口。
但使用网上另外一段opengl代码就运行成功了,不知道是不是因为64位系统的问题,用的是systemwow64文件夹存放dll。

解决方案

#include "opengl.h"
#include "view.h"
using namespace NeHe;
// the view class
static View view;

static GLfloat rtri; // Angle For The Triangle

static GLfloat rquad; // Angle For The Quad

void DrawScene(OpenGL *gl,ControlData *cont)
{

view.Reset();

view.Translate(-1.5f,0.0f,-6.0f); // Move Left 1.5 Units And Into The Screen 6.0

view.Rotate(rtri,0.0f,1.0f,0.0f); // Rotate The Triangle On The Y axis

glBegin(GL_TRIANGLES);        // Start Drawing A Triangle   
glColor3f(1.0f,0.0f,0.0f);      // Red    
glVertex3f( 0.0f, 1.0f, 0.0f);     // Top Of Triangle (Front)  
glColor3f(0.0f,1.0f,0.0f);      // Green   
glVertex3f(-1.0f,-1.0f, 1.0f);     // Left Of Triangle (Front)  
glColor3f(0.0f,0.0f,1.0f);      // Blue   
glVertex3f( 1.0f,-1.0f, 1.0f);     // Right Of Triangle (Front) 
glColor3f(1.0f,0.0f,0.0f);      // Red  
glVertex3f( 0.0f, 1.0f, 0.0f);     // Top Of Triangle (Right)  
glColor3f(0.0f,0.0f,1.0f);      // Blue   
glVertex3f( 1.0f,-1.0f, 1.0f);     // Left Of Triangle (Right) 
glColor3f(0.0f,1.0f,0.0f);      // Green  
glVertex3f( 1.0f,-1.0f, -1.0f);     // Right Of Triangle (Right) 
glColor3f(1.0f,0.0f,0.0f);      // Red   
glVertex3f( 0.0f, 1.0f, 0.0f);     // Top Of Triangle (Back) 
glColor3f(0.0f,1.0f,0.0f);      // Green  
glVertex3f( 1.0f,-1.0f, -1.0f);     // Left Of Triangle (Back) 
glColor3f(0.0f,0.0f,1.0f);      // Blue  
glVertex3f(-1.0f,-1.0f, -1.0f);     // Right Of Triangle (Back) 
glColor3f(1.0f,0.0f,0.0f);      // Red  
glVertex3f( 0.0f, 1.0f, 0.0f);     // Top Of Triangle (Left) 
glColor3f(0.0f,0.0f,1.0f);      // Blue   
glVertex3f(-1.0f,-1.0f,-1.0f);          // Left Of Triangle (Left)
glColor3f(0.0f, 1.0f, 0.0f);      // Green     
glVertex3f(-1.0f,-1.0f, 1.0f);      // Right Of Triangle (Left) 
glEnd();                      // Done Drawing The Pyramid 

view.Reset();          // Reset The Current Modelview Matrix  
view.Translate(1.5f,0.0f,-7.0f);     // Move Right 1.5 Units And Into The Screen 7.0
view.Rotate(rquad,1.0f,1.0f,1.0f);          // Rotate The Quad On The X axis  
glBegin(GL_QUADS);       // Draw A Quad  
glColor3f(0.0f,1.0f,0.0f);      // Set The Color To Blue 
glVertex3f( 1.0f, 1.0f,-1.0f);     // Top Right Of The Quad (Top) 
glVertex3f(-1.0f, 1.0f,-1.0f);     // Top Left Of The Quad (Top)
glVertex3f(-1.0f, 1.0f, 1.0f);     // Bottom Left Of The Quad (Top) 
glVertex3f( 1.0f, 1.0f, 1.0f);     // Bottom Right Of The Quad (Top)
glColor3f(1.0f,0.5f,0.0f);      // Set The Color To Orange  
glVertex3f( 1.0f,-1.0f, 1.0f);     // Top Right Of The Quad (Bottom)
glVertex3f(-1.0f,-1.0f, 1.0f);     // Top Left Of The Quad (Bottom)
glVertex3f(-1.0f,-1.0f,-1.0f);     // Bottom Left Of The Quad (Bottom) 
glVertex3f( 1.0f,-1.0f,-1.0f);     // Bottom Right Of The Quad (Bottom)  
glColor3f(1.0f,0.0f,0.0f);      // Set The Color To Red 
glVertex3f( 1.0f, 1.0f, 1.0f);     // Top Right Of The Quad (Front)
glVertex3f(-1.0f, 1.0f, 1.0f);     // Top Left Of The Quad (Front)  
glVertex3f(-1.0f,-1.0f, 1.0f);     // Bottom Left Of The Quad (Front)   
glVertex3f( 1.0f,-1.0f, 1.0f);     // Bottom Right Of The Quad (Front) 
glColor3f(1.0f,1.0f,0.0f);      // Set The Color To Yellow 
glVertex3f( 1.0f,-1.0f,-1.0f);     // Top Right Of The Quad (Back) 
glVertex3f(-1.0f,-1.0f,-1.0f);     // Top Left Of The Quad (Back) 
glVertex3f(-1.0f, 1.0f,-1.0f);     // Bottom Left Of The Quad (Back)
glVertex3f( 1.0f, 1.0f,-1.0f);     // Bottom Right Of The Quad (Back) 
glColor3f(0.0f,0.0f,1.0f);      // Set The Color To Blue  
glVertex3f(-1.0f, 1.0f, 1.0f);     // Top Right Of The Quad (Left)
glVertex3f(-1.0f, 1.0f,-1.0f);     // Top Left Of The Quad (Left) 
glVertex3f(-1.0f,-1.0f,-1.0f);     // Bottom Left Of The Quad (Left)
glVertex3f(-1.0f,-1.0f, 1.0f);     // Bottom Right Of The Quad (Left) 
glColor3f(1.0f,0.0f,1.0f);      // Set The Color To Violet  
glVertex3f( 1.0f, 1.0f,-1.0f);     // Top Right Of The Quad (Right) 
glVertex3f( 1.0f, 1.0f, 1.0f);     // Top Left Of The Quad (Right)
glVertex3f( 1.0f,-1.0f, 1.0f);     // Bottom Left Of The Quad (Right) 
glVertex3f( 1.0f,-1.0f,-1.0f);      // Bottom Right Of The Quad (Right)
glEnd();                  // Done Drawing The Quad   

rtri+=0.2f;        // Increase The Rotation Variable For The Triangle ( NEW ) 
rquad-=0.15f;              // Decrease The Rotation Variable For The Quad ( NEW ) 

}
这是网上给的nehe opengl代码,运行不能显示窗口。

解决方案二:

直接对比两段代码不同之处

【云栖快讯】诚邀你用自己的技术能力来用心回答每一个问题,通过回答传承技术知识、经验、心得,问答专家期待你加入!  详情请点击
云栖社区(yq.aliyun.com)为您免费提供64位系统运行nehe opengl相关信息,包括 opengl 的信息 ,所有64位系统运行nehe opengl相关内容均不代表云栖社区的意见! 该页面h5页面的地址是:https://m.aliyun.com/yunqi/wenzhang/show_65375,您可以点击64位系统运行nehe opengl-手机站访问。
弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率

40+云计算产品,6个月免费体验

现在注册,免费体验40+云产品,及域名优惠!

云服务器9.9元/月,大学必备

热点导航