Questions tagged [opengl]

OpenGL (Open Graphics Library) is a graphics standard and API which is platform independent and available for desktop, workstation and mobile devices. It is designed to provide hardware-accelerated rendering, and hence gives greatly improved performance over traditional software rendering. OpenGL is used for applications like CAD software and computer games. The OpenGL standard, as well as OpenGL ES, is controlled by the Khronos group.

0
votes
0answers
25 views

How to draw simple rectangle with screen co-ordinates(pixel positions)as input with OpenGL Version > 3.0

I'm trying to implement a simple API to draw a rectangle on the screen by taking min and max point of the rectangle as input (in screen coordinates) with OpenGL Version 3.3. e.g. void Rect(xmin, ymin,...
-2
votes
0answers
14 views

Fix freeze when debugging tween?

The debug froze when I run this program: #include<Project5\glut.h> #define RATIO 1.200 #define WW 100 #define WH (WW/RATIO) #define HALFX ((int)(WW/2)) #define HALFY ((int)(WH/2)) #define ...
-1
votes
0answers
45 views

Segmentation fault in destructor when using a defined variable [duplicate]

I know there's so many questions like this but none seem to have an explanation as to what's going on. I made a simple ShaderProgram class with the following: unsigned int programId = 0; ...
-1
votes
0answers
22 views

Rendering text from self made bitmap in OpenGL C++

I made a Font class in OpenGL that does make bitmap with all faces, but I can't render text with renderText() function. I modified font class from learnOpenGL.com so that I use only one texture for ...
-1
votes
0answers
16 views

How to fix “glUseProgram” crash while using Intel graphic card?

I am writing regarding an issue with GLSL shaders. The problem is with the sequence of running the shaders. In other words, it is important which one is being run first. In the scenario which the ...
0
votes
0answers
21 views

How to use OpenGL on top of SSH?

I am trying to use PyBullet on a remote computer. The remote computer has an NVIDIA RTX 2070 GPU card with 410 drivers. xlogo works fine. A quick test gives me the error: >>> import ...
1
vote
1answer
40 views

Depth-fighting solution using custom depth testing

The core of my problem is that I have troubles with depth-fighting in pure OpenGL. I have two identical geometries, but one is simpler than the other. That forms a set of perfectly coplanar polygons,...
1
vote
1answer
21 views

How to rotate a certain object (Quad) in PyOpenGL?

I am making a game in PyOpenGL where an object (e.g. cuboid) should face the camera. To do that, I have to rotate the specific object. How can I do that? glRotatef() rotates the whole world, but not ...
0
votes
0answers
19 views

Duplicate location error when using explicit location for struct uniform

This is a part of my VS: #version 450 #extension GL_ARB_explicit_uniform_location : enable #extension GL_ARB_separate_shader_objects : enable #extension GL_ARB_gpu_shader5 : enable //Imports #...
1
vote
1answer
14 views

How to cut/hide projected area from bottom and top of GLControl - openTK

With the help of this link, I can project an image in cylindrical shape. Can I able to remove or hide the projected area from top and bottom of image as shown in the image below?
1
vote
1answer
19 views

How can I make a sphere in python using pyopengl and pygame?

I don't know how to make sphere in Python using OpenGl and pygame. Somebody can help me?
2
votes
1answer
24 views

How to get current camera position in PyOpenGL?

I am making a game in OpenGL which some objects goes toward you. To do that, I have to get the current camera location. I know that in OpenGL the camera always stay at (0,0,0) position, but I want to ...
1
vote
0answers
63 views

Red video on top of normal video in Qt/OpenGL using QQuickItem [on hold]

ps: I know that normally a minimal verifiable example is recommended but in this case there's just too much work into getting an image from a camera to display here that it's impossible to reduce the ...
1
vote
1answer
24 views

Trying to Create 3x3x3 Cube but created 4x4x4 instead in OpenGL

I am trying to create a 3d rubiks cube, however the dimensions are not aligning with the dimensions set. When I set the dimensions to 3 and create a 3x3x3 cube, I end up creating a 4x4x4 cube. However,...
2
votes
1answer
36 views

How to use stencil buffer to achieve hierarchical clipping

What I'm trying to achieve is illustrated on the image below: Let's say we have stencil buffer in a state so only red section is filled at the moment. What actions do I need to perform when I update ...
2
votes
1answer
32 views

glm::rotate leads to bulging of texture

