glut

Cleaning up when exiting an OpenGL app

我怕爱的太早我们不能终老 提交于 2019-11-30 03:30:59
问题 I have an an OSX OpenGL app I'm trying to modify. When I create the app a whole bunch of initialisation functions are called -- including methods where I can specify my own mouse and keyboard handlers etc. For example: glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); glutInitWindowPosition(100, 100); glutInitWindowSize(700, 700); glutCreateWindow("Map Abstraction"); glutReshapeFunc(resizeWindow); glutDisplayFunc(renderScene); glutIdleFunc(renderScene);

g++ linker: /usr/lib/libGL.so.1: could not read symbols: Invalid operation

被刻印的时光 ゝ 提交于 2019-11-30 03:23:00
问题 I'm trying to build a very simple OpenGL-app under Ubuntu 10.04 (I have a 32 bit system). When I'm trying to compile the file, I get the error message: g++ -L/usr/lib simple.cpp -lglut /usr/bin/ld: /tmp/ccoPczAo.o: undefined reference to symbol 'glEnd' /usr/bin/ld: note: 'glEnd' is defined in DSO //usr/lib/libGL.so.1 so try adding it to the linker command line //usr/lib/libGL.so.1: could not read symbols: Invalid operation collect2: ld returned 1 exit status Does anybody know what I'm doing

Drawing many spheres in OpenGL

僤鯓⒐⒋嵵緔 提交于 2019-11-30 00:57:24
I want to draw many spheres (~100k) using OpenGL. So far, I'm doing something like for (int i=0; i<pnum; i++){ glPushMatrix(); glTranslatef(bpos[i].x, bpos[i].y, bpos[i].z); glCallList(DListSPHERE); glPopMatrix(); } Before using proper spheres, I used GL_POINTS . That allowed me to call glDrawArrays with an array containing all points which was very efficient. Is there a better way than the above code to draw many, identical objects? Gregory Pakosz Have a look at this page on instancing : it contains many references: Some test made that shows when to use instancing and when not: http://www

How to convert mouse coordinate on screen to 3D coordinate

六月ゝ 毕业季﹏ 提交于 2019-11-30 00:02:12
问题 I'm creating a 3D application using GLUT in C++. Now, I want to implement a method similar to this: Vector3* MyClass::get3DObjectfromMouse(int mouseX, int mouseY); How can I implement this method? 回答1: As it was commented by Andon M. Coleman, one way you can achieve this is by doing a ray/object intersection test, with unprojected screen coordinates. This technique is commonly known as picking . A pseudo-C++ code for picking: Assume we have a 3D object type/class: class Object3D { ... }; A 3D

Understanding the relationship between glutDisplayFunc and glutPostRedisplay

跟風遠走 提交于 2019-11-29 18:09:06
问题 When reading the redbook I found: glutDisplayFunc(void (*func)(void)) is the first and most important event callback function you will see. Whenever GLUT determines that the contents of the window need to be redisplayed, the callback function registered by glutDisplayFunc() is executed. Therefore, you should put all the routines you need to redraw the scene in the display callback function. If your program changes the contents of the window, sometimes you will have to call glutPostRedisplay()

Simple OpenGL GUI Framework User Interaction Advice? [closed]

吃可爱长大的小学妹 提交于 2019-11-29 16:17:02
I'm designing a simple GUI framework from scratch as a project, using OpenGL and nothing else external and need some advice on how I might implement user interaction. Basically, I've a base class GUIItem from which all elements inherit. This gives each item some basic variables such as position, a vector to contain child elements as well as some basic functions for mouse movement and clicking. All elements are setup as above, with their relevant member variables. What I'm struggling with is how to implement user interaction properly. In my window manager I would create a new instance of an

how to read, parse the SBM file format from Superbible Opengl

泄露秘密 提交于 2019-11-29 15:15:00
Calling on experts, gurus, and anybody to help read and parse a file in python. On page 751 of 6th ed. or page 800 of 7th ed. of Superbible OpenGL there is Appendix B. The SBM File Format that seems to explain well the format to some extent. I have tried to implement in python a reader of this file format. OK, progress has been made. I have merged Rabbid76 amazing code to the source provided. Though I am attempting to make additional headway. Update Jun 23, 2019 - major progress, fixed the error about glVertexAttribPointer(i, ... error. Same day, fixed the Python cannot find the variable first

Attempt to call an undefined function glutInit

自闭症网瘾萝莉.ら 提交于 2019-11-29 11:29:32
I need a glut window in python. I have the following exception using Python 3.5 and PyOpenGL.GLUT Traceback (most recent call last): File "D:\...\Test.py", line 47, in <module> if __name__ == '__main__': main() File "D:\...\Test.py", line 9, in main glutInit(sys.argv) File "C:\...\OpenGL\GLUT\special.py", line 333, in glutInit _base_glutInit( ctypes.byref(count), holder ) File "C:\...\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

How to pass a class method as an argument for another function in C++ and openGL?

為{幸葍}努か 提交于 2019-11-29 09:33:51
I know this thing works: void myDisplay() { ... } int main() { ... glutDisplayFunc(myDisplay) ... } so I tried to include myDisplay() function to a class that I made. Because I want to overload it in the future with a different class. However, the compiler complains that argument of type 'void (ClassBlah::)()' does not match 'void(*)()' . Here is the what I try to make: class ClassBlah { .... void myDisplay() .... } ...... int main() { ... ClassBlah blah glutDisplayFunc(blah.myDisplay) ... } Does anybody knows how to fix this problem? Many thanks. Firstly, there is an implicit "this" pointer

How to get ready a C++ project with OpenGL, Glut and Visual Studio 2008 in Windows 7

坚强是说给别人听的谎言 提交于 2019-11-29 00:30:12
As I had many problems setting Visual Studio 2008 for using OpenGL I will ask this question that can be useful to some people: Which are the steps to follow in order to use OpenGL with C++ in Visual Studio 2008? Jav_Rock First of all you need to have a video card and check that it works with OpenGL and the drivers are updated. I used the test in this link to check it. It is also important to check that Visual Studio 2008 is correctly installed and that the following path is created in your computer: C:\Program Files\Microsoft SDKs\Windows\v6.0A Now we can follow the installation steps: 1.-