Questions tagged [opengl]

OpenGL is a graphics standard and API which targets the desktop and workstation markets. It is designed to be easy to accelerate with dedicated computer hardware, and hence most implementations give greatly improved performance over traditional software rendering. Currently, OpenGL is used for applications like CAD software and computer games. It is also cross-platform. The OpenGL standard is controlled by the Khronos group, which also controls OpenGL ES.

Filter by
Sorted by
Tagged with
0 votes
0 answers
51 views

Batch rendering model matrix to shader

I'm working on a batch renderer. I'm limited to using one shader per batch (one draw call for everything). I want to use a TBN matrix for my lighting. To calculate the TBN matrix for each object I ...
  • 101
0 votes
1 answer
46 views

How to implement collision detection using opengl and c++

I am trying to implement collision detection system in opengl and c++ and I have a few qustions about best directions. I will just explain my ideas. So, I have a cube and a sphere as a basic collision ...
0 votes
1 answer
28 views

How to apply shadows on an animated model

I have followed the learnopengl.com tutorial on skeletal animation, but it does not apply shadow on the animated model. Here is the vertex shader that is used to display the character. I suspect that <...
  • 1
0 votes
0 answers
48 views

What is a good way to optimize lighting while keeping it accurate?

I have a lighting shader that currently has two lighting calculation methods. I have a PBR based model and a regular lighting model. I understand that lighting is going to be taxing, but I am getting ...
0 votes
1 answer
85 views

OpenGL 4 tracers

We have implemented a glow map into our renderer. It basically uses a blur filter on the glow map pass. But, I cannot figure out how to do tracers in OpenGL. Someone suggested using a couple of ...
0 votes
1 answer
74 views

OpenGL 4 depth of field

I am implementing depth of field. My fragment shader has the following code in it: ...
0 votes
1 answer
57 views

OpenGL 4 hidden line removal

I'm having trouble with hidden line removal in OpenGL 4. I use a vertex/geometry/fragment shader to draw the lines. I call glDepthRange(0.01, 1.0); before I draw ...
0 votes
0 answers
39 views

Gaussian blur only blurs the interior of primitive?

I cannot work out why my blur shader based on this example affects only what's inside the illuminated sphere. Below is the loop I'm using to blur an HDR framebuffer 5 times horizontally and vertically ...
0 votes
0 answers
30 views

Skeletal Mesh with Assimp and OpenGL

I'm trying to animate a skeletal mesh using opengl and assimp and I'm having trouble understanding what transforms I need to apply for it to work. From what I understand, each vertices have bone ...
0 votes
0 answers
53 views

C++ Problem With Separating Axis Theorem When Using Rotations

I started writing small game that uses some collision detection. I have been able to implement a working SAT collision detection prototype, but I figured out that it stops working properly, when some ...
0 votes
1 answer
82 views

Is it a good idea to detect collisions in 2D game on different thread?

I am writing simple tiled map based game using LWJGL and Kotlin. I am testing out different collision detection algorithms and avoid using out of box solutions for personal reasons. I figured out that ...
  • 103
0 votes
1 answer
34 views

Yaw rotation not translating to Quaternion

I'm trying to implement the gimbal lock fix described in this question, but I end up getting weird behavior where when I rotate on the X axis (or try to at least) it rotates on both the X and Y axis ...
0 votes
0 answers
41 views

How to calculate angles after subsequent rotations?

I have a class that manipulates a model matrix in opengl: ...
0 votes
1 answer
54 views

Efficiently pass one uniform value per polygon or quad to the fragment shader in a single batched draw call in WebGL?

I want to render multiple colored quads, with one solid color per quad, using WebGL 2.0 and Javascript. However, this question is probably generalisable to other OpenGL implementations as well. The ...
  • 243
0 votes
0 answers
48 views

How to allow objects in a list to access the object that owns the list?

I'm trying to make a voxel game while learning about OpenGL. The world is made up of many chunks of voxels. Therefore there is a Chunk class, containing an array of ...
0 votes
1 answer
162 views

How to make a concisely, elegantly, and human-friendly Quaternion camera?