I'm implementing a small image viewer that is capable of rotating an image and zooming in/out. I'm doing that purposely by using OpenGL and GLM for self studies. Everything works out just fine so far, ...
-1
votes
0answers
18 views

How to generate chunk mesh in voxel engine

I'm creating 3D voxel engine and I'm wondering about generating chunk mesh which will contain all blocks in chunk. This will be important in fast rendering all blocks in chunk. Here's my chunk class: ...
-2
votes
1answer
59 views

How can I fix “CL.exe” exited with code 2

I have been following learnopengl.com and I was on the Transformations part of the website and it keeps saying CL.exe" exited with code 2 This is making impossible to test anything because it will ...
0
votes
1answer
30 views

Is there any way to use complex/derived classes in GLSL?

In my OpenGL projects I've never used custom structs in my GLSL shaders. Until now I was perfectly fine with arrays of mat4,vec4,int. In my latest project, I'm considering adding support for a ...
2
votes
1answer
31 views

Opengl Translation on Model Matrix malforms result

I am trying to build a model matrix where I apply some common transformations like scaling, rotation and translation. I was following a tutorial here: https://solarianprogrammer.com/2013/05/22/opengl-...
-1
votes
0answers
22 views

Try to find gui for pygame+opengl in 3d model

I want to find gui for pygame and opengl. I have completed using obj+mtl to create a 3d model in pygame window and use opengl,and I have already tried most of all pygame gui toolkit(pgu.sgc.Albow,etc....
-1
votes
0answers
20 views

How to add, process and render multiple textures

I need help with the code correction to the exercise. I don’t understand how to implement the processTexture() function and I’m in doubt whether the setTexParams() and bind() functions are ...
0
votes
0answers
21 views

Apply vertical shift in openTK shader code

Using below shader code I can show a texture in my glControl. Can I able to shift it vertically with user selected value? For ex: If user selects 0.8 , I want to shift it 0.8 vertically from bottom ...
1
vote
1answer
26 views

Does blending works with the mix function of shader

These are my blending functions. glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendEquation(GL_FUNC_ADD); I mix two textures in the fragment shader using mix function. ...
0
votes
1answer
32 views

How to check distance between two objects in PyOpenGL?

I am making a RPG in PyOpenGL and I want to check if the camera is pointing at the object (made by vertices) in a certain distance. How can I do that? I have tried to use range() on the vertices of ...
3
votes
1answer
44 views

GL_LINES not showing up on top of cube?

I am trying to create a 3d Rubiks Cube with OpenGL and Pygame. However I when I try to draw lines on top of the GL_QUADS surfaces I have created, they don't show up. I have tried putting the ...
0
votes
1answer
72 views

glPushMatrix() glPopMatrix() doesn't work

I try to code two object move independent which mean both are moving two different direction it's worked but it can't move continuous. when i put glTranslatef() at outside the glPushMatrix() ... ...
1
vote
1answer
44 views

Why does using a program cause my shape to disappear?

The following code draws a white square to the screen. If I uncomment the line that uses the program, the square disappears. When I debug the program with GLIntercept, the texture appears in a folder ...
0
votes
1answer
22 views

assimp import failing on Xcode

What I'm trying to do ... to import assimp, specifically: #include <assimp/Importer.hpp> #include <assimp/scene.h> #include <assimp/postprocess.h> and some other assimp headers. ...
-1
votes
1answer
36 views

C++ OpenGL Font Class with one Big Bitmap [on hold]

I'm having a problem with rendering bitmap that I create in my Font class. I was learning OpenGL from LearnOpenGL, and I thought about putting all those font faces into one big texture, but it looks ...
1
vote
0answers
28 views

Do I have to include SDL_opengl.h after GL/glew.h?

I would like to create an OpenGL project with SDL2. I usually start my OpenGL projects by including GL/glew.h first. Do I have to include SDL_opengl.h afterwards? It also contains the OpenGL API ...
1
vote
1answer
40 views

Wireframe cube rendering blank in OpenGL

I'm creating a voxel game and want to highlight the block that the camera is pointing at with a wireframe model. However, I can't for the life of me figure out why this isn't showing up. I've set the ...
-2
votes
0answers
36 views

Cannot using Multil View in MFC MDI OpenGL [on hold]

I created a MFC MDI project. Then, I setup Opengl into this project. But I have a problem when switch view in application. Example: I create two documents for my application. I can only focus, ...
1
vote
1answer
23 views

Texture function in fragment shader giving error

This is my fragment shader and when ever i try to use the Cubemap in the texture function i get a error saying: 0.54 No matching function found( using implicit conversion) 0.54 texture ...
2
votes
2answers
46 views

Drawing a square on a rectangular window in opengl

I am drawing a 3d cube in LWJGL 3.It renders fine with the window size being 600 * 480.It renders a perfect cube. But if i increase the window's width to 900 while the height remains the same. The ...
2
votes
1answer
68 views

How create a camera on PyOpenGL that can do “perspective rotations” on mouse movements?

I am creating a first-person view RPG and I want to rotate the camera in PyOpenGL when I move the mouse (just like some other games like Minecraft). What function can I use to do this and how? I ...
0
votes
0answers
46 views

Is it better to glClear() before drawing to a buffer or after?

I currently have code that does the following: sleep until next frame glClear(GL_COLOR_BUFFER_BIT | GL_DPETH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); perform all drawing for the frame flush and display ...
-1
votes
0answers
61 views

My display function takes longer than it should

My program loads an gif and stores its frames in an array using devIL, it then uses the array to display the image on a texture. I would like to use 60fps animations (which i have already made) but ...
1
vote
1answer
34 views

How do I input color values in sRGB space?

I am learning about the sRGB color space in OpenGL. One thing is colors from textures, but other - direct color values, let's say from graphics editor. A color component of 0.5 means that the output ...
1
vote
1answer
43 views

OpenGl Result difference In Xcode and visual studio

I wrote a simple OpenGL code, and it worked normally in visual Studio. But when it was moved to Xcode. it was a compilation success, but the results were different. There are nothing. I only changed ...
0
votes
0answers
21 views

How does Tessellation of an array of vertices and colors work in OpenGL? [duplicate]

I'm trying to tesslate an array of vertices in OGL using GLFW and GLEW, optionally GLM. I have the problem that I can't seem to find a tutorial for passing an array of vertex colors and positions to a ...
1
vote
1answer
46 views

Textured Triangle Loads as Solid Color

I'm trying to render a textured triangle. I'm using STB image to load a png. The triangle is displayed as a single color for a host of different images that I've tried. The color seems to be an ...
-3
votes
1answer
56 views

This shader make models invisible

I'm making a .vert shader file and when I use it, it doesn't show and instead make it invisible. This is a weird thing and I'm not a good shader creator. It seems the .vert doesn't apply textures and ...
0
votes
0answers
38 views

How do I transfer an array of vertices and corresponding colors to a basic GLSL shader with tessellation? [on hold]

I'm trying to tesslate an array of vertices in OGL using GLFW and GLEW, optionally GLM. using glDrawIndexBuffers with GL_PATCHES enabled. I have the problem that I can't seem to find a tutorial for ...
2
votes
1answer
30 views

“incorrect preprocessor directive” in fragment shader?

I'm making 2 shaders (a .frag file) and i get a error message saying "ERROR: 0:83: '' : syntax error: incorrect preprocessor directive". and when i press ok it doesn't show and make models not appear ...
-1
votes
0answers
25 views

GLSL branching performance penalties? [duplicate]

As I understand: Because of thread warping architectures in modern GPUs, it is generally considered a bad habit to create too many if-statements in shader programs. I have, though, some general ...
1
vote
1answer
28 views

How does the indexing of the box in this gltf file work?

So from my understanding if I want to render a box using indexed triangles, I would need 8 vertices (for the 8 corner points) and 36 indices (the box has 6 sides, with 2 triangles per side and 3 ...
1
vote
1answer
68 views

What is the value of z-coordinate in opengl [on hold]

I have just started learning modern opengl using lwjgl 3. I am confused with the coordinate system of opengl. I know that when you specify the width and height of the window the coordinates are ...
1
vote
1answer
42 views

OpenGL Texture Coordinates Have No Effect

I cannot get texture coordinates to have any effect on what is rendered on screen. My texture constantly seemed to rendering from 0,0 to 1,1. The method I am using is to send the following buffer ...
1
vote
1answer
67 views

FFmpeg C++ decoding in a separate thread

I'm trying to decode a video with FFmpeg and convert it to an openGL texture and display it inside a cocos2dx engine. I've managed to do that and it displays the video as i wanted to, now the problem ...