opengl

Draw rectangle over texture OpenGL

杀马特。学长 韩版系。学妹 提交于 2021-02-09 05:33:19
问题 I'm using python 3 with pygame and OpenGL to try to accomplish what I thought it would be a simple task: Drawing a rectangle. The idea is to have a white rectangle over (or bellow) a transparent texture, but whenever I add the texture to the screen the rectangle vanishes, whether I render it before or after the texture. Bellow is a sample code displaying the problem (you can add any Player1.png image of your choice, the problem will remain the same - at least in my computer) import pygame

Draw rectangle over texture OpenGL

ぐ巨炮叔叔 提交于 2021-02-09 05:31:24
问题 I'm using python 3 with pygame and OpenGL to try to accomplish what I thought it would be a simple task: Drawing a rectangle. The idea is to have a white rectangle over (or bellow) a transparent texture, but whenever I add the texture to the screen the rectangle vanishes, whether I render it before or after the texture. Bellow is a sample code displaying the problem (you can add any Player1.png image of your choice, the problem will remain the same - at least in my computer) import pygame

OpenGL overlapping ugly rendering

有些话、适合烂在心里 提交于 2021-02-08 15:18:37
问题 I'm trying to render a scene with OpenGL 2.1 but the borders on overlapping shapes are weird. I tested some OpenGL initialisations but without any change. I reduce my issue to a simple test application with 2 sphere with the same result. I tried several things about Gl_DEPTH_TEST, enable/disable smoothing without success. Here is my result with 2 gluSphere : We can see some sort of aliasing when a line will be enough to separate blue and red faces... I use SharpGL but I think that it's not

OpenGL overlapping ugly rendering

家住魔仙堡 提交于 2021-02-08 15:16:28
问题 I'm trying to render a scene with OpenGL 2.1 but the borders on overlapping shapes are weird. I tested some OpenGL initialisations but without any change. I reduce my issue to a simple test application with 2 sphere with the same result. I tried several things about Gl_DEPTH_TEST, enable/disable smoothing without success. Here is my result with 2 gluSphere : We can see some sort of aliasing when a line will be enough to separate blue and red faces... I use SharpGL but I think that it's not

GCC /usr/bin/ld: cannot find -lGl

风格不统一 提交于 2021-02-08 12:13:47
问题 eI'm trying to compile a c++ openGL program using libGL and freeglut3. Im trying: g++ main.cpp -w -lglut -lGl -o bin/app or g++ main.cpp -w -lglut -lGL -o bin/app Which results in: /usr/bin/ld: cannot find -lGl collect2: error: ld returned 1 exit status Makefile:16: recipe for target 'all' failed make: *** [all] Error 1 I'm on: Ubuntu 16.04 LTS GCC: gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2) libGL.so /usr/lib/x86_64-linux-gnu$ find libGL.so libGL.so I installed: freeglut3 freeglut3

Regular window screen capture using openGL

不问归期 提交于 2021-02-08 10:55:38
问题 I'm trying to my desktop image capture. (All images, including the desktop output to the monitor) It's easy using window API (BitBlt or CImageClass) and it's not the way I want. I want do it using opengl. so I found glReadPixel funtion and window TRANSPARENT. But it just read pixel own Windows application screen.(Save as bmp file and check) Initialize() glfwSetErrorCallback(errorCallback); if (!glfwInit()) { std::cerr << "Error: GLFW " << std::endl; exit(EXIT_FAILURE); } glfwWindowHint(GLFW

Display a image from the Webcam using openCV and openGL

怎甘沉沦 提交于 2021-02-08 10:46:28
问题 I'm capturing a picture from a webcam with openCV. Then the frame should be transformed into an openGL texture and be shown on the screen. I got the following code but the window remains black. I'm very new to openGL and have no more ideas why it doesn't work. int main () { int w = 800,h=600; glfwInit(); //configure glfw glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint

syntax error: unexpected $end at token “<EOF>” GLSL with any shader

不想你离开。 提交于 2021-02-08 09:44:10
问题 I've seen other similar questions, and I now that it's usually due to wrong shader loading code, but I've tried with lots of different ways to load them, and I always get this error. Here is the loading code I'm currently using (for the Vertex shader, i do the same for the fragment shader): GLuint VertexShaderID = glCreateShader(GL_VERTEX_SHADER); std::string VertexShaderCode; std::ifstream VertexShaderStream(vertex_file_path, std::ios::in); if(VertexShaderStream.is_open()){ std::string Line

Texture does not fit in the square - OpenGL

老子叫甜甜 提交于 2021-02-08 08:32:51
问题 I am trying to create a square and put a red circle middle of it. As you can see in the simple vert I map (-1, 1) range to (0,1) range: coord = position.xy*0.5 + vec2(0.5,0.5); If you look at the simple.frag, there is this line: if(abs(length(coord - vec2(0.5,0.5))) < 0.3) Thus I am expecting red circle at the middle of square. However this happens: The center of circle is beyond of (0.5, 0.5). If I change that line to this: if(abs(length(coord - vec2(0.0,0.0))) < 0.3) Output is: The center

Texture does not fit in the square - OpenGL

不羁的心 提交于 2021-02-08 08:32:25
问题 I am trying to create a square and put a red circle middle of it. As you can see in the simple vert I map (-1, 1) range to (0,1) range: coord = position.xy*0.5 + vec2(0.5,0.5); If you look at the simple.frag, there is this line: if(abs(length(coord - vec2(0.5,0.5))) < 0.3) Thus I am expecting red circle at the middle of square. However this happens: The center of circle is beyond of (0.5, 0.5). If I change that line to this: if(abs(length(coord - vec2(0.0,0.0))) < 0.3) Output is: The center