I have spent three weeks struggling with the quaternion camera! Now I have two Implementations. One has some kind of gimbal lock issue or something like that. Another one is totally anti-human ( I ...
2 votes
1 answer
110 views

How can I implement semi-transparent/semi-opaque voxels in a voxel game?

I am creating a voxel game with OpenGL, and I would like to implement water. My voxel world is divided into chunks of 16x256x16 cubes (or voxels). Each chunk has its own VAO with two VBOs, the first ...
  • 31
0 votes
0 answers
42 views

Rotate game object to the mouse pointer

I am making a game from scratch using OpenGl and GLFW. Since my motivation is to learn computer graphics, I am using my own explicit math functions for rotation and translation. My current rotation ...
0 votes
0 answers
81 views

Setting glOrtho and glViewport so top-left of window has coordinates (0,0)

I haven't used OpenGL for a long time and have trouble setting up a 2D screen where the upper left window coordinates are (0,0) and the width and height of the ...
0 votes
0 answers
23 views

Should Uniform Buffer size be set very large to accommodate shaders with different numbers of parameters?

When using uniform buffers should you set the size of the buffer to really large to be able to use different types of shaders with different number of parameters. for example lets say i have a ...
0 votes
0 answers
60 views

FPS Counter not printing out into the console

So I've been trying to make a FPS counter for my custom game engine, but I can't seem to get the game loop to run the FPS counter. I even tried to debug the code, but it keeps saying like "input....
0 votes
1 answer
89 views

Why won't my legs rotate at the top instead of the centre

As the title suggests, I'm battling with getting the legs of my model here to rotate properly. They rotate in the middle instead of at the top where the knee joint would be. So far I've tried ...
0 votes
1 answer
40 views

r/l/b/t parameters in orthographic projection?

I am trying to implement following: What are the l r b t units? I understood that r-l= is just ...
  • 121
0 votes
1 answer
61 views

What would be a good approach to create an abstraction for a game object without textures?

I am practically pretty new to OpenGL development and right now doing some research in Java with LWJGL. But it's really not a question about Java or C++ (GLFW, etc.). It is about OpenGL > 3 api. ...
0 votes
1 answer
56 views

Some objects only rendering half of the screen in snake game

I'm trying to make a basic snake game with OpenGL. I hold all the game object locations in a matrix called MAP. And when i render them, i operate the location info ...
  • 5
0 votes
1 answer
86 views

How to I modify a texture in OpenGL?

I am programming the editor for a RTS game and I have created the following: I am trying to modify the terrain so that it is not completely grassy. I am intending to add functionality so that I can ...
0 votes
0 answers
28 views

match GLTF/assimp/unreal material terms to my shader

I'm trying to render a simple scene I exported from unreal engine. I exported it as gltf, and it appears ok in blender and windows preview. but while loading this model in my code, I have no idea how ...
0 votes
0 answers
74 views

OpenTK mouse picking not working

I am creating a game using OpenGL and need a lobby for which I am developing with WPF, C# and OpenTK. For the lobby I need mouse picking functionality on the 3D objects and although there are many ...
  • 143
0 votes
2 answers
67 views

Handling pipeline objects in both DX12 and Vulkan like graphics APIs

I have been using OpenGL and Directx11 extensively for my engine. The thing is, when I wanted to support DX12 or Vulkan, I realized that they collect all the state data in one place, removing the ...
  • 48
0 votes
1 answer
70 views

Wrong results in Fragment shader when using clamped value

I'm following a tutorial and I want to clamp all position values of a triangle between 0 and 1 then output them as a color this is the code for my vertex shader: ...
0 votes
1 answer
57 views

Is it possible to have shared data between shaders in GLSL that is loaded once?

For my game engine, I would like to be able to load all of the matrices (i.e. mvp, model, etc.) once per frame to save a bit of time, and have a set of uniforms that any shader can access by using ...
  • 1
0 votes
0 answers
117 views

How can I render a texture in a specific x/y position on the screen? (OpenGL - glium)

I am in the process of writing a 2D game in Rust, and decided to use glium for the graphics part. So far I'm doing fine, able to render textures and shapes ...
0 votes
0 answers
162 views

ImGui Rendering Text Atlas instead of Framebuffer color texture

My application looks like this: I am using Dear ImGui for UI and wish to draw the frame buffer contents into a texture and then display that texture in an ImGui Window. I have followed the official ...
1 vote
1 answer
207 views

How is the GLM '*' operator on quaternion and vec3 defined?

Using the definition of quaternion rotation given here: So the equivalent code in GLM of the above formula would be like this: ...
  • 21
1 vote
1 answer
93 views

How do I modify parts of a texture on a quad?

I am programming a Real Time Strategy game, and I was wondering how I could retexture one part of a terrain quad to change a texture in the position where I click at. For example, if I clicked in the ...
-1 votes
1 answer
185 views

How to generate terrains in real time?

I am trying to make a terrain editor for my Empire Earth OpenGL clone engine. Are there any articles of how to generate terrains in real time? It would be cool if it had pseudocode, even cooler if it ...
0 votes
1 answer
110 views

How can I adjust this shader so that my atmospheric scattering works on spheres not positioned at the origin?

I have the following vertex and fragment shaders, adapted from this shader on shadertoy. Vertex: ...
0 votes
2 answers
78 views

LWJGL With Modern OpenGL

I have a question. I am following ThinMatrix's tutorial on YouTube which is about making a 3d game with lwjgl. He uses OpenGL v3.0 and higher. However, my built-in graphic card supports only OpenGL ...
  • 3
0 votes
0 answers
70 views

PhysX Skeletal Animation

I am developing a game and using OpenGL for graphics API and NVidia PhysX for the game's physics. Recently I implemented skeletal animation from this site. The objects are read using assimp which ...
  • 143
0 votes
1 answer
283 views

How to load an FBX animation file in ASSIMP?

I have an example from a LearnOpenGL tutorial which loads the animations. Now, I want to use that to render FBX animation, but the result is totally wrong. What I want is simply to load an FBX ...
0 votes
1 answer
56 views

glDrawArrays draws nothing in C. Trying to draw point in openGL(in C), no error but draws nothing

...
  • 1
0 votes
1 answer
100 views

Function glBindBuffer access violation while executing

So I have a problem, I am calling some opengl frame buffer functions in my code but for some reason I get the error from the title. I am also calling many other opengl functions without any problems ...
0 votes
1 answer
72 views

Why would some assets require a transposed TBN matrix?

I'm writing an OpenGL/DX11 Windows/Linux "engine" and I've encountered a confusing behavior in DX, specifically. For math, I'm using GLM, which means all of my HLSL ...
  • 101
0 votes
1 answer
112 views

What's the difference between Unity3D rendering pipeline and OpenGL rendering pipeline?

I wanted to write small software renderer that will follow almost the same flow as OpenGL does, but got stuck with understanding of the rendering pipeline. After reading tons of info across the ...
1 vote
1 answer
132 views

Screen space reflections bug

I try to implement screen space reflections in my graphics engine using ray marching algorithm. After a lot of trying I got this result: https://youtu.be/yzkgpcliBVQ As you can see, the reflections ...
0 votes
0 answers
63 views

Having GUI on side rather than on game screen

How would I make it so that rather on the game screen the GUI is on the side of the screen and puts the game screen in its own little area so that its not covering part of the screen because right now ...
  • 1
0 votes
0 answers
38 views

How can I get look_at matrix from view_matrix?

I'm trying to set a look_at with the input of a view matrix, is there a way to do it? Because I know you can do the opposite (I think) where you set a look at and ...
0 votes
0 answers
76 views

Per pixel shadows with depth / displacement map

I am looking to draw 2D sprites that cast artificial 3D shadows onto a flat terrain using an additional depth-texture when rendering the sprites. A black/white depth texture is used to add a height-...
  • 21
0 votes
1 answer
314 views

Simulating sprite shadows for a 2D top-down game

I have read some other posts with almost identical titles on here, but they are not exactly what I am looking for. (What I have seen come up a lot in 2D shadows is some sort of "ray-cast effect&...
  • 21
0 votes
0 answers
159 views

Implementing material (mtl) files into objects (obj) in LWJGL/OpenGL

I have an object loader that takes in textures, but when I try making some textures, they never turn out exactly how I want. I found out that a lot of them take a colour I want in one place and put it ...
  • 1

1
2 3 4 5
84