MFC Opengl配置头文件只有glu.h和gl.h没有glut.h

glut32和glut的dll和lib还有glut.h都放到了该放的文件夹,但头文件的GL里还是只有glu和gl。好郁闷。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Win10下Qt+opengl使用报错,说找不到lgl、lglu、lglut,(已经包含了glu.h和glut.h)怎么解决啊?
![图片说明](https://img-ask.csdn.net/upload/201912/23/1577107133_517844.png)
OpenGL的glut库是不是已经包含了gl和glu等库?
初学opengl, 很多不知道。VS2015是否已经自带了opengl的核心库gl?在网上下了glut库,配置好了也能进行图形编程。这是不是说明glut库已经集成了gl库?在编程时,是不是只要写#include<glut.h>,不用写#include<gl.h>也可以?
Qt5中用opengl时gluOrtho2D总是无法解析的外部符号?
试过了网上的各种方法,无果。 错误如下: error LNK2019: unresolved external symbol _gluOrtho2D@16 referenced in function "protected: virtual void __thiscall widget::initializeGL(void)" (?initializeGL@widget@@MAEXXZ) 现100%确定include了glu.h,glut.h,gl.h文件,link了glu.lib,glu32.lib等文件,也define了GLUT_DISABLE_ATEXIT_HACK,.lib,.dll,.h文件也都放对了位置,而且不用Qt的时候是没问题的,放到Qt的QGLWidget里就无法解析了。为什么? 而且注意到错误提示里_gluOrtho2D@后面是16,网上的错误一般都是@32的…… 为什么会无法解析?求指导……
MAC上使用XCODE想开发OPENGL时候遇到的问题
我在网上看教程学习OPENGL游戏开发时,教程是基于WINDOWS开发的OPENGL,调用了WINDOWS特有的OPENGL的API,有个实例小程序开头是这样: #ifdef _WINDOWS #include <windows.h> #endif #include <gl/gl.h> #include <gl/glu.h> #include <math.h> #include "CGfxOpenGL.h" 。。。(接下来不是我问的重点) 我现在使用的是MAC上xcode实验,window.h这些我知道肯定不能用,include<gl/gl.h>这些也修改成mac的版本,在xcode的library 里面也加入了glut和opengl库文件(glut相关小程序都能实现),但这里,"CGfxOpenGL.h"这个问题怎么解决,目前程序报错不认CGfxOpenGL.h啊。
OpenGL初学,请问我这段代码有错吗?为什么在窗口显示不出来
#include <windows.h> #include <math.h> #include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h> const GLint screenWidth = 640; const GLint screenHeight = 480; void myInit(void) { glClearColor(1.0, 1.0, 1.0, 0.0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0, (GLdouble)screenWidth, 0.0, (GLdouble)screenHeight); } void checkerboard(void) { for(GLint i = 0; i < 8; i++) { for(GLint j = 0; j < 8; j++) { if((i+j)%2 == 0) { glColor3f(0.0f, 0.0f, 0.0f); } else { glColor3f(1.0f, 1.0f, 1.0f); } glRecti(30*j, 30*i, 30*(j+1), 30*(i+1)); } } glFlush(); } void myDisplay(void) { glClear(GL_COLOR_BUFFER_BIT); checkerboard(); } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(screenWidth, screenHeight); glutInitWindowPosition(0, 0); glutCreateWindow("chess"); glutDisplayFunc(myDisplay); myInit(); glutMainLoop(); }
Android OpenGL es 下面这段代码在模拟器2.2上可以正常 在真机上都是黑屏
测试环境:平板Android 2.3.1 和 mtk6592 cpu Android4.2.2 mtk6592 cpu Android4.2.2 还报错 09-20 15:00:30.264: E/linker(13810): load_library(linker.cpp:761): library "libmaliinstr.so" not found 09-20 15:00:30.265: E/(13810): appName=cn.it.opengl, acAppName=com.android.cts.openglperf 09-20 15:00:30.265: E/(13810): 009-20 15:00:30.266: E/(13810): appName=cn.it.opengl, acAppName=com.android.browser09-20 15:00:30.266: E/(13810): 0 public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); view = new MyGLSurfaceView(this); this.setContentView(view); //渲染模式:持续渲染(默认)|命令渲染 view.setRenderer(new MyRendererCirclePoint()); //设置脏渲染(命令渲染) view.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY); //请求渲染,renderer.onDrawFrame(); // view.requestRender(); } class MyGLSurfaceView extends GLSurfaceView{ public MyGLSurfaceView(Context context) { super(context); } } public class MyRendererCirclePoint implements Renderer { private float ratio; /** * 表层创建时调用该方法 */ public void onSurfaceCreated(GL10 gl, EGLConfig config) { //清屏色(黑色) gl.glClearColor(0, 0, 0, 1); //颜色缓冲和顶点缓冲区 gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_COLOR_ARRAY); } /** * 表层大小改变时调用该方法 */ public void onSurfaceChanged(GL10 gl, int width, int height) { gl.glViewport(0, 0, width, height); ratio = (float)width / height; //投影矩阵 gl.glMatrixMode(GL10.GL_PROJECTION); gl.glLoadIdentity();//重置矩阵 gl.glFrustumf(-ratio, ratio, -1, 1, 3, 100);//设置平截头体 } /** * 绘图 */ public void onDrawFrame(GL10 gl) { //清除颜色缓冲去 gl.glClear(GL10.GL_COLOR_BUFFER_BIT); gl.glMatrixMode(GL10.GL_MODELVIEW);//设置模型视图矩阵 gl.glLoadIdentity(); GLU.gluLookAt(gl, 0, 0, 5, 0, 0, 0, 0, 1, 0);//架设相机位置 /** * vertextList,顶点集合 */ float r = 0.6f ;//半径 List<Float> vertextList = new ArrayList<Float>(); float x = 0 , y = 0 , z = 0.8f ; for(float angle = 0 ; angle <= Math.PI * 6 ; angle = (float) (angle + (Math.PI / 20))){ x = (float) (r * Math.cos(angle)); y = (float) (r * Math.sin(angle)); z = z - 0.01f ; vertextList.add(x); vertextList.add(y); vertextList.add(z); } ByteBuffer vbb = ByteBuffer.allocateDirect(vertextList.size() * 4); vbb.order(ByteOrder.nativeOrder()); FloatBuffer fbb = FloatBuffer.allocate(vertextList.size()); for(Float f : vertextList){ fbb.put(f); } fbb.position(0); vbb.position(0); //设置蓝色 gl.glColor4f(0, 0, 1, 1); gl.glPointSize(5f); gl.glRotatef(-90, 1, 0, 0); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vbb); gl.glDrawArrays(GL10.GL_POINTS, 0, vertextList.size() / 3); } }
Python3.5.1 PyopenGL模块调用出错
测试PyopenGL模块的源代码来自网上: ``` from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * def drawFunc(): glClear(GL_COLOR_BUFFER_BIT) #glRotatef(1, 0, 1, 0) glutWireTeapot(0.5) glFlush() glutInit() glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA) glutInitWindowSize(400, 400) glutCreateWindow("First") glutDisplayFunc(drawFunc) #glutIdleFunc(drawFunc) glutMainLoop() ``` 运行错误提示如下: ``` ============= RESTART: F:\Python35-32\Code\PyOpenGLCode\Test.py ============= Traceback (most recent call last): File "F:\Python35-32\Code\PyOpenGLCode\Test.py", line 11, in <module> glutInit() File "F:\Python35-32\lib\site-packages\OpenGL\GLUT\special.py", line 333, in glutInit _base_glutInit( ctypes.byref(count), holder ) File "F:\Python35-32\lib\site-packages\OpenGL\platform\baseplatform.py", line 407, in __call__ self.__name__, self.__name__, OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutInit) before calling >>> ```
关于用Opengl中NURBS画出圆柱面后的裁剪问题
首先用相应的控制点、节点等画出圆柱面(不裁剪),结果是正确的,如图所示: ![图片说明](https://img-ask.csdn.net/upload/202001/03/1578021922_478530.png) 但当我通过以下的裁剪代码进行裁剪后,却出现了我不能理解的结果,裁剪代码以及裁剪结果如下图: ``` GLfloat outSidePts[5][2] = { {0.0f, 0.0f} ,{1.0f, 0.0f}, {1.0f, 1.0f},{0.0f, 1.0f}, {0.0f, 0.0f} }; gluBeginTrim(theNurbs); gluPwlCurve(theNurbs, 5, //修剪点的个数 &outSidePts[0][0], //修剪点数组 2, //点之间的间隔 GLU_MAP1_TRIM_2);//修剪的类型 gluEndTrim(theNurbs); ``` ![图片说明](https://img-ask.csdn.net/upload/202001/03/1578021995_755222.png) 我的理解是,因为我裁剪的是整个UV参数域,从0到1,按道理说应该与裁剪前结果是一样的,但是结果却出现了多余线条,这是为什么?求大神解答
请问如何将OpenGL中的纹理单元传递给片段着色器???
小白我最近在学习GLSL,绝对的菜鸟级别啊~ 今天遇到了一个问题,我用 *texture[1]* 在程序中存储了一个纹理,然后使用了下面两行代码将纹理传递给片段着色器,程序是可以运行的 *texUnitLoc = glGetUniformLocation(p, "tex"); glUniform1i(texUnitLoc, 0);* 但是当我在程序中存储两个纹理以后,想要将两个纹理都传递到着色器时,应该怎么办啊??将上面代码中的‘0’换做‘texture[0]’也不管用啊,什么都不管用啊,glUniform究竟是怎么一回事啊?求大神指点~~T_T 附代码如下: #include <stdio.h> #include <stdlib.h> #include <GL/glew.h> #include <GL/glut.h> #include <glaux.h> #include "textfile.h" #include "printInfoLog.h" GLfloat LightAmbient0[]= {1, 1, 1, 1.0f }; GLfloat LightDiffuse0[]= {1.0f, 1.0f, 1.0f, 1.0f }; GLfloat LightSpecular0[]={1.0f, 1.0f, 1.0f, 1.0f}; GLfloat LightPosition0[]= {3.0f, 3.0f, 3.0f, 0.0f }; GLfloat MaterialAmbient[] = {0.3, 0.3, 0.3, 1.0f}; GLfloat MaterialDiffuse[] = {0.7, 0.7, 0.7, 1.0f}; GLfloat MaterialSpecular[] ={0.3, 0.3, 0.3, 1.0f}; GLfloat MaterialSe = 64.0f; GLUquadricObj *quadratic; GLuint texture[2]; // 存储一个纹理 GLint texUnitLoc,l3dUnitLoc; float a = 0.0f; GLuint v,f,p; float t = 0; GLint loc; AUX_RGBImageRec *LoadBMP(char *Filename) // 载入位图图象 { FILE *File=NULL; // 文件句柄 if (!Filename) // 确保文件名已提供 { return NULL; // 如果没提供,返回 NULL } File=fopen(Filename,"r"); // 尝试打开文件 if (File) // 文件存在么? { fclose(File); // 关闭句柄 return auxDIBImageLoad(Filename);// 载入位图并返回指针 } return NULL; // 如果载入失败,返回 NULL } int LoadGLTextures() // 载入位图(调用上面的代码)并转换成纹理 { int Status=FALSE; // 状态指示器 AUX_RGBImageRec *TextureImage[2]; // 创建纹理的存储空间 memset(TextureImage,0,sizeof(void *)*1); // 将指针设为 NULL // 载入位图,检查有无错误,如果位图没找到则退出 if (TextureImage[0]=LoadBMP("Data/Crate.bmp")) { Status=TRUE; // 将 Status 设为 TRUE glGenTextures(1, &texture[0]); // 创建纹理 // 创建 MipMapped 纹理 glBindTexture(GL_TEXTURE_2D, texture[0]); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data); } if (TextureImage[0]) // 纹理是否存在 { if (TextureImage[0]->data) // 纹理图像是否存在 { free(TextureImage[0]->data); // 释放纹理图像占用的内存 } free(TextureImage[0]); // 释放图像结构 } if (TextureImage[1]=LoadBMP("Data/1.bmp")) { Status=TRUE; // 将 Status 设为 TRUE glGenTextures(1, &texture[1]); // 创建纹理 // 创建 MipMapped 纹理 glBindTexture(GL_TEXTURE_2D, texture[1]); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage[1]->sizeX, TextureImage[1]->sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[1]->data); } if (TextureImage[1]) // 纹理是否存在 { if (TextureImage[1]->data) // 纹理图像是否存在 { free(TextureImage[1]->data); // 释放纹理图像占用的内存 } free(TextureImage[1]); // 释放图像结构 } return Status; // 返回 Status } void changeSize(int w, int h) { float ratio = 1.0* w / h; glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0, 0, w, h); gluPerspective(45,ratio,1,100); glMatrixMode(GL_MODELVIEW); } void init() { glEnable(GL_DEPTH_TEST); glClearColor(0.0,0.0,0.0,0.0); glEnable(GL_CULL_FACE); glEnable(GL_LIGHTING); glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient0); glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse0); glLightfv(GL_LIGHT0,GL_SPECULAR, LightSpecular0); glLightfv(GL_LIGHT0, GL_POSITION, LightPosition0); glEnable(GL_LIGHT0); glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, MaterialAmbient); glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialDiffuse); glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR, MaterialSpecular); glMaterialf(GL_FRONT_AND_BACK,GL_SHININESS, MaterialSe); quadratic=gluNewQuadric(); gluQuadricNormals(quadratic, GLU_SMOOTH); gluQuadricTexture(quadratic, GL_TRUE); LoadGLTextures(); // 调用纹理载入子例程 glEnable(GL_TEXTURE_2D); // 启用纹理映射 } void renderScene(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); gluLookAt(0.0,0.0,5.0, 0.0,0.0,-1.0, 0.0f,1.0f,0.0f); a += 0.35f; if(a > 360) a -= 360.0f; glRotatef(a, 0, 1, 0); glRotatef(0, 1, 0, 0); //glBindTexture(GL_TEXTURE_2D, texture[0]); gluSphere(quadratic, 1, 32, 16); t+=0.01; glutPostRedisplay(); glutSwapBuffers(); } int main(int argc, char **argv) { void setShaders(); glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); glutCreateWindow("GLSL DEMO"); init(); glutDisplayFunc(renderScene); glutReshapeFunc(changeSize); glewInit(); if (glewIsSupported("GL_VERSION_2_0")) printf("Ready for OpenGL 2.0\n"); else { printf("OpenGL 2.0 not supported\n"); exit(1); } setShaders(); texUnitLoc = glGetUniformLocation(p, "tex"); glUniform1i(texUnitLoc, 0); //l3dUnitLoc = glGetUniformLocation(p, "l3d"); //glUniform1i(l3dUnitLoc, texture[1]); glutMainLoop(); return 0; } void setShaders() { char *vs = NULL,*fs = NULL,*fs2 = NULL; v = glCreateShader(GL_VERTEX_SHADER); f = glCreateShader(GL_FRAGMENT_SHADER); vs = textFileRead("vs.txt"); fs = textFileRead("fs.txt"); const char * vv = vs; const char * ff = fs; glShaderSource(v, 1, &vv,NULL); glShaderSource(f, 1, &ff,NULL); free(vs);free(fs); glCompileShader(v); glCompileShader(f); printShaderInfoLog(v); printShaderInfoLog(f); p = glCreateProgram(); glAttachShader(p,v); glAttachShader(p,f); glLinkProgram(p); printProgramInfoLog(p); glUseProgram(p); //将p改为0表示使用固定的管线 }
OpenGL 窗口无法正确显示(编译,链接均通过)
正在学习OpenGL,一边学习,一边动手在编,下面的程序改编自nehe的地图加载程序,程序的编译与链接都能通过,可是窗口显示的时候会卡死,个人感觉问题可能出现在display,和reshape 处,以及main函数里面(这块有点不懂),试了很多的方法,还是没能解决问题,还望前辈们能够帮忙指点下,实在是没辙了 /(ㄒoㄒ)/~~ 忘记了 这个需要一个.raw格式的图片进行导入 如果需要的话我再传上来,(公司电脑没法上传 /(ㄒoㄒ)/~~) ``` #include <windows.h> #include <GL/glut.h> #include <stdlib.h> #include <stdio.h> #include <gl\gl.h> #include <gl\glu.h> #include <gl\glaux.h> #define WIDTH 800 #define HEIGHT 535 #define STEP 5 #define HEIGHT_RATIO 0.5f #pragma comment(lib, "opengl32.lib") #pragma comment(lib, "glu32.lib") #pragma comment(lib,"Ws2_32.lib") BYTE mapInfo[WIDTH*HEIGHT];//设置地图信息数组 float scale = 0.15f; int getHeight(BYTE *map, int X, int Y)//获取地形高度 { int x = X ; int y = Y ; if(!map) { MessageBox(NULL, "No map has been found", "Error", MB_OK); return 0; } return map[x + (y * HEIGHT)]; } void setColor(BYTE *map, int x, int y)//设置地形颜色 { if(!map) return; float fColor = -0.15f + (getHeight(map, x, y ) / 256.0f); glColor3f(0, 0, fColor ); } void loadFile(char *name, int size, BYTE *map)//加载地图高程信息 { FILE *file = NULL; file = fopen( name, "rb" ); if ( file == NULL ) { MessageBox(NULL, "No file has been found", "Error", MB_OK); return; } fread( map, 1, size, file ); int isSuccess = ferror( file ); if (isSuccess) { MessageBox(NULL, "No data has been gotten", "Error", MB_OK); } fclose(file); } void init(void)//初始化 { 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); loadFile("pic/map.raw", WIDTH * HEIGHT, mapInfo); return ; } void reshape(int width, int height) { glViewport(0,0,width,height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f, (GLfloat)width/(GLfloat)height, 0.1f, 500.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(190, 50, 50, 160, 45, 50, 0, 1, 0); glScalef(scale, scale * HEIGHT_RATIO, scale); } void display(void) //渲染地图 { BYTE *map=mapInfo; int X = 0, Y = 0; int x, y, z; if(!map) return; glBegin( GL_QUADS ); for ( X = 0; X < (WIDTH-STEP); X += STEP) for ( Y = 0; Y < (HEIGHT-STEP); Y += STEP ) { x = X; y = getHeight(map, X, Y ); z = Y; setColor(map, x, z); glVertex3i(x, y, z); x = X; y = getHeight(map, X, Y + STEP ); z = Y + STEP ; setColor(map, x, z); glVertex3i(x, y, z); x = X + STEP; y = getHeight(map, X + STEP, Y + STEP ); z = Y + STEP ; setColor(map, x, z); glVertex3i(x, y, z); x = X + STEP; y = getHeight(map, X + STEP, Y ); z = Y; setColor(map, x, z); glVertex3i(x, y, z); } glEnd(); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB); glutInitWindowSize (500, 500); glutInitWindowPosition (100, 100); glutCreateWindow (argv[0]); init (); glutDisplayFunc(display); glutReshapeFunc(reshape); glutMainLoop(); return 0; } ```
使用glClear和glClearColor,为什么背景颜色变不了呢,一直是黑的
``` #include "glwidget.h" #include "qwidget.h" #include "ui_widget.h" #include "QTOPENGL\glu.h" #include <QtGui> #include <QtOpenGL> /* Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { ui->setupUi(this); } Widget::~Widget() { delete ui; } */ NeHeWidget::NeHeWidget(QGLWidget *parent,bool fs): QGLWidget(parent) // ui(new Ui::NeHeWidget) { // ui->setupUi(this); fullscreen=fs; setGeometry(100,200,640,480); setWindowTitle("NeHe'OpenGL Framework"); if(fullscreen) showFullScreen(); } NeHeWidget::~NeHeWidget() { // delete ui; } void NeHeWidget::initializeGL() { glClearColor(0.5,0.5,0.0,0.0); glShadeModel(GL_SMOOTH); glClearDepth(1.0); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST); } void NeHeWidget::paintGL() { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BITS); glLoadIdentity(); glBegin(GL_TRIANGLES); glColor3f(1.0,0.0,0.0); glVertex3f(0.0,1.0,0.0); glVertex3f(-1.0,-1.0,0.0); glVertex3f(1.0,-1.0,0.0); glEnd(); } void NeHeWidget::resizeGL(int width, int height) { if(height==0) { height=1; } glViewport(0,0,(GLint)width,(GLint)height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0,(GLfloat)width/(GLfloat)height,0.1,100.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } void NeHeWidget::keyPressEvent(QKeyEvent*e) { switch(e->key()) { case Qt::Key_F2: fullscreen=!fullscreen; if(fullscreen) { showFullScreen(); } else { showNormal(); setGeometry(100,200,640,480); } updateGL(); break; case Qt::Key_Escape: close(); } } ```
OpenGL中的图片打不开
我在学习NeHe教程,用的是vs2010,纹理时加载不进去,调试时这段代码直接就跳过了,文件加载不进去 if (File) // Does The File Exist? { fclose(File); // Close The Handle return auxDIBImageLoad(Filename); // Load The Bitmap And Return A Pointer } 各位大神求解答 /* * This Code Was Created By Jeff Molofee 2000 * A HUGE Thanks To Fredric Echols For Cleaning Up * And Optimizing The Base Code, Making It More Flexible! * If You've Found This Code Useful, Please Let Me Know. * Visit My Site At nehe.gamedev.net */ #define _CRT_SECURE_NO_WARNINGS #include <windows.h> // Header File For Windows #include <stdio.h> // Header File For Standard Input/Output #include <gl\gl.h> // Header File For The OpenGL32 Library #include <gl\glu.h> // Header File For The GLu32 Library #include <gl\glaux.h> // Header File For The Glaux Library HDC hDC=NULL; // Private GDI Device Context HGLRC hRC=NULL; // Permanent Rendering Context HWND hWnd=NULL; // Holds Our Window Handle HINSTANCE hInstance; // Holds The Instance Of The Application bool keys[256]; // Array Used For The Keyboard Routine bool active=TRUE; // Window Active Flag Set To TRUE By Default bool fullscreen=TRUE; // Fullscreen Flag Set To Fullscreen Mode By Default bool texLoaded = false; GLfloat xrot; // X Rotation ( NEW ) GLfloat yrot; // Y Rotation ( NEW ) GLfloat zrot; // Z Rotation ( NEW ) GLuint texture[1]; // Storage For One Texture ( NEW ) LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); // Declaration For WndProc AUX_RGBImageRec *LoadBMP(char *Filename) // Loads A Bitmap Image { FILE *File=NULL; // File Handle if (!Filename) // Make Sure A Filename Was Given { return NULL; // If Not Return NULL } File=fopen(Filename,"r"); // Check To See If The File Exists if (File) // Does The File Exist? { fclose(File); // Close The Handle return auxDIBImageLoad(Filename); // Load The Bitmap And Return A Pointer } return NULL; // If Load Failed Return NULL } int LoadGLTextures() // Load Bitmaps And Convert To Textures { int Status=FALSE; // Status Indicator AUX_RGBImageRec *TextureImage[1]; // Create Storage Space For The Texture memset(TextureImage,0,sizeof(void *)*1); // Set The Pointer To NULL // Load The Bitmap, Check For Errors, If Bitmap's Not Found Quit if (TextureImage[0]=LoadBMP("Data\NeHe.bmp")) { Status=TRUE; // Set The Status To TRUE glGenTextures(1, &texture[0]); // Create The Texture // Typical Texture Generation Using Data From The Bitmap glBindTexture(GL_TEXTURE_2D, texture[0]); glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); } if (TextureImage[0]) // If Texture Exists { if (TextureImage[0]->data) // If Texture Image Exists { free(TextureImage[0]->data); // Free The Texture Image Memory } free(TextureImage[0]); // Free The Image Structure } return Status; // Return The Status } GLvoid ReSizeGLScene(GLsizei width, GLsizei height) // Resize And Initialize The GL Window { if (height==0) // Prevent A Divide By Zero By { height=1; // Making Height Equal One } glViewport(0,0,width,height); // Reset The Current Viewport glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glLoadIdentity(); // Reset The Projection Matrix // Calculate The Aspect Ratio Of The Window gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f); glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glLoadIdentity(); // Reset The Modelview Matrix } int InitGL(GLvoid) // 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 return TRUE; // Initialization Went OK } int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer glLoadIdentity(); // Reset The View glTranslatef(0.0f,0.0f,-5.0f); glRotatef(xrot,1.0f,0.0f,0.0f); glRotatef(yrot,0.0f,1.0f,0.0f); glRotatef(zrot,0.0f,0.0f,1.0f); glBegin(GL_QUADS); // Front Face glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); // Back Face glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f); // Top Face glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); // Bottom Face glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, -1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, -1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); // Right face glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); // Left Face glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); glEnd(); xrot+=0.3f; yrot+=0.2f; zrot+=0.4f; return TRUE; // Keep Going } GLvoid KillGLWindow(GLvoid) // Properly Kill The Window { if (fullscreen) // Are We In Fullscreen Mode? { ChangeDisplaySettings(NULL,0); // If So Switch Back To The Desktop ShowCursor(TRUE); // Show Mouse Pointer } if (hRC) // Do We Have A Rendering Context? { if (!wglMakeCurrent(NULL,NULL)) // Are We Able To Release The DC And RC Contexts? { MessageBox(NULL,"Release Of DC And RC Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); } if (!wglDeleteContext(hRC)) // Are We Able To Delete The RC? { MessageBox(NULL,"Release Rendering Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); } hRC=NULL; // Set RC To NULL } if (hDC && !ReleaseDC(hWnd,hDC)) // Are We Able To Release The DC { MessageBox(NULL,"Release Device Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); hDC=NULL; // Set DC To NULL } if (hWnd && !DestroyWindow(hWnd)) // Are We Able To Destroy The Window? { MessageBox(NULL,"Could Not Release hWnd.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); hWnd=NULL; // Set hWnd To NULL } if (!UnregisterClass("OpenGL",hInstance)) // Are We Able To Unregister Class { MessageBox(NULL,"Could Not Unregister Class.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); hInstance=NULL; // Set hInstance To NULL } } /* This Code Creates Our OpenGL Window. Parameters Are: * * title - Title To Appear At The Top Of The Window * * width - Width Of The GL Window Or Fullscreen Mode * * height - Height Of The GL Window Or Fullscreen Mode * * bits - Number Of Bits To Use For Color (8/16/24/32) * * fullscreenflag - Use Fullscreen Mode (TRUE) Or Windowed Mode (FALSE) */ BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag) { GLuint PixelFormat; // Holds The Results After Searching For A Match WNDCLASS wc; // Windows Class Structure DWORD dwExStyle; // Window Extended Style DWORD dwStyle; // Window Style RECT WindowRect; // Grabs Rectangle Upper Left / Lower Right Values WindowRect.left=(long)0; // Set Left Value To 0 WindowRect.right=(long)width; // Set Right Value To Requested Width WindowRect.top=(long)0; // Set Top Value To 0 WindowRect.bottom=(long)height; // Set Bottom Value To Requested Height fullscreen=fullscreenflag; // Set The Global Fullscreen Flag hInstance = GetModuleHandle(NULL); // Grab An Instance For Our Window wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; // Redraw On Size, And Own DC For Window. wc.lpfnWndProc = (WNDPROC) WndProc; // WndProc Handles Messages wc.cbClsExtra = 0; // No Extra Window Data wc.cbWndExtra = 0; // No Extra Window Data wc.hInstance = hInstance; // Set The Instance wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); // Load The Default Icon wc.hCursor = LoadCursor(NULL, IDC_ARROW); // Load The Arrow Pointer wc.hbrBackground = NULL; // No Background Required For GL wc.lpszMenuName = NULL; // We Don't Want A Menu wc.lpszClassName ="OpenGL"; // Set The Class Name if (!RegisterClass(&wc)) // Attempt To Register The Window Class { MessageBox(NULL,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } if (fullscreen) // Attempt Fullscreen Mode? { DEVMODE dmScreenSettings; // Device Mode memset(&dmScreenSettings,0,sizeof(dmScreenSettings)); // Makes Sure Memory's Cleared dmScreenSettings.dmSize=sizeof(dmScreenSettings); // Size Of The Devmode Structure dmScreenSettings.dmPelsWidth = width; // Selected Screen Width dmScreenSettings.dmPelsHeight = height; // Selected Screen Height dmScreenSettings.dmBitsPerPel = bits; // Selected Bits Per Pixel dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT; // Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar. if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL) { // If The Mode Fails, Offer Two Options. Quit Or Use Windowed Mode. if (MessageBox(NULL,"The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. Use Windowed Mode Instead?","NeHe GL",MB_YESNO|MB_ICONEXCLAMATION)==IDYES) { fullscreen=FALSE; // Windowed Mode Selected. Fullscreen = FALSE } else { // Pop Up A Message Box Letting User Know The Program Is Closing. MessageBox(NULL,"Program Will Now Close.","ERROR",MB_OK|MB_ICONSTOP); return FALSE; // Return FALSE } } } if (fullscreen) // Are We Still In Fullscreen Mode? { dwExStyle=WS_EX_APPWINDOW; // Window Extended Style dwStyle=WS_POPUP; // Windows Style ShowCursor(FALSE); // Hide Mouse Pointer } else { dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; // Window Extended Style dwStyle=WS_OVERLAPPEDWINDOW; // Windows Style } AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle); // Adjust Window To True Requested Size // Create The Window if (!(hWnd=CreateWindowEx( dwExStyle, // Extended Style For The Window "OpenGL", // Class Name title, // Window Title dwStyle | // Defined Window Style WS_CLIPSIBLINGS | // Required Window Style WS_CLIPCHILDREN, // Required Window Style 0, 0, // Window Position WindowRect.right-WindowRect.left, // Calculate Window Width WindowRect.bottom-WindowRect.top, // Calculate Window Height NULL, // No Parent Window NULL, // No Menu hInstance, // Instance NULL))) // Dont Pass Anything To WM_CREATE { KillGLWindow(); // Reset The Display MessageBox(NULL,"Window Creation Error.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } static PIXELFORMATDESCRIPTOR pfd= // pfd Tells Windows How We Want Things To Be { sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor 1, // Version Number PFD_DRAW_TO_WINDOW | // Format Must Support Window PFD_SUPPORT_OPENGL | // Format Must Support OpenGL PFD_DOUBLEBUFFER, // Must Support Double Buffering PFD_TYPE_RGBA, // Request An RGBA Format bits, // Select Our Color Depth 0, 0, 0, 0, 0, 0, // Color Bits Ignored 0, // No Alpha Buffer 0, // Shift Bit Ignored 0, // No Accumulation Buffer 0, 0, 0, 0, // Accumulation Bits Ignored 16, // 16Bit Z-Buffer (Depth Buffer) 0, // No Stencil Buffer 0, // No Auxiliary Buffer PFD_MAIN_PLANE, // Main Drawing Layer 0, // Reserved 0, 0, 0 // Layer Masks Ignored }; if (!(hDC=GetDC(hWnd))) // Did We Get A Device Context? { KillGLWindow(); // Reset The Display MessageBox(NULL,"Can't Create A GL Device Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } if (!(PixelFormat=ChoosePixelFormat(hDC,&pfd))) // Did Windows Find A Matching Pixel Format? { KillGLWindow(); // Reset The Display MessageBox(NULL,"Can't Find A Suitable PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } if(!SetPixelFormat(hDC,PixelFormat,&pfd)) // Are We Able To Set The Pixel Format? { KillGLWindow(); // Reset The Display MessageBox(NULL,"Can't Set The PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } if (!(hRC=wglCreateContext(hDC))) // Are We Able To Get A Rendering Context? { KillGLWindow(); // Reset The Display MessageBox(NULL,"Can't Create A GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } if(!wglMakeCurrent(hDC,hRC)) // Try To Activate The Rendering Context { KillGLWindow(); // Reset The Display MessageBox(NULL,"Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } ShowWindow(hWnd,SW_SHOW); // Show The Window SetForegroundWindow(hWnd); // Slightly Higher Priority SetFocus(hWnd); // Sets Keyboard Focus To The Window ReSizeGLScene(width, height); // Set Up Our Perspective GL Screen if (!InitGL()) // Initialize Our Newly Created GL Window { KillGLWindow(); // Reset The Display MessageBox(NULL,"Initialization Failed.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } return TRUE; // Success } LRESULT CALLBACK WndProc( HWND hWnd, // Handle For This Window UINT uMsg, // Message For This Window WPARAM wParam, // Additional Message Information LPARAM lParam) // Additional Message Information { switch (uMsg) // Check For Windows Messages { case WM_ACTIVATE: // Watch For Window Activate Message { if (!HIWORD(wParam)) // Check Minimization State { active=TRUE; // Program Is Active } else { active=FALSE; // Program Is No Longer Active } return 0; // Return To The Message Loop } case WM_SYSCOMMAND: // Intercept System Commands { switch (wParam) // Check System Calls { case SC_SCREENSAVE: // Screensaver Trying To Start? case SC_MONITORPOWER: // Monitor Trying To Enter Powersave? return 0; // Prevent From Happening } break; // Exit } case WM_CLOSE: // Did We Receive A Close Message? { PostQuitMessage(0); // Send A Quit Message return 0; // Jump Back } case WM_KEYDOWN: // Is A Key Being Held Down? { keys[wParam] = TRUE; // If So, Mark It As TRUE return 0; // Jump Back } case WM_KEYUP: // Has A Key Been Released? { keys[wParam] = FALSE; // If So, Mark It As FALSE return 0; // Jump Back } case WM_SIZE: // Resize The OpenGL Window { ReSizeGLScene(LOWORD(lParam),HIWORD(lParam)); // LoWord=Width, HiWord=Height return 0; // Jump Back } } // Pass All Unhandled Messages To DefWindowProc return DefWindowProc(hWnd,uMsg,wParam,lParam); } int WINAPI WinMain( HINSTANCE hInstance, // Instance HINSTANCE hPrevInstance, // Previous Instance LPSTR lpCmdLine, // Command Line Parameters int nCmdShow) // Window Show State { MSG msg; // Windows Message Structure BOOL done=FALSE; // Bool Variable To Exit Loop // Ask The User Which Screen Mode They Prefer if (MessageBox(NULL,"Would You Like To Run In Fullscreen Mode?", "Start FullScreen?",MB_YESNO|MB_ICONQUESTION)==IDNO) { fullscreen=FALSE; // Windowed Mode } // Create Our OpenGL Window if (!CreateGLWindow("NeHe's Texture Mapping Tutorial",640,480,16,fullscreen)) { return 0; // Quit If Window Was Not Created } while(!done) // Loop That Runs While done=FALSE { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Is There A Message Waiting? { if (msg.message==WM_QUIT) // Have We Received A Quit Message? { done=TRUE; // If So done=TRUE } else // If Not, Deal With Window Messages { TranslateMessage(&msg); // Translate The Message DispatchMessage(&msg); // Dispatch The Message } } else // If There Are No Messages { // Draw The Scene. Watch For ESC Key And Quit Messages From DrawGLScene() if ((active && !DrawGLScene()) || keys[VK_ESCAPE]) // Active? Was There A Quit Received? { done=TRUE; // ESC or DrawGLScene Signalled A Quit } else // Not Time To Quit, Update Screen { SwapBuffers(hDC); // Swap Buffers (Double Buffering) } if (keys[VK_F1]) // Is F1 Being Pressed? { keys[VK_F1]=FALSE; // If So Make Key FALSE KillGLWindow(); // Kill Our Current Window fullscreen=!fullscreen; // Toggle Fullscreen / Windowed Mode // Recreate Our OpenGL Window if (!CreateGLWindow("NeHe's Texture Mapping Tutorial",640,480,16,fullscreen)) { return 0; // Quit If Window Was Not Created } } } } // Shutdown KillGLWindow(); // Kill The Window return (msg.wParam); // Exit The Program }
创建窗口过程中的问题
本人最近在做毕业设计,需要基于OpenGL显示,在创建窗口的过程中遇到了hWnd创建失败的问题,但是没有办法查出来具体问题在哪,请教各位大神了。。跪求解答,万分感谢,救急!!! #define WIN32_LEAN_AND_MEAN //裁剪过大的windows库 #include "windows.h" #include "gl\gl.h" #include "gl\glu.h" #include "GLaux.h" static LPCTSTR lpszAppName = "OpenGL App"; float angle = 0.0f; HDC g_HDC; //HBRUSH hBlueBrush,hRedBrush; void SetupPixelFormat(HDC hDC) { GLuint nPixelFormat; //像素格式变量 static PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, PFD_MAIN_PLANE, 0, 0, 0, 0, }; nPixelFormat = ChoosePixelFormat(hDC,&pfd); SetPixelFormat(hDC, nPixelFormat, &pfd); } //windows事件处理器 LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static HGLRC hRC; static HDC hDC; int width,height; switch(message) { case WM_CREATE: hDC = GetDC(hWnd); g_HDC = hDC; SetupPixelFormat(hDC); hRC = wglCreateContext(hDC); wglMakeCurrent(hDC,hRC); /*MessageBox(NULL,"error5。","关闭错误",MB_OK | MB_ICONINFORMATION);return 0; break;*/ case WM_CLOSE: wglMakeCurrent(hDC,NULL); wglDeleteContext(hRC); PostQuitMessage(0); /* MessageBox(NULL,"error4。","关闭错误",MB_OK | MB_ICONINFORMATION);return 0; break;*/ case WM_SIZE: height = HIWORD(lParam); width = LOWORD(lParam); if(height == 0) {height = 1;} glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f, (GLfloat)width/(GLfloat)height, 1.0f, 1000.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); /*MessageBox(NULL,"error3。","关闭错误",MB_OK | MB_ICONINFORMATION);return 0; break;*/ /* case WM_PAINT: { PAINTSTRUCT ps; HBRUSH hOldBrush; BeginPaint(hWnd, &ps); hOldBrush = SelectObject(ps.hdc, hRedBrush); Rectangle(ps.hdc, 100,100,150,150); SelectObject(ps.hdc, hOldBrush); EndPaint(hWnd, &ps); } break; */ default: return DefWindowProc(hWnd,message,wParam,lParam);//break; } return (0L); } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { WNDCLASSEX wc; MSG msg; HWND hWnd; BOOL done; /* hBlueBrush = CreateSolidBrush(RGB(0,0,255)); hRedBrush = CreateSolidBrush(RGB(255,0,0)); */ wc.cbSize = sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW ; wc.lpfnWndProc = (WNDPROC)WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(hInstance, IDC_ARROW); wc.hbrBackground = NULL; wc.lpszClassName = lpszAppName; wc.lpszMenuName = NULL; wc.hIconSm = LoadIcon(wc.hInstance,IDI_WINLOGO); if(!RegisterClassEx(&wc)) // return 0; {MessageBox(NULL,"error1。","关闭错误",MB_OK | MB_ICONINFORMATION);return 0;} hWnd = CreateWindowEx( NULL, "MyClass", "The OpenGL window Application", WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_SYSMENU | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 100,100, 400,400, NULL, NULL, hInstance, NULL); if(!hWnd) { MessageBox(NULL,"error2。","关闭错误",MB_OK | MB_ICONINFORMATION); return 0; } ShowWindow(hWnd, SW_SHOW); UpdateWindow(hWnd); done = FALSE; while(!done) { PeekMessage(&msg, hWnd, NULL, NULL, PM_REMOVE); if(msg.message == WM_QUIT) {done = TRUE;} else { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); angle = angle + 0.1f; if(angle >= 360.f) angle = 0.0f; glTranslatef(0.0f, 0.0f, -5.0f); //向后移动五个单位 glRotatef(angle, 0.0f, 0.0f, 1.0f); //绕z轴转 glColor3f(1.0f, 0.0f, 0.0f); glBegin(GL_TRIANGLES); glVertex3f(0.0f, 0.0f, 0.0f); glVertex3f(1.0f, 0.0f, 0.0f); glVertex3f(1.0f, 1.0f, 0.0f); glEnd(); SwapBuffers(g_HDC); TranslateMessage(&msg); DispatchMessage(&msg); } } return msg.wParam; }
一个雪人程序,但是雪人无法显示出来,只弹出一个黑框,咋改呢?
#include<GL/glut.h> //旋转参数 static GLfloat xRot = 180; static GLfloat yRot = 180; void doMyInit() { glClearColor(0.0, 0.0, 0.0, 0.0); // Set the clear color to black // Specify the boundaries of the viewing window glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(-1.0, 1.0, -1.0, 1.0); // The para are: (left, right, bottom, top) glMatrixMode(GL_MODELVIEW); } void snowman() { GLUquadricObj *pObj; // declare Quadric Object glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear the frame buffer // Save the matrix state and put the snowman in place glPushMatrix(); // Move snowman back and do in place rotation glTranslatef(0.0f, -1.0f, -5.0f); glRotatef(xRot, 1.0f, 0.0f, 0.0f); glRotatef(yRot, 0.0f, 1.0f, 0.0f); // create Quadric object pObj = gluNewQuadric(); gluQuadricNormals(pObj, GLU_SMOOTH); // Main Body glPushMatrix(); glColor3f(1.0f, 1.0f, 1.0f); gluSphere(pObj, .40f, 26, 13); // Bottom glTranslatef(0.0f, .550f, 0.0f); gluSphere(pObj, .3f, 26, 13); // Mid section glTranslatef(0.0f, 0.45f, 0.0f); gluSphere(pObj, 0.24f, 26, 13); // Head // Eyes glColor3f(0.0f, 0.0f, 0.0f); glTranslatef(0.1f, 0.1f, 0.21f); gluSphere(pObj, 0.02f, 26, 13); glTranslatef(-0.2f, 0.0f, 0.0f); gluSphere(pObj, 0.02f, 26, 13); // Nose glColor3f(1.0f, 0.3f, 0.3f); glTranslatef(0.1f, -0.12f, 0.0f); gluCylinder(pObj, 0.04f, 0.0f, 0.3f, 26, 13); glPopMatrix(); // Hat glPushMatrix(); glColor3f(0.0f, 0.0f, 0.0f); glTranslatef(0.0f, 1.17f, 0.0f); glRotatef(-90.0f, 1.0f, 0.0f, 0.0f); gluCylinder(pObj, 0.17f, 0.17f, 0.4f, 26, 13); // Hat brim glDisable(GL_CULL_FACE); gluDisk(pObj, 0.17f, 0.28f, 26, 13); glEnable(GL_CULL_FACE); glTranslatef(0.0f, 0.0f, 0.40f); gluDisk(pObj, 0.0f, 0.17f, 26, 13); glPopMatrix(); glPopMatrix(); glutSwapBuffers(); glFlush(); // Force to display the new drawings immediately } void reshape(GLsizei w, GLsizei h) { glViewport(0, 0, w, h);//设置视口 glMatrixMode(GL_PROJECTION);//指明当前矩阵为GL_PROJECTION glLoadIdentity();//将当前矩阵置换为单位阵 if (w <= h) gluOrtho2D(-1.0, 1.5, -1.5, 1.5*(GLfloat)h / (GLfloat)w);//定义二维正视投影矩阵 else gluOrtho2D(-1.0, 1.5*(GLfloat)w / (GLfloat)h, -1.5, 1.5); glMatrixMode(GL_MODELVIEW);//指明当前矩阵为GL_MODELVIEW } int main(int argc, char ** argv) { //初始化 glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(500, 500); glutInitWindowPosition(0, 0); //创建窗口 glutCreateWindow("SnowMan"); /*绘制与显示*/ doMyInit(); glutReshapeFunc(reshape); glutDisplayFunc(snowman); //main event loop glutMainLoop(); return(0); }
用opengl纹理实现地球仪 问题
纹理已经正确加载,但是在没用纹理矩阵时纹理根本动不了。如果用glMatrixMode(GL_TEXTURE) 转动很奇怪,而且感觉纹理没很好的铺满球体。求正确方法我的显示代码: glMatrixMode(GL_MODELVIEW); glPushMatrix(); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glBindTexture(GL_TEXTURE_2D,texture1); glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glMatrixMode(GL_TEXTURE); //不使用纹理矩阵时,纹理动不了 glRotatef(angle,0,1,0); //angle递增,纹理能动,但好像并不是简单的旋转 glTexGeni(GL_S,GL_TEXTURE_GEN_MODE,GL_SPHERE_MAP); glTexGeni(GL_T,GL_TEXTURE_GEN_MODE,GL_SPHERE_MAP); glPopMatrix();glMatrixMode(GL_MODELVIEW); glRotatef(angle,0,1,0); glutSolidSphere(0.5,30,30); glPopMatrix(); glFlush();网上有用glu库二次曲面的,是可以的,这个就不要再说了。
在Win10 VS2015下配置opencv3.3出问题
我按百度上的配置完后,跑一段代码来测试是否配置成功 ``` #include <opencv.hpp> #include <iostream> using namespace cv; using namespace std; int main() { cout << "OpenCV Version: " << CV_VERSION << endl; Mat img = imread("img.jpg"); imshow("img", img); waitKey(0); return 0; } ``` 结果报了这么多问题,程序可以运行,但是窗口一闪而过,看不到图片,打开exe文件就会报错而中止 'computer vision1.exe' (Win32): Loaded 'C:\C++ 试作品\VS2015 Project\MFC 工程\computer vision1\x64\Debug\computer vision1.exe'. Symbols loaded. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140d.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\opencv_world330d.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140d.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\opencv_world330.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbased.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\win32u.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\gdi32full.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\ole32.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\combase.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\oleaut32.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\msvcp_win.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\comdlg32.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\bcryptprimitives.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\shlwapi.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\shell32.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\msvfw32.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\avicap32.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\avifil32.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\cfgmgr32.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\winmm.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\winmmbase.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\windows.storage.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\powrprof.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\concrt140d.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.14393.447_none_0d5aa7fbb6d35646\comctl32.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.14393.447_none_0d5aa7fbb6d35646\comctl32.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\kernel.appcore.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\profapi.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\msacm32.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Unloaded 'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.14393.447_none_0d5aa7fbb6d35646\comctl32.dll' 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\concrt140.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\uxtheme.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\msctf.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\dwmapi.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\OpenCL.DLL'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\igdlh64.inf_amd64_e1474e9d5907af3f\IntelOpenCL64.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Program Files (x86)\Common Files\Intel\OpenCL\bin\x64\intelocl64.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\opengl32.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Program Files (x86)\Common Files\Intel\OpenCL\bin\x64\task_executor64.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\ddraw.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\dciman32.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\glu32.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Program Files (x86)\Common Files\Intel\OpenCL\bin\x64\cpu_device64.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\version.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\igdlh64.inf_amd64_e1474e9d5907af3f\igdrcl64.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\dxgi.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\ResourcePolicyClient.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Unloaded 'C:\Windows\System32\ResourcePolicyClient.dll' 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\igdlh64.inf_amd64_e1474e9d5907af3f\igdfcl64.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\igdlh64.inf_amd64_e1474e9d5907af3f\igdmcl64.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\dbghelp.dll'. Cannot find or open the PDB file. 'computer vision1.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\igdlh64.inf_amd64_e1474e9d5907af3f\igc64.dll'. Cannot find or open the PDB file. The thread 0x1cd4 has exited with code 0 (0x0). The thread 0x1750 has exited with code 0 (0x0). The thread 0x3668 has exited with code 0 (0x0). The thread 0x2b88 has exited with code 0 (0x0). The program '[6504] computer vision1.exe' has exited with code 0 (0x0).
DNA Translation DNA序列的问题
Description Deoxyribonucleic acid (DNA) is composed of a sequence of nucleotide bases paired together to form a double-stranded helix structure. Through a series of complex biochemical processes the nucleotide sequences in an organism's DNA are translated into the proteins it requires for life. The object of this problem is to write a computer program which accepts a DNA strand and reports the protein generated, if any, from the DNA strand. The nucleotide bases from which DNA is built are adenine, cytosine, guanine, and thymine (hereafter referred to as A, C, G, and T, respectively). These bases bond together in a chain to form half of a DNA strand. The other half of the DNA strand is a similar chain, but each nucleotide is replaced by its complementary base. The bases A and T are complementary, as are the bases C and G. These two "half-strands" of DNA are then bonded by the pairing of the complementary bases to form a strand of DNA. Typically a DNA strand is listed by simply writing down the bases which form the primary strand (the complementary strand can always be created by writing the complements of the bases in the primary strand). For example, the sequence TACTCGTAATTCACT represents a DNA strand whose complement would be ATGAGCATTAAGTGA. Note that A is always paired with T, and C is always paired with G. From a primary strand of DNA, a strand of ribonucleic acid (RNA) known as messenger RNA (mRNA for short) is produced in a process known as transcription. The transcribed mRNA is identical to the complementary DNA strand with the exception that thymine is replaced by a nucleotide known as uracil (hereafter referred to as U). For example, the mRNA strand for the DNA in the previous paragraph would be AUGAGCAUUAAGUGA. It is the sequence of bases in the mRNA which determines the protein that will be synthesized. The bases in the mRNA can be viewed as a collection of codons, each codon having exactly three bases. The codon AUG marks the start of a protein sequence, and any of the codons UAA, UAG, or UGA marks the end of the sequence. The one or more codons between the start and termination codons represent the sequence of amino acids to be synthesized to form a protein. For example, the mRNA codon AGC corresponds to the amino acid serine (Ser), AUU corresponds to isoleucine (Ile), and AAG corresponds to lysine (Lys). So, the protein formed from the example mRNA in the previous paragraph is, in its abbreviated form, Ser-Ile-Lys. The complete genetic code from which codons are translated into amino acids is shown in the table below (note that only the amino acid abbreviations are shown). It should also be noted that the sequence AUG, which has already been identified as the start sequence, can also correspond to the amino acid methionine (Met). So, the first AUG in a mRNA strand is the start sequence, but subsequent AUG codons are translated normally into the Met amino acid. First base in codon Second base in codon Third base in codon U C A G U Phe Ser Tyr Cys U Phe Ser Tyr Cys C Leu Ser --- --- A Leu Ser --- Trp G C Leu Pro His Arg U Leu Pro His Arg C Leu Pro Gln Arg A Leu Pro Gln Arg G A Ile Thr Asn Ser U Ile Thr Asn Ser C Ile Thr Lys Arg A Met Thr Lys Arg G G Val Ala Asp Gly U Val Ala Asp Gly C Val Ala Glu Gly A Val Ala Glu Gly G Input The input for this program consists of strands of DNA sequences, one strand per line, from which the protein it generates, if any, should be determined and output. The given DNA strand may be either the primary or the complementary DNA strand, and it may appear in either forward or reverse order, and the start and termination sequences do not necessarily appear at the ends of the strand. For example, a given input DNA strand to form the protein Ser-Ile-Lys could be any of ATACTCGTAATTCACTCC, CCTCACTTAATGCTCATA, TATGAGCATTAAGTGAGG, or GGAGTGAATTACGAGTAT. The input will be terminated by a line containing a single asterisk character. Output You may assume the input to contain only valid, upper-case, DNA nucleotide base letters (A, C, G, and T). No input line will exceed 255 characters in length. There will be no blank lines or spaces in the input. Some sequences, though valid DNA strands, do not produce valid protein sequences; the string "*** No translatable DNA found ***" should be output when an input DNA strand does not translate into a valid protein. Sample Input ATACTCGTAATTCACTCC CACCTGTACACAGAGGTAACTTAG TTAATACGACATAATTAT GCCTTGATATGGAGAACTCATTAGATA AAGTGTATGTTGAATTATATAAAACGGGCATGA ATGATGATGGCTTGA * Sample Output Ser-Ile-Lys Cys-Leu-His Ser-Tyr *** No translatable DNA found *** Leu-Asn-Tyr-Ile-Lys-Arg-Ala Met-Met-Ala
使用凹凸性分割算法分割点云时,报错
我用凹凸性分割算法做点云的分割。先用超体聚类,生成一个映射表,再用LCCP算法进行分割,最后在编译的时候,提示找不到相应的exe文件,我也不知道哪里出错了,我用的PCL1.8,VS2013。而且还提示“不能打开OpenNI2.lib”,我查看了,我安装有这个openni2的,但是就是打不开,我不知道环境变量是不是错误了。我的环境变量的PATH路径如下:C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Sony\VAIO Startup Setting Tool;;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;F:\Program Files (x86)\PCL 1.8.0\bin;F:\Program Files (x86)\PCL 1.8.0\3rdParty\FLANN\lib;F:\Program Files (x86)\PCL 1.8.0\3rdParty\Qhull\bin;F:\Program Files (x86)\PCL 1.8.0\3rdParty\VTK\bin;F:\Program Files (x86)\PCL 1.8.0\3rdParty\OpenNI2\Lib。我不知道是不是哪里出错了,希望各位能帮我看一下。谢谢! 以下是我的附加依赖项: kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib comctl32.lib wsock32.lib glu32.lib opengl32.lib ws2_32.lib Psapi.lib pcl_visualization_debug.lib pcl_search_debug.lib pcl_io_debug.lib pcl_io_ply_debug.lib pcl_kdtree_debug.lib pcl_common_debug.lib pcl_octree_debug.lib libboost_system-vc120-mt-gd-1_59.lib libboost_filesystem-vc120-mt-gd-1_59.lib libboost_thread-vc120-mt-gd-1_59.lib libboost_date_time-vc120-mt-gd-1_59.lib libboost_iostreams-vc120-mt-gd-1_59.lib libboost_chrono-vc120-mt-gd-1_59.lib vtkDomainsChemistryOpenGL2-7.0-gd.lib vtkDomainsChemistry-7.0-gd.lib vtkFiltersFlowPaths-7.0-gd.lib vtkFiltersGeneric-7.0-gd.lib vtkFiltersHyperTree-7.0-gd.lib vtkFiltersParallelImaging-7.0-gd.lib vtkFiltersProgrammable-7.0-gd.lib vtkFiltersSelection-7.0-gd.lib vtkFiltersSMP-7.0-gd.lib vtkFiltersVerdict-7.0-gd.lib vtkverdict-7.0-gd.lib vtkGeovisCore-7.0-gd.lib vtkproj4-7.0-gd.lib vtkGUISupportQtSQL-7.0-gd.lib vtkIOSQL-7.0-gd.lib vtksqlite-7.0-gd.lib vtkImagingMath-7.0-gd.lib vtkImagingMorphological-7.0-gd.lib vtkImagingStatistics-7.0-gd.lib vtkImagingStencil-7.0-gd.lib vtkInteractionImage-7.0-gd.lib vtkIOAMR-7.0-gd.lib vtkFiltersAMR-7.0-gd.lib vtkIOEnSight-7.0-gd.lib vtkIOExodus-7.0-gd.lib vtkIOExport-7.0-gd.lib vtkIOImport-7.0-gd.lib vtkIOInfovis-7.0-gd.lib vtklibxml2-7.0-gd.lib vtkIOLSDyna-7.0-gd.lib vtkIOMINC-7.0-gd.lib vtkIOMovie-7.0-gd.lib vtkoggtheora-7.0-gd.lib vtkIOParallel-7.0-gd.lib vtkexoIIc-7.0-gd.lib vtkFiltersParallel-7.0-gd.lib vtkIONetCDF-7.0-gd.lib vtkNetCDF_cxx-7.0-gd.lib vtkNetCDF-7.0-gd.lib vtkhdf5_hl-7.0-gd.lib vtkhdf5-7.0-gd.lib vtkjsoncpp-7.0-gd.lib vtkIOParallelXML-7.0-gd.lib vtkIOXML-7.0-gd.lib vtkIOXMLParser-7.0-gd.lib vtkexpat-7.0-gd.lib vtkParallelCore-7.0-gd.lib vtkIOLegacy-7.0-gd.lib vtkIOPLY-7.0-gd.lib vtkIOGeometry-7.0-gd.lib vtkIOVideo-7.0-gd.lib vtkRenderingContextOpenGL2-7.0-gd.lib vtkRenderingImage-7.0-gd.lib vtkRenderingLOD-7.0-gd.lib vtkRenderingQt-7.0-gd.lib vtkFiltersTexture-7.0-gd.lib vtkRenderingVolumeOpenGL2-7.0-gd.lib vtkViewsContext2D-7.0-gd.lib vtkViewsQt-7.0-gd.lib vtkGUISupportQt-7.0-gd.lib vtkRenderingOpenGL2-7.0-gd.lib vtkglew-7.0-gd.lib vtkViewsInfovis-7.0-gd.lib vtkChartsCore-7.0-gd.lib vtkRenderingContext2D-7.0-gd.lib vtkFiltersImaging-7.0-gd.lib vtkInfovisLayout-7.0-gd.lib vtkInfovisCore-7.0-gd.lib vtkViewsCore-7.0-gd.lib vtkInteractionWidgets-7.0-gd.lib vtkImagingHybrid-7.0-gd.lib vtkIOImage-7.0-gd.lib vtkDICOMParser-7.0-gd.lib vtkIOCore-7.0-gd.lib vtkmetaio-7.0-gd.lib vtkpng-7.0-gd.lib vtktiff-7.0-gd.lib vtkjpeg-7.0-gd.lib vtkFiltersHybrid-7.0-gd.lib vtkImagingGeneral-7.0-gd.lib vtkImagingSources-7.0-gd.lib vtkFiltersModeling-7.0-gd.lib vtkInteractionStyle-7.0-gd.lib vtkRenderingAnnotation-7.0-gd.lib vtkImagingColor-7.0-gd.lib vtkRenderingVolume-7.0-gd.lib vtkRenderingLabel-7.0-gd.lib vtkRenderingFreeType-7.0-gd.lib vtkRenderingCore-7.0-gd.lib vtkCommonColor-7.0-gd.lib vtkFiltersExtraction-7.0-gd.lib vtkFiltersStatistics-7.0-gd.lib vtkalglib-7.0-gd.lib vtkImagingFourier-7.0-gd.lib vtkImagingCore-7.0-gd.lib vtkFiltersGeometry-7.0-gd.lib vtkFiltersSources-7.0-gd.lib vtkFiltersGeneral-7.0-gd.lib vtkFiltersCore-7.0-gd.lib vtkCommonExecutionModel-7.0-gd.lib vtkCommonComputationalGeometry-7.0-gd.lib vtkCommonDataModel-7.0-gd.lib vtkCommonMisc-7.0-gd.lib vtkCommonTransforms-7.0-gd.lib vtkCommonMath-7.0-gd.lib vtkCommonSystem-7.0-gd.lib vtkCommonCore-7.0-gd.lib vtksys-7.0-gd.lib vtkfreetype-7.0-gd.lib vtkzlib-7.0-gd.lib flann_cpp_s-gd.lib odbc32.lib odbccp32.lib OpenNI2.lib![![![图片说明](https://img-ask.csdn.net/upload/201707/23/1500797883_658583.png)图片说明](https://img-ask.csdn.net/upload/201707/23/1500797874_432983.png)图片说明](https://img-ask.csdn.net/upload/201707/23/1500797864_278862.png)
求教:STEP文件解析出的曲面数据用gluNurbsSurface绘画的问题
利用空闲时间自己写了一个STEP文件解析。可是解析出来的数据用gluNurbsSurface函数绘不出图形。 这是解析出来的数据: ========================================= GLfloat CtrlPoint[15][11][3] = { { { 0.396180,55.420753,-0.339999 }, { -4.653235,55.420746,-0.340001 }, { -9.621811,55.420780,-0.339775 }, { -14.050525,55.420662,-0.364466 }, { -16.463245,55.420780,-0.395637 }, { -18.554060,55.420628,-0.431171 }, { -20.763857,55.420708,-0.485464 }, { -23.641211,55.420509,-0.628331 }, { -27.128616,55.421169,-1.045857 }, { -29.227036,55.420670,-1.575200 }, { -30.188053,55.420795,-1.934166 } }, { { 0.391862,55.915108,-0.340013 }, { -4.602001,55.915131,-0.340019 }, { -9.544586,55.915169,-0.339743 }, { -13.987616,55.915241,-0.363895 }, { -16.416355,55.915390,-0.394920 }, { -18.516788,55.915371,-0.430465 }, { -20.733881,55.915504,-0.484327 }, { -23.617601,55.915447,-0.626374 }, { -27.116173,55.915535,-1.043046 }, { -29.223436,55.915161,-1.573819 }, { -30.189358,55.914875,-1.934648 } }, { { 0.384358,56.851002,-0.339657 }, { -4.512877,56.851021,-0.339631 }, { -9.421076,56.851048,-0.339272 }, { -13.906471,56.851311,-0.362722 }, { -16.371767,56.851555,-0.393841 }, { -18.492149,56.851772,-0.429611 }, { -20.722265,56.851925,-0.483436 }, { -23.612581,56.852146,-0.625561 }, { -27.116095,56.852062,-1.042340 }, { -29.223709,56.853149,-1.573360 }, { -30.188852,56.852924,-1.934337 } }, { { 0.372935,58.179333,-0.353692 }, { -4.376973,58.179798,-0.353618 }, { -9.245570,58.180267,-0.353281 }, { -13.818981,58.180782,-0.376462 }, { -16.353870,58.181198,-0.408418 }, { -18.512518,58.181751,-0.444851 }, { -20.767103,58.181908,-0.500031 }, { -23.666553,58.182644,-0.644998 }, { -27.157047,58.184246,-1.063828 }, { -29.238558,58.190113,-1.588565 }, { -30.184488,58.192352,-1.941806 } }, { { 0.360575,59.413937,-0.394705 }, { -4.229746,59.415619,-0.394698 }, { -9.055145,59.417278,-0.394600 }, { -13.726094,59.418381,-0.418016 }, { -16.339619,59.419086,-0.451076 }, { -18.543598,59.419952,-0.488196 }, { -20.828815,59.420158,-0.545257 }, { -23.742640,59.421547,-0.693872 }, { -27.216085,59.426136,-1.113946 }, { -29.261786,59.438492,-1.626709 }, { -30.181005,59.445297,-1.966521 } }, { { 0.347430,60.579803,-0.476209 }, { -4.073054,60.583607,-0.476508 }, { -8.849333,60.587418,-0.476947 }, { -13.620145,60.590111,-0.500861 }, { -16.316299,60.591545,-0.534941 }, { -18.569221,60.592880,-0.572488 }, { -20.888618,60.593521,-0.631266 }, { -23.820963,60.596081,-0.782867 }, { -27.279118,60.604572,-1.201117 }, { -29.289598,60.624355,-1.696387 }, { -30.182413,60.637894,-2.018497 } }, { { 0.335411,61.673443,-0.611145 }, { -3.929763,61.680119,-0.612128 }, { -8.664754,61.687119,-0.613495 }, { -13.531279,61.692574,-0.637932 }, { -16.304022,61.695259,-0.672570 }, { -18.600494,61.697304,-0.709939 }, { -20.948824,61.698704,-0.769575 }, { -23.894472,61.702702,-0.922069 }, { -27.335758,61.715443,-1.333270 }, { -29.318361,61.742729,-1.805597 }, { -30.192587,61.764133,-2.107212 } }, { { 0.323835,62.690128,-0.806288 }, { -3.792035,62.699791,-0.808431 }, { -8.484427,62.710270,-0.811183 }, { -13.436935,62.718651,-0.835980 }, { -16.279263,62.722790,-0.870511 }, { -18.614668,62.725616,-0.906930 }, { -20.988556,62.727757,-0.966152 }, { -23.946426,62.733250,-1.116681 }, { -27.377441,62.751457,-1.514939 }, { -29.346308,62.787239,-1.959615 }, { -30.213768,62.817215,-2.239034 } }, { { 0.311956,63.630329,-1.068795 }, { -3.650888,63.642754,-1.072714 }, { -8.289282,63.656456,-1.077406 }, { -13.312265,63.667461,-1.102242 }, { -16.216412,63.672909,-1.135769 }, { -18.587200,63.676319,-1.170238 }, { -20.985466,63.679043,-1.227325 }, { -23.959078,63.685894,-1.372183 }, { -27.395077,63.709705,-1.750528 }, { -29.371222,63.753456,-2.163080 }, { -30.247601,63.791500,-2.419285 } }, { { 0.295965,64.786026,-1.506171 }, { -3.461175,64.800629,-1.512817 }, { -8.012814,64.816757,-1.520406 }, { -13.105686,64.829529,-1.544819 }, { -16.079136,64.835854,-1.575963 }, { -18.490387,64.839409,-1.606755 }, { -20.917952,64.842476,-1.658949 }, { -23.916044,64.850700,-1.791643 }, { -27.380297,64.881157,-2.134801 }, { -29.396799,64.933273,-2.499629 }, { -30.307966,64.979561,-2.724183 } }, { { 0.276334,66.030304,-2.205175 }, { -3.226525,66.043480,-2.215111 }, { -7.642716,66.058044,-2.226399 }, { -12.771455,66.069916,-2.250023 }, { -15.801824,66.076218,-2.277041 }, { -18.247419,66.079742,-2.302287 }, { -20.702587,66.083542,-2.345565 }, { -23.735643,66.093933,-2.455723 }, { -27.277956,66.130859,-2.740284 }, { -29.406607,66.187813,-3.038391 }, { -30.406221,66.236511,-3.222476 } }, { { 0.252621,67.186798,-3.268190 }, { -2.947218,67.195946,-3.279870 }, { -7.172223,67.206093,-3.293343 }, { -12.290011,67.214943,-3.314248 }, { -15.357754,67.219788,-3.334449 }, { -17.827532,67.222710,-3.352131 }, { -20.305820,67.226532,-3.382119 }, { -23.383739,67.236305,-3.457649 }, { -27.060328,67.267227,-3.653424 }, { -29.380144,67.309601,-3.858564 }, { -30.523331,67.342438,-3.986731 } }, { { 0.232510,67.876495,-4.346978 }, { -2.714065,67.880211,-4.353499 }, { -6.767012,67.884476,-4.361573 }, { -11.853099,67.888840,-4.375108 }, { -14.939553,67.891464,-4.387467 }, { -17.422377,67.893379,-4.398559 }, { -19.914835,67.895996,-4.416266 }, { -23.028887,67.902039,-4.458865 }, { -26.829449,67.918930,-4.568076 }, { -29.325071,67.940041,-4.685094 }, { -30.597101,67.955116,-4.759522 } }, { { 0.220774,68.164368,-5.096286 }, { -2.573260,68.165863,-5.099390 }, { -6.533067,68.167656,-5.103587 }, { -11.618490,68.169785,-5.111461 }, { -14.726694,68.171204,-5.118582 }, { -17.222906,68.172356,-5.125169 }, { -19.726410,68.173920,-5.135098 }, { -22.859045,68.177422,-5.158138 }, { -26.716221,68.186806,-5.216928 }, { -29.292234,68.198242,-5.281814 }, { -30.623497,68.206230,-5.324024 } }, { { 0.216830,68.245834,-5.360061 }, { -2.525938,68.246780,-5.362195 }, { -6.456790,68.247948,-5.365202 }, { -11.546170,68.249435,-5.371111 }, { -14.664030,68.250473,-5.376442 }, { -17.166023,68.251350,-5.381429 }, { -19.673941,68.252533,-5.388788 }, { -22.812376,68.255165,-5.405632 }, { -26.684931,68.262115,-5.448541 }, { -29.282665,68.270523,-5.496467 }, { -30.630068,68.276352,-5.527918 } }}; GLint u_degree = 3; GLint v_degree = 3; GLint u_multiplicities[13] = { 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4 }; GLint v_multiplicities[9] = { 4, 1, 1, 1, 1, 1, 1, 1, 4 }; GLfloat u_knots[13] = { 0., 0.071307130996859, 0.137595256562749, 0.203883382128597, 0.270171507694445,0.336459633260292, 0.40274775882614, 0.469035884392094, 0.535324009957942, 0.667900261089637, 0.800476512221333, 0.933052763353134, 1. }; GLfloat v_knots[9] = { 0., 0.252050094115983, 0.374749611013778,0.497449127911572, 0.55879888636047, 0.620148644809465,0.74284816170726, 0.865547678605054,1. }; 下面是调用方法: void Draw() { 。。。 int S = 15; //CtrlPoint[15][11][3] int T = 11; //CtrlPoint[15][11][3] GLint S_ORDER = u_degree; GLint T_ORDER = v_degree; GLint S_NUMKNOTS = 13; GLint T_NUMKNOTS = 9; GLfloat *u_Knots = &u_knots[0]; GLfloat *v_Knots = &v_knots[0]; GLfloat *CtrlPoints = &(CtrlPoint[0][0][0]); if (!FUnurbsObj) { FUnurbsObj = gluNewNurbsRenderer(); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_COLOR_MATERIAL); GLfloat specular[] = { 0.7f, 0.7f, 0.7f, 1.0f }; GLfloat shine[] = { 100.0f }; glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE); glMaterialfv(GL_FRONT, GL_SPECULAR, specular); glMaterialfv(GL_FRONT, GL_SHININESS, shine); glEnable(GL_AUTO_NORMAL); gluNurbsProperty(FUnurbsObj, GLU_SAMPLING_TOLERANCE, 10.0f);//定义显示误差精度 gluNurbsProperty(FUnurbsObj, GLU_DISPLAY_MODE, (GLfloat)GLU_FILL);//填充 } gluBeginSurface(FUnurbsObj); gluNurbsSurface( FUnurbsObj, S_NUMKNOTS, u_Knots, T_NUMKNOTS, v_Knots, 3 * T, 3, CtrlPoints, S_ORDER, T_ORDER, GL_MAP2_VERTEX_3); gluEndSurface(FUnurbsObj); 。。。 } 路过的大牛们看看问题出在哪里?
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私有的数
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
此博客仅为我业余记录文章所用,发布到此,仅供网友阅读参考,如有侵权,请通知我,我会删掉。 补充 有不少读者留言说本文章没有用,因为天气预报直接打开手机就可以收到了,为何要多此一举发送到邮箱呢!!!那我在这里只能说:因为你没用,所以你没用!!! 这里主要介绍的是思路,不是天气预报!不是天气预报!!不是天气预报!!!天气预报只是用于举例。请各位不要再刚了!!! 下面是我会用到的两个场景: 每日下
Python 植物大战僵尸代码实现(2):植物卡片选择和种植
这篇文章要介绍的是: - 上方植物卡片栏的实现。 - 点击植物卡片,鼠标切换为植物图片。 - 鼠标移动时,判断当前在哪个方格中,并显示半透明的植物作为提示。
死磕YOLO系列,YOLOv1 的大脑、躯干和手脚
YOLO 是我非常喜欢的目标检测算法,堪称工业级的目标检测,能够达到实时的要求,它帮我解决了许多实际问题。 这就是 YOLO 的目标检测效果。它定位了图像中物体的位置,当然,也能预测物体的类别。 之前我有写博文介绍过它,但是每次重新读它的论文,我都有新的收获,为此我准备写一个系列的文章来详尽分析它。这是第一篇,从它的起始 YOLOv1 讲起。 YOLOv1 的论文地址:https://www.c
知乎高赞:中国有什么拿得出手的开源软件产品?(整理自本人原创回答)
知乎高赞:中国有什么拿得出手的开源软件产品? 在知乎上,有个问题问“中国有什么拿得出手的开源软件产品(在 GitHub 等社区受欢迎度较好的)?” 事实上,还不少呢~ 本人于2019.7.6进行了较为全面的 回答 - Bravo Yeung,获得该问题下回答中得最高赞(236赞和1枚专业勋章),对这些受欢迎的 Github 开源项目分类整理如下: 分布式计算、云平台相关工具类 1.SkyWalk
记一次腾讯面试:进程之间究竟有哪些通信方式?如何通信? ---- 告别死记硬背
有一次面试的时候,被问到进程之间有哪些通信方式,不过由于之前没深入思考且整理过,说的并不好。想必大家也都知道进程有哪些通信方式,可是我猜很多人都是靠着”背“来记忆的,所以今天的这篇文章,讲给大家详细着讲解他们是如何通信的,让大家尽量能够理解他们之间的区别、优缺点等,这样的话,以后面试官让你举例子,你也能够顺手拈来。 1、管道 我们来看一条 Linux 的语句 netstat -tulnp | gr...
20行Python代码爬取王者荣耀全英雄皮肤
引言 王者荣耀大家都玩过吧,没玩过的也应该听说过,作为时下最火的手机MOBA游戏,咳咳,好像跑题了。我们今天的重点是爬取王者荣耀所有英雄的所有皮肤,而且仅仅使用20行Python代码即可完成。 准备工作 爬取皮肤本身并不难,难点在于分析,我们首先得得到皮肤图片的url地址,话不多说,我们马上来到王者荣耀的官网: 我们点击英雄资料,然后随意地选择一位英雄,接着F12打开调试台,找到英雄原皮肤的图片
网络(8)-HTTP、Socket、TCP、UDP的区别和联系
TCP/IP协议是传输层协议,主要解决数据如何在网络中传输,而HTTP是应用层协议,主要解决如何包装数据。 一、TCP与UDP的不同 1. 是否需要建立连接。 UDP在传送数据之前不需要先建立连接;TCP则提供面向连接的服务; 2. 是否需要给出确认 对方的传输层在收到UDP报文后,不需要给出任何确认,而 TCP需要给出确认报文,要提供可靠的、面向连接的传输服务。 3.虽然UDP不提供可靠交...
简明易理解的@SpringBootApplication注解源码解析(包含面试提问)
欢迎关注文章系列 ,关注我 《提升能力,涨薪可待》 《面试知识,工作可待》 《实战演练,拒绝996》 欢迎关注我博客,原创技术文章第一时间推出 也欢迎关注公 众 号【Ccww笔记】,同时推出 如果此文对你有帮助、喜欢的话,那就点个赞呗,点个关注呗! 《提升能力,涨薪可待篇》- @SpringBootApplication注解源码解析 一、@SpringBootApplication 的作用是什
防劝退!数据结构和算法难理解?可视化动画带你轻松透彻理解!
大家好,我是 Rocky0429,一个连数据结构和算法都不会的蒟蒻… 学过数据结构和算法的都知道这玩意儿不好学,没学过的经常听到这样的说法还没学就觉得难,其实难吗?真难! 难在哪呢?当年我还是个小蒟蒻,初学数据结构和算法的时候,在忍着枯燥看完定义原理,之后想实现的时候,觉得它们的过程真的是七拐八绕,及其难受。 在简单的链表、栈和队列这些我还能靠着在草稿上写写画画理解过程,但是到了数论、图...
西游记团队中如果需要裁掉一个人,会先裁掉谁?
2019年互联网寒冬,大批企业开始裁员,下图是网上流传的一张截图: 裁员不可避免,那如何才能做到不管大环境如何变化,自身不受影响呢? 我们先来看一个有意思的故事,如果西游记取经团队需要裁员一名,会裁掉谁呢,为什么? 西游记团队组成: 1.唐僧 作为团队teamleader,有很坚韧的品性和极高的原则性,不达目的不罢休,遇到任何问题,都没有退缩过,又很得上司支持和赏识(直接得到唐太宗的任命,既给
开挂的人生!那些当选院士,又是ACM/IEEE 双料Fellow的华人学者们
昨日,2019年两院院士正式官宣,一时间抢占了各大媒体头条。 朋友圈也是一片沸腾,奔走相告,赶脚比自己中了大奖还嗨皮! 谁叫咱家导师就是这么厉害呢!!! 而就在最近,新一年度的IEEE/ACM Fellow也将正式公布。 作为学术届的顶级荣誉,不自然地就会将院士与Fellow作比较,到底哪个含金量更高呢? 学术君认为,同样是专业机构对学者的认可,考量标准不一,自然不能一概而论。 但...
聊聊C语言和指针的本质
坐着绿皮车上海到杭州,24块钱,很宽敞,在火车上非正式地聊几句。 很多编程语言都以 “没有指针” 作为自己的优势来宣传,然而,对于C语言,指针却是与生俱来的。 那么,什么是指针,为什么大家都想避开指针。 很简单, 指针就是地址,当一个地址作为一个变量存在时,它就被叫做指针,该变量的类型,自然就是指针类型。 指针的作用就是,给出一个指针,取出该指针指向地址处的值。为了理解本质,我们从计算机模型说起...
Python语言高频重点汇总
Python语言高频重点汇总 GitHub面试宝典仓库——点这里跳转 文章目录Python语言高频重点汇总**GitHub面试宝典仓库——点这里跳转**1. 函数-传参2. 元类3. @staticmethod和@classmethod两个装饰器4. 类属性和实例属性5. Python的自省6. 列表、集合、字典推导式7. Python中单下划线和双下划线8. 格式化字符串中的%和format9.
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观
代码详解:如何用Python快速制作美观、炫酷且有深度的图表
全文共12231字,预计学习时长35分钟生活阶梯(幸福指数)与人均GDP(金钱)正相关的正则图本文将探讨三种用Python可视化数据的不同方法。以可视化《2019年世界幸福报告》的数据为例,本文用Gapminder和Wikipedia的信息丰富了《世界幸福报告》数据,以探索新的数据关系和可视化方法。《世界幸福报告》试图回答世界范围内影响幸福的因素。报告根据对“坎特里尔阶梯问题”的回答来确定幸...
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外
(经验分享)作为一名普通本科计算机专业学生,我大学四年到底走了多少弯路
今年正式步入了大四,离毕业也只剩半年多的时间,回想一下大学四年,感觉自己走了不少弯路,今天就来分享一下自己大学的学习经历,也希望其他人能不要走我走错的路。 (一)初进校园 刚进入大学的时候自己完全就相信了高中老师的话:“进入大学你们就轻松了”。因此在大一的时候自己学习的激情早就被抛地一干二净,每天不是在寝室里玩游戏就是出门游玩,不过好在自己大学时买的第一台笔记本性能并不是很好,也没让我彻底沉...
如何写一篇技术博客,谈谈我的看法
前言 只有光头才能变强。 文本已收录至我的GitHub精选文章,欢迎Star:https://github.com/ZhongFuCheng3y/3y 我一直推崇学技术可以写技术博客去沉淀自己的知识,因为知识点实在是太多太多了,通过自己的博客可以帮助自己快速回顾自己学过的东西。 我最开始的时候也是只记笔记,认为自己能看得懂就好。但如果想验证自己是不是懂了,可以写成技术博客。在写技术博客的...
字节跳动面试官这样问消息队列:分布式事务、重复消费、顺序消费,我整理了一下
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式和人才交流群,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸...
面试还搞不懂redis,快看看这40道面试题(含答案和思维导图)
Redis 面试题 1、什么是 Redis?. 2、Redis 的数据类型? 3、使用 Redis 有哪些好处? 4、Redis 相比 Memcached 有哪些优势? 5、Memcache 与 Redis 的区别都有哪些? 6、Redis 是单进程单线程的? 7、一个字符串类型的值能存储最大容量是多少? 8、Redis 的持久化机制是什么?各自的优缺点? 9、Redis 常见性...
大学四年自学走来,这些珍藏的「实用工具/学习网站」我全贡献出来了
知乎高赞:文中列举了互联网一线大厂程序员都在用的工具集合,涉及面非常广,小白和老手都可以进来看看,或许有新收获。
互联网公司的裁员,能玩出多少种花样?
裁员,也是一门学问,可谓博大精深!以下,是互联网公司的裁员的多种方法:-正文开始-135岁+不予续签的理由:千禧一代网感更强。95后不予通过试用期的理由:已婚已育员工更有责任心。2通知接下来要过苦日子,让一部分不肯同甘共苦的员工自己走人,以“兄弟”和“非兄弟”来区别员工。3强制996。员工如果平衡不了工作和家庭,可在离婚或离职里二选一。4不布置任何工作,但下班前必须提交千字工作日报。5不给活干+...
【设计模式】单例模式的八种写法分析
网上泛滥流传单例模式的写法种类,有说7种的,也有说6种的,当然也不排除说5种的,他们说的有错吗?其实没有对与错,刨根问底,写法终究是写法,其本质精髓大体一致!因此完全没必要去追究写法的多少,有这个时间还不如跟着宜春去网吧偷耳机、去田里抓青蛙得了,一天天的....
《面试宝典》:检验是否为合格的初中级程序员的面试知识点,你都知道了吗?查漏补缺
欢迎关注文章系列,一起学习 《提升能力,涨薪可待篇》 《面试知识,工作可待篇》 《实战演练,拒绝996篇》 也欢迎关注公 众 号【Ccww笔记】,原创技术文章第一时间推出 如果此文对你有帮助、喜欢的话,那就点个赞呗,点个关注呗! 《面试知识,工作可待篇》-Java笔试面试基础知识大全 前言 是不是感觉找工作面试是那么难呢? 在找工作面试应在学习的基础进行总结面试知识点,工作也指日可待,欢...
关于研发效能提升的思考
研发效能提升是最近比较热门的一个话题,本人根据这几年的工作心得,做了一些思考总结,由于个人深度有限,暂且抛转引入。 三要素 任何生产力的提升都离不开这三个因素:人、流程和工具,少了其中任何一个因素都无法实现。 人,即思想,也就是古人说的“道”,道不同不相为谋,是制高点,也是高层建筑的基石。 流程,即方法,也是古人说的“法”。研发效能的提升,也就是要提高投入产出比,既要增加产出,也要减...
微博推荐算法简述
在介绍微博推荐算法之前,我们先聊一聊推荐系统和推荐算法。有这样一些问题:推荐系统适用哪些场景?用来解决什么问题、具有怎样的价值?效果如何衡量? 推荐系统诞生很早,但真正被大家所重视,缘起于以”facebook”为代表的社会化网络的兴起和以“淘宝“为代表的电商的繁荣,”选择“的时代已经来临,信息和物品的极大丰富,让用户如浩瀚宇宙中的小点,无所适从。推荐系统迎来爆发的机会,变得离用户更近: 快...
相关热词 c# 时间比天数 c# oracle查询 c# 主动推送 事件 c# java 属性 c# 控制台 窗体 c# 静态类存值 c#矢量作图 c#窗体调用外部程式 c# enum是否合法 c# 如何卸载引用
立即提问