glut

glutInitContextVersion() is missing from glut library

牧云@^-^@ 提交于 2019-12-05 10:57:21
I am practicing some opengl code, how ever when i want to force the opengl context to use a certain version of opengl through glutInitContextVersion() it fails compilation process and gives this message:- use of undeclared identifier 'glutInitContextVersion' i want to fix this issue so i kept my code as simple as possible code #include "File.h" #include <GLUT/GLUT.h> #include <OpenGL/OpenGL.h> using namespace std; int main () { glutInitContextVersion(3,2); return 1; } However i was able to use other glut functions without any error or warning messages I am running Xcode 4.4.1 on Macbook air

How to look for equivalent functions of OpenGL in QGLWidget?

故事扮演 提交于 2019-12-05 07:14:25
问题 I'm new to OpenGL and Glut. There is a project implemented by Glut. I googled and found that there is an OpenGL implementation in Qt, called QGLWidget. However, it's hard for me converting the old Glut code to new Qt code since I don't know how to find equivalent function for Glut functions in Qt. Part of the code look like this: glutInit(&argc,argv); glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB); glutInitWindowSize(gray1->width,gray1->height); glutInitWindowPosition(100,100); glutCreateWindow(

Mac OS X下如何使用OpenGL

ⅰ亾dé卋堺 提交于 2019-12-05 06:13:03
作为3D的工业标准,OpenGL在苹果上可以说无处不在,用起来也是分外的舒服。 一般OpenGL需要搭配一些窗口库来做,比如Qt、MFC等,或者用跨平台的GLUT。 好在GLUT是Mac OS X自带的,所以直接用就可以了,很方便。 OpenGL和GLUT作为Framework,都在/System/Library/Frameworks下。在程序里 唯一需要注意的是include的头文件。 Windows提供了OpenGL和GLU,如果用GLUT,得自己去装一个。Windows下的头文 件使用方式一般是 #include <Windows.h> #include <GL/gl.h> #include <GL/glu.h> //#include "GLUT/glut.h" //depends on where you put GLUT 而在Mac OS X下,一般是 #include <OpenGL/gl.h> #include <OpenGL/glu.h> #include <GLUT/glut.h> 在编译的时候,需要用到Mac OS X里gcc的-framework参数,例如 g++ -framework OpenGL -framework GLUT -framework Foundation -o test my.cpp 附件里是以前的实验作业(一个消隐算法

background colour in opengl

别说谁变了你拦得住时间么 提交于 2019-12-05 02:50:36
I want to change background color of the window after pressing the button, but my program doesn't work, can somebody tell me why, thanks in advance int main(int argc, char* argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(800, 600); glutInitWindowPosition(300,50); glutCreateWindow("GLRect"); glClearColor(1.0f, 0.0f, 0.0f, 1.0f); <--- glutDisplayFunc(RenderScene); glutReshapeFunc(ChangeSize); glutMainLoop(); system("pause"); glClearColor(0.0f, 1.0f, 0.0f, 1.0f); <--- return 0; } glClearColor does not do any clearing itself -- it just sets what the

new to OpenGL: glutMouseFunc

二次信任 提交于 2019-12-05 02:49:26
问题 I'm trying to change the sphere position after a mouse click but it doesnt work when using the x and y from glutMouseFunc ,, here is the code : // #include "stdafx.h" #include <stdlib.h> #include <GL/glut.h> bool Cone=false , ConeSelected=false, Cube=false, CubeSelected=false, Sphere=false, SphereSelected=false, Teapot=false, TeapotSelected =false, Torus=false, TorusSelected=false; static float XSphere=0, YSphere=-1.5 ,ZSphere=0; void init(void) { GLfloat blankMaterial[] = {1.0, 0.0, 0.0};

Visual Studio : when changed from win32 to x64, its showing linking error [duplicate]

孤街醉人 提交于 2019-12-04 21:46:15
This question already has an answer here: What is an undefined reference/unresolved external symbol error and how do I fix it? 32 answers My code was working fine when it was in win32 based application.Recently i changed it to x64 error came up and it said "cannot open glut32.lib".Then i added glut32.lib on additional dependencies but these linking errors appears now. 1>Linking... 1>dispfunc.obj : error LNK2019: unresolved external symbol glutSwapBuffers referenced in function "void __cdecl Display(void)" (?Display@@YAXXZ) 1>init.obj : error LNK2019: unresolved external symbol glutTimerFunc

OpenGL Rotation

笑着哭i 提交于 2019-12-04 18:30:42
问题 I'm trying to do a simple rotation in OpenGL but must be missing the point. I'm not looking for a specific fix so much as a quick explanation or link that explains OpenGL rotation more generally. At the moment I have code like this: glPushMatrix(); glRotatef(90.0, 0.0, 1.0, 0.0); glBegin(GL_TRIANGLES); glVertex3f( 1.0, 1.0, 0.0 ); glVertex3f( 3.0, 2.0, 0.0 ); glVertex3f( 3.0, 1.0, 0.0 ); glEnd(); glPopMatrix(); But the result is not a triangle rotated 90 degrees. Edit Hmm thanks to Mike

Problems with Shaders in OpenGL

廉价感情. 提交于 2019-12-04 06:11:30
问题 I'm trying to use stuff like glShaderSource in C++. Visual Studio says that functions like glCompileShader or glCreateProgram dont exist. I use FreeGLUT to include OpenGL. Does anybody have an idea how I can fix this? 回答1: On windows, anything beyond GL1.1 must be loaded via the extension mechansim. The most convenient way to do so is by using a GL loader like glew. 来源: https://stackoverflow.com/questions/20722756/problems-with-shaders-in-opengl

Changing projection in OpenGL

删除回忆录丶 提交于 2019-12-04 05:40:16
问题 I'm having trouble with resizing a GLUT window. I want to print a rectangle but when i use the resize function i cant seem to draw and shape in the window. I have the following code and i want to change with width of the square when i resize the window but if the height is resized i dont want the height of it to change. #include <GLUT/glut.h> #include <stdio.h> #include <stdlib.h> /* globals */ GLsizei wh = 500, ww = 500; /* initial window size */ GLfloat size = 3.0; /* half side length of

VS2015+OpenGL 配置

一个人想着一个人 提交于 2019-12-04 05:32:21
参考资料: 百度经验 看完上面文章,再去看官方文档,发现他们都是翻译或抄别人的翻译而已,想看原汁原味的官方文档可以点这里: 点我点我 。 资源官网看这里: 点我点我 首先要明确的是,openGL是一个标准,windows和linux都支持它,然后它不需要安装就可以用了,需要的只是电脑的驱动配置而已(我都没去动过这些,不过可以,目测现代一般的都可以,如果不行的话,再回来检查),配置的驱动看这里: 点我点我 。 第二,glut库很便于openGL编程,去这里下载: 点我下载glut库 ,解压得到5个文件:glut.h,glut.dll,glut32.dll,glut.lib,glut32.lib。 第三,安装glut库。假设你的vs的安装路径为MY_VS_ROOT,那么在MY_VS_ROOT/VC/include/下新建一个文件夹GL,然后复制glut.h到这个文件夹下,比如我的就是D:\soft\vs2015\VC\include\GL\glut.h。 然后复制glut.lib和glut32.lib到MY_VS_ROOT/VC/lib/下,最后复制glut.dll和glut32.dll到系统的dll目录下:C:\Windows\system32文件夹内(32位系统)或‪C:\Windows\SysWOW64(64位系统)。 第四,写个代码测试一下。在vs工程下新建一个cpp文件