GLSL, Array of textures of differing size

When doing multitexturing in GLSL, is there anyway to have an indexable array of samplers where each texture is a different size? This syntax isn’t valid: uniform sampler2D texArray[5]; Right now it seems like the only option is to individually create the samplers: uniform sampler2D tex1; uniform sampler2D tex2; uniform sampler2D tex3; uniform sampler2D tex4; … Read more

Quaternion to Matrix using glm

I am trying to convert quat in glm to mat4. My code is : #include <iostream> #include<glm/glm.hpp> #include<glm/gtc/quaternion.hpp> #include<glm/common.hpp> using namespace std; int main() { glm::mat4 MyMatrix=glm::mat4(); glm::quat myQuat; myQuat=glm::quat(0.707107,0.707107,0.00,0.000); glm::mat4 RotationMatrix = quaternion::toMat4(myQuat); for(int i=0;i<4;++i) { for(int j=0;j<4;++j) { cout<<RotationMatrix[i][j]<<” “; } cout<<“\n”; } return 0; } When i run the program it shows … Read more

Glad failing to initialize

I’m having a problem where the following lines of code always print “Failed to initialize glad” and then exits the program: if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { std::cout << “Failed to initialize GLAD” << std::endl; return -1; } I have been using https://learnopengl.com/ as a guide and have been following the steps in the getting started section. I … Read more

Exporting Eclipse project causes incorrect texturing and crashes,

This issue is now fixed. My shader attributes were not bound correctly. I have got a game, which when ran from the IDE looks like this: However, when I export it from Eclipse with these settings, The texturing is completely incorrect. The textures are still loaded, but they are not wrapping correctly onto the object. … Read more

How to get OpenGL man pages on Ubuntu as in “man glRotate”?

When on MacOSX, “man glRotate” brings up the glRotate manpage. On ubuntu, with manpages-dev and manpages-posix-dev insatlled, “man glRotate” doesn’t bring up the glRotate manpage (though I can build and compile gl apps). What am I missing? How do I setup this up? Answer sudo apt-get install opengl-4-man-doc opencl-1.2-man-doc contains many man pages, e.g.: man … Read more

Should I delete `Vertex Buffer Object` after binding it to `Vertex Array Objects`?

I created a VBO (Vertex Buffer Object) and VAO (Vertex Array Objects) and did this: glBindVertexArray(vao); glBindBuffer(GL_ARRAY_BUFFER, vbo); glBufferData(…); glVertexAttribPointer(…); glEnableVertexAttribArray(0); glBindVertexArray(0); Can I delete the vbo after I did this and then draw with the vao assuming everything is in order? I know that the buffers bind to the vao so I am assuming … Read more