true isometric projection with opengl

Try using gluLookAt glClearColor(0.0, 0.0, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); /* use this length so that camera is 1 unit away from origin */ double dist = sqrt(1 / 3.0); gluLookAt(dist, dist, dist, /* position of camera */ 0.0, 0.0, 0.0, /* where camera is pointing at */ 0.0, 1.0, 0.0); /* which direction is … Read more

Convert Quaternion rotation to rotation matrix?

The following code is based on a quaternion (qw, qx, qy, qz), where the order is based on the Boost quaternions: boost::math::quaternion<float> quaternion; float qw = quaternion.R_component_1(); float qx = quaternion.R_component_2(); float qy = quaternion.R_component_3(); float qz = quaternion.R_component_4(); First you have to normalize the quaternion: const float n = 1.0f/sqrt(qx*qx+qy*qy+qz*qz+qw*qw); qx *= n; qy … Read more

OpenGL without X.org in linux

Update (Sep. 17, 2017): NVIDIA recently published an article detailing how to use OpenGL on headless systems, which is a very similar use case as the question describes. In summary: Link to libOpenGL.so and libEGL.so instead of libGL.so. (Your linker options should therefore be -lOpenGL -lEGL Call eglGetDisplay, then eglInitialize to initialize EGL. Call eglChooseConfig … Read more

how to enable vertical sync in opengl?

On Windows there is OpenGL extension method wglSwapIntervalEXT. From the post by b2b3 http://www.gamedev.net/community/forums/topic.asp?topic_id=360862: If you are working on Windows you have to use extensions to use wglSwapIntervalExt function. It is defined in wglext.h. You will also want to download glext.h file. In wglext file all entry points for Windows specific extensions are declared. All … Read more

glVertexAttribPointer clarification

Some of the terminology is a bit off: A Vertex Array is just an array (typically a float[]) that contains vertex data. It doesn’t need to be bound to anything. Not to be confused with a Vertex Array Object or VAO, which I will go over later A Buffer Object, commonly referred to as a … Read more

matplotlib: render into buffer / access pixel data

Sure, just use fig.canvas.tostring_rgb() to dump the rgb buffer to a string. Similarly, there’s fig.canvas.tostring_argb() if you need the alpha channel, as well. If you want to dump the buffer to a file, there’s fig.canvas.print_rgb and fig.canvas.print_rgba (or equivalently, print_raw, which is rgba). You’ll need to draw the figure before dumping the buffer with tostring*. … Read more