Compute objects moving with arrows and mouse

Here small ugly but very simple C++ example of what I had in mind for this: //————————————————————————— #include <vcl.h> #include <math.h> #pragma hdrstop #include “Unit1.h” #include “gl_simple.h” //————————————————————————— #pragma package(smart_init) #pragma resource “*.dfm” TForm1 *Form1; //————————————————————————— double mview[16],mmodel[16],mproj[16]; // OpenGL matrices //————————————————————————— // vector/matrix math //————————————————————————— double vector_len(double *a) { return sqrt((a[0]*a[0])+(a[1]*a[1])+(a[2]*a[2])); } // = … Read more

Segmentation fault at glGenVertexArrays( 1, &vao );

glewExperimental = GL_TRUE; glewInit(); Should do the magic Experimental Drivers GLEW obtains information on the supported extensions from the graphics driver. Experimental or pre-release drivers, however, might not report every available extension through the standard mechanism, in which case GLEW will report it unsupported. To circumvent this situation, the glewExperimental global switch can be turned … Read more

VBOs with std::vector

If you have a std::vector<T> v, you may obtain a T* pointing to the start of the contiguous data (which is what OpenGL is after) with the expression &v[0]. In your case, this means passing a Vertex* to glBufferData: glBufferData( GL_ARRAY_BUFFER, vertices.size() * sizeof(Vertex), &vertices[0], GL_STATIC_DRAW ); Or like this, which is the same: glBufferData( … Read more

How to debug a GLSL shader?

You can’t easily communicate back to the CPU from within GLSL. Using glslDevil or other tools is your best bet. A printf would require trying to get back to the CPU from the GPU running the GLSL code. Instead, you can try pushing ahead to the display. Instead of trying to output text, output something … Read more

What is state-of-the-art for text rendering in OpenGL as of version 4.1? [closed]

Rendering outlines, unless you render only a dozen characters total, remains a “no go” due to the number of vertices needed per character to approximate curvature. Though there have been approaches to evaluate bezier curves in the pixel shader instead, these suffer from not being easily antialiased, which is trivial using a distance-map-textured quad, and … Read more

PyOpenGL how do I import an obj file?

Set the keyword argument collect_faces = True, when you read the Wavefront .obj file. That causes that triangle face data are collected for every mesh.: (See PyWavefront) scene = pywavefront.Wavefront(‘Handgun_obj.obj’, collect_faces=True) Compute the scene box. The vertices are contained in scene.vertices. Each vertex is tuple with 3 components (x, y, z coordinate): scene_box = (scene.vertices[0], … Read more

When I run the .jar, I get a “No lwjgl in java.library.path” error

you have to point the jvm to where the native files are located using a command line parameter -Djava.library.path=”path/to/natives”. You could use a batch (.bat) file to specify this and start your application for you. Alternatively you can use a tool like JarSplice to create a single executable jar file from all your jars and … Read more