opengl

Multithreaded X11 application and OpenGL

别等时光非礼了梦想. 提交于 2020-07-15 03:15:41
问题 I'm trying to create a multithreaded opengl application with libx11 - with one separate thread per window, and one manager thread. I have an event loop in the manager thread: while(true) while(XQLength(mPlatformData->display)){ XNextEvent(mPlatformData->display, &event); std::cout << "event" << std::endl; } } This is a great event loop for single threaded applications, but with this multithreaded setup strange things happen. When I'm creating a window, I need to disable the event queue, or

OpenGL 4.2 LookAt matrix only works with -z value for eye position

妖精的绣舞 提交于 2020-07-13 15:41:12
问题 I am trying to understand and apply modern OpenGL matrix transformations. I already read a lot of different sources but I am not sure what I am actually doing wrong. The issue I have is also commented in the code: If I set the eye coordinates of the Matrix4.LookAt to a z value that is greater or equal 0 or lower -2 the triangle is not visible anymore. Can someone explain why? As far as I understood the method the triangle should just be visible just from the other side (explicitly disabling

OpenGL 4.2 LookAt matrix only works with -z value for eye position

痞子三分冷 提交于 2020-07-13 15:40:26
问题 I am trying to understand and apply modern OpenGL matrix transformations. I already read a lot of different sources but I am not sure what I am actually doing wrong. The issue I have is also commented in the code: If I set the eye coordinates of the Matrix4.LookAt to a z value that is greater or equal 0 or lower -2 the triangle is not visible anymore. Can someone explain why? As far as I understood the method the triangle should just be visible just from the other side (explicitly disabling

OpenGL directional light shader

北战南征 提交于 2020-07-08 13:33:11
问题 I want to add directional light to my scene using OpenGL and GLSL. The problem is that the theoretically correct way to do so has the wrong results. In the vertex shader I do the following: The direction of the light is given in world-coordinates and transformed using the viewMatrix to camera-coordinates. The normal of the vertex is transformed using the normal-matrix to camera-coordinates. void main () { vary_textureCoord = attribute_textureCoord; vary_normal = mat3(normalMatrix) * attribute

OpenGL directional light shader

坚强是说给别人听的谎言 提交于 2020-07-08 13:32:39
问题 I want to add directional light to my scene using OpenGL and GLSL. The problem is that the theoretically correct way to do so has the wrong results. In the vertex shader I do the following: The direction of the light is given in world-coordinates and transformed using the viewMatrix to camera-coordinates. The normal of the vertex is transformed using the normal-matrix to camera-coordinates. void main () { vary_textureCoord = attribute_textureCoord; vary_normal = mat3(normalMatrix) * attribute

OpenGL directional light shader

ぃ、小莉子 提交于 2020-07-08 13:32:35
问题 I want to add directional light to my scene using OpenGL and GLSL. The problem is that the theoretically correct way to do so has the wrong results. In the vertex shader I do the following: The direction of the light is given in world-coordinates and transformed using the viewMatrix to camera-coordinates. The normal of the vertex is transformed using the normal-matrix to camera-coordinates. void main () { vary_textureCoord = attribute_textureCoord; vary_normal = mat3(normalMatrix) * attribute

How do I render a 4D object in openGL utilizing homogenous transforms?

穿精又带淫゛_ 提交于 2020-06-29 06:42:20
问题 I want to try and make a game that utilises movement through 4D cross sections. I have looked repeatedly, but cannot find any answers that present complete and clear code - the closest i found was [how should i handle (morphing) 4D objects in opengl? which contains what I need, however, upon trying to utilise the code, not all of the architecture was described clearly, such as the file containing the 5x5 matrix. 回答1: 4D Reper I did not post it before as it would not fit into 30KByte limit

How to get I the correct texture using indexing in opengl

倖福魔咒の 提交于 2020-06-29 05:03:14
问题 I want to impement a pyramid which has different texture in each side. The pyramid with the textures is correct without using an index data array. When i use the indexdata the textures get mixed with each other. Do i have to correct the AttribPointer? (My texture is a collage image of 5 different images) *I want to keep the indexData array Here is a part of the code from OpenGL.GLUT import * from OpenGL.GLU import * from OpenGL.GL import * import numpy as np from framework import * from PIL

I am getting wrong values when calling glReadPixels

断了今生、忘了曾经 提交于 2020-06-29 04:45:34
问题 In my program I am trying to select an object on right mouse click event using glReadPixels method. Window for rendering is created using wxWidgets (by extending wxFrame and wxGLCanvas). However, I am getting wrong values. He is tutorial that I used I was suggested to use this approach as it seems faster and easier than ray casting. My code: #include "MyGLCanvas.h" #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> BEGIN_EVENT_TABLE(MyGLCanvas,

How to use samplerCube as array

亡梦爱人 提交于 2020-06-29 04:45:23
问题 I am using samplerCube for a point light shadow map. For multiple lights, I implemented samplerCube as an array in the following. uniform samplerCube pointShadowMapTexture[MAX_LIGHT]; But somehow I can't index this samplerCube . Shader compiles and there is no problem. This is working for sampler2D arrays. I tried indexing it with [0], [1] .. in the shader but always the same image. I am sending different cube textures for each light but somehow shader doesn't index it or doesn't accept it. I