Skip to main content

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
6 votes
3 answers
3k views

How to pass rendered frames from OpenGL to DirectX 11?

I have a dll that does some rendering using OpenGL. I need to render it to a texture and use that texture in direct x 11. My current attempt has been to render the OpenGL to a texture on one process,...
1 vote
2 answers
1k views

when to unbind vao in drawing loops

I am very new to open gl and am struggling to understand relation between vaos vbos and ibos like how is currently bound vao related to currently bound ibo? now i am trying to render 4 triangles with ...
1 vote
1 answer
766 views

Rendering to framebuffer / multiple rendering in a frame makes geometry black

I'm trying to adapt the shadow-mapping process given on this microbasic guide into my game, it's made with LibGDX. I've run into a blocking point with the creation of the shadow buffer via rendering ...
1 vote
0 answers
62 views

Garbled text and music - due to Steam Linux runtime change?

My team and I released our game on Steam last year for Windows, Mac, and Linux. The game is written in C++ and uses SDL2, including SDL2_image, SDL2_ttf, and OpenGL for graphics. Around the middle of ...
-1 votes
1 answer
323 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 ...
0 votes
1 answer
117 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 <...
0 votes
1 answer
104 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
325 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
170 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 ...
1 vote
3 answers
369 views

Where did I lose vertex binding?

I make OpenGL render framework for my bachelor graduate work. I created simple Model and Shader classes. But when I tried to render some vertices, they do not render. I saw with an OpenGL profiler, ...
0 votes
0 answers
100 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 ...
1 vote
1 answer
974 views

What should the Z coordinate be after transformed by the projection matrix?

I'm working on an OpenGL 1.x implementation for the Sega Dreamcast. Because the Dreamcast didn't have any hardware T&L the entire vertex transformation pipeline has to be done in software. What ...
2 votes
1 answer
587 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 ...
0 votes
1 answer
361 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 ...
1 vote
2 answers
1k views

Frame Buffer Object (FBO) is not working. What is the right way to use?

I am trying to use FBO but i am living some problems. I will show you my steps but first i will show my running screen ,so we can compare them. Like before fbo after fbo. My running screen and Draw() ...
0 votes
1 answer
90 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
1 answer
302 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 ...
1 vote
1 answer
205 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 ...
0 votes
0 answers
45 views

How to calculate angles after subsequent rotations?

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

convert world to screen coordinates with camera position and camera angle

Heyho :) I'm trying to convert world coordinates to screen coordinates. I have available: fov, screen width, screen height, camera position, camera angle and obviously the position of the object in ...
4 votes
2 answers
6k views

How do I convert from Cartesian to spherical coordinates?

This seems like a fairly basic and common problem. Is there a builtin way to achieve it or do I have to write the algorithm on my own? If I do, how should it work?
0 votes
0 answers
59 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 ...
1 vote
1 answer
1k views

How can I render a font in C with OpenGL? [closed]

What I tried: I was testing some things in order to render text with stb_truetype.h and OpenGL in C. I took as a reference the example that appears here. Basically, this example, loads a .ttf file and ...
1 vote
1 answer
728 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 ...
0 votes
0 answers
154 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
292 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
1 answer
1k views

Building an LWJGL jar file - java.lang.NoClassDefFoundError

EDIT: Recently got it working by making a batch file that does this: set /p CP=<cp.txt java -cp %CP%;testing.jar me.pale.main.Main and cp.txt is this ...
5 votes
1 answer
1k views

How to make Volume Heat Distortion effect in OpenGL?

I'm working on adding volume effects to an existent, open-source game engine. At the moment, the engine only supports two dimensional "thruster" bitmaps with a planar heat distortion drawn over the ...
1 vote
3 answers
5k views

What's the difference between Raytracing and Physically-based-rendering?

I know raytracing is a technique based on the route calculation done by the light, following the rays through the interaction with the surfaces, and that Pbr is a collection of render techniques that ...
0 votes
2 answers
459 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 ...
0 votes
1 answer
103 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
223 views

Can we flip znear and zfar so that positive z values increase away from the viewer?

I am confused about the projection matrix in OpenGL. i have a habit of writing the code as follows. ...
0 votes
1 answer
165 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
273 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 ...
2 votes
1 answer
199 views

How to get rid of intersections between terrain and road strip drawn on top?

When I draw a road as is (stencil:off, depth:on,less), the results are like this - ; Then I tried adding stencil a test for the road: ...
4 votes
2 answers
290 views

Fine tuning light shader mechanics

I'm currently trying to implement the lighting technique described in this article. I've done pretty much exactly what is done in the article. My technique is the same, and my shader is the same. ...
0 votes
1 answer
75 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 ...
0 votes
1 answer
318 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 ...
1 vote
2 answers
181 views

Parts of 3D model disappear during animation

I'm trying to properly play an animation done in Blender 2.8 inside my OpenGL application. When the animation is running, it happens that at some particular frames, some parts of the 3D model "...
1 vote
1 answer
270 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 ...
3 votes
2 answers
1k views

WinAPI window taking 50% of CPU when idle

I'm currently working on a game that creates a window using WindowsAPI. However, at the moment the process is taking up 50% of my CPU. All I am doing is creating the window and looping using the ...
0 votes
0 answers
87 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
1 answer
238 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
270 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 ...
1 vote
1 answer
820 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: ...
28 votes
2 answers
46k views

How many textures can I usually bind at once?

I'm developing a game engine, and it's only going to work on modern (Shader model 4+) hardware. I figure that, by the time I'm done with it, that won't be such an unreasonable requirement. My ...
0 votes
1 answer
275 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 ...
0 votes
0 answers
490 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
1 answer
142 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: ...
-1 votes
1 answer
275 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 ...

1
3 4
5
6 7
87