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
1answer
32 views

Generate vertices of a sphere by using spherical coordinates

I'm trying to generate points for a sphere by subdividing the space of spherical coordinate in res sector and res slices. At first I did my own implementation, but it wasn't working. After a while I ...
1
vote
0answers
34 views

What is the best way to bake my own environment maps?

My engine has support for IBL by using pre-obtained HDRIs. It looks fine, but... I want the environment map to match the scene that is currently being rendered I want the environment map to take the ...
0
votes
0answers
58 views

How to update vertices and indices in OpenGL

I want to change and update the vertices and indices of the 3D object. I am new to openGL and I do not know if this the right place to ask this question. I searched and read about that, and I found ...
0
votes
0answers
72 views

How to draw a rectangle at x,y where x & y are in pixel?

Here is my code : ...
0
votes
1answer
25 views

OpenGL GLSL ES 3.10 - Referencing a uniform variable, causes the vertex shader to not draw anything

I have this project, that has a default shader, that just draws models and textures. Recently I decided to add a second shader that does a fancy effect, and is used only on some of the objects drawn. ...
1
vote
1answer
38 views

Problems with porting LWJGL code to C++ (glDrawElements call returns error 1281/GL_INVALID_VALUE)

So, as the title might suggets, I'm currently trying to port a gui stack for my game engine from LWJGL(Java) to C++.I originally had this following code in java: ...
1
vote
2answers
74 views

Why would I want to set a minimal OpenGL version before creating the context?

Typical GLFW applications have these lines after glfwInit(): ...
1
vote
1answer
61 views

OpenGL - Debug version runs faster than Release version

My Visual Studio 2019, 64-bit version of Tetris using OpenGL runs significantly faster, 3X, in Debug mode than in Release mode. The image above shows the board. Each cycle of the rendering or game ...
0
votes
0answers
62 views

How to implement PCSS properly?

I'm trying to implement PCSS in OpenGL/GLSL, but I have problems understanding the details especially the conversions between the coordinate spaces. The existing implementations are so different from ...
1
vote
1answer
51 views

How does glm::lookAt produce a View Matrix?

Say we do this: glm::mat4 View = glm::lookAt(glm::vec3(4,3,-3), glm::vec3(0,0,0),glm::vec3(0,1,0)); And after printing to the console with glm tostring (column ...
0
votes
2answers
30 views

Rotating an object to face the same direction as another object

Feel like I should know this, maybe I'm just over thinking it. What I'm attempting to do is create a bullet hole plane/texture object on top of an existing mesh when a ray cast returns a hit point. I ...
2
votes
1answer
45 views

2D shadow from polar coordinates has hard cut-off at a certain radius

I'm trying to cast shadows from a 1D texture that goes from white to back according to the distance given by an occlusion map. That part I think I got it right. The problem lies on the algorithm to ...
0
votes
1answer
111 views

Understanding how to use Quaternion to rotate object

I m having hard time to understand Quaternions and to use them in my engine for rotating object. I m looking for step by step explanation, actually a correction of my view of Quaternions. Here is how ...
0
votes
0answers
21 views

Rendering overlapping normal map textures to a 2d scene efficiently

I am using modern OpenGL to render a 2D non grid/tiled world map. I've generated some simple normal map textures to render over the base world map to provide terrain elevation/detail shading. ...
0
votes
0answers
8 views

using glew glviewport cannot get the correct proportion of a window

the generated window resolution is (1334, 750) when i call glViewport(0, 0, 1334, 750); the whole window is filled, but when i ...
0
votes
1answer
25 views

set model to transparent where texture is transparent

I finally got around to applying textures to my game, and I noticed that the areas that are transparent on the .png of the texture are not transparent on the actual model.It is illustrated in the ...
0
votes
0answers
52 views

Speeding up map rendering

My map loading and rendering process is slow when using very large maps, so I'm looking for ways to make it more efficient. My current solution works like this: My map loader uses for loops for ...
0
votes
0answers
35 views

How do I make the 3rd person camera follow the space ship in my Space Shooter game?

https://youtu.be/13HgaeZWlIA I am making a 3D space shooter game using OpenGL and Bullet Physics. I am having a hard time with the 3rd person Camera though. If you take a look at the video above you ...
0
votes
0answers
21 views

Having problems with making a button class (checkIfClick) opengl

Just basing how sfml does it, I get the globalbound of the object and then check if the mouseposition is within the object. I ...
0
votes
1answer
35 views

Get black bars with framebuffer and glViewport

I have read several tutorials and answers regarding framebuffers and glViewport, but I can't seem to resolve this issue I have. I want to take a low resolution framebuffer (400x225) and place it in a ...
0
votes
0answers
32 views

Having trouble with 2d projection (Opengl)

I need to change the normalize coords from -1 to 1 to the width and height of my application. The reason why I want to change the normalize coords is because i think it would be a easier set position ...
0
votes
2answers
49 views

What rotation needs to be applied to align mesh with expected axis of target?

I'm using LWJGL and JOML to create a 3D view of hexagons whose positions lie on a torus. I have a number (NxM) hexagons, whose centres and normals I have calculated to be placed on the torus to ...
1
vote
0answers
40 views

Direct State Access (DSA) is Failing, but pre 4.3 OpenGL works [closed]

I currently have an OpenGL project in which I am using GLFW for the window and context creation, and GLAD for loading OpenGL functions. The GLAD version I am using is OpenGL 4.6, compatibility profile,...
0
votes
1answer
51 views

how to move a 2d shape in opengl 4.6 (glfw)

Class Button So from my understanding in order to move a 2d shape you need manipulate the vertices and then update???? If i do need to update the buffer how i would go by doing that? float xpos = 150 ...
1
vote
1answer
148 views

How to update indices for dynamic mesh in OpenGL?

So I am making a 3D batchrenderer for my engine, and the basic concept is that we make large enough VBO and IBO to accompany all the vertex data(positions, normals, uv etc.) and update the VBO using <...
0
votes
1answer
43 views

Memory Usage Issue with declared variables (when swapping between states)

So my problem is that When I make a Shader variable and I swap between mainmenustate and gamestate really fast I notice my memory usage increase alot but as soon I switch my Shader varaible into a ...
0
votes
1answer
101 views

text rendering artifact when rendering in 3D opengl GLfW

Main.cpp ...
0
votes
0answers
31 views

Parsing OBJ file having multiple objects

I am very new to game development and have been following the youtube channel ThinMatrix for its GameEngine tutorials https://www.youtube.com/playlist?list=PLRIWtICgwaX0u7Rf9zkZhLoLuZVfUksDP In one of ...
0
votes
0answers
46 views

Problem with bullet movement

I'm trying to draw "bullets" in my game, but I think something is wrong with velocity computation. Sometimes the "bullets" are going in the right way, but sometimes they won't. The ...
0
votes
0answers
28 views

camera relative movement with GL.Translate

I'm using the OpenTK library, an OpenGL library, for C#. I'm trying to do camera-relative movement and though I'd use GL.Translate for moving and ...
0
votes
0answers
16 views

reflecting objects by rendering them to the cubemap

I have 2 sphere objects and it isn't reflecting the other one. The picture is when it simply reflects the cube map but when I try to render to the cube map the spheres turn out black. In camera class: ...
1
vote
1answer
75 views

OpenGL: What to do after running glBufferData?

I am interested in understanding a bit more behind how OpenGL does its memory management and what are some good practices before I start heavily coding and back myself into a corner. The real question ...
0
votes
1answer
68 views

Why does reading my depth texture in GLSL return less than one?

I've created a depth texture in OpenGL (using C#) as follows: ...
0
votes
1answer
52 views

Shader Flickering Normal Map Lighting

I am encountering an issue when using a normal map with directional and/or point lighting. Without using the lighting, I am able to render the object fine. When any amount of lighting is applied, it ...
0
votes
0answers
15 views

How to test a Unity game with different graphics APIs?

If I don't have a device with Metal, is there a way to test the application with it anyway? And if my device supports both DirectX and OpenGL, how can I tell the application, for example on Windows, ...
2
votes
1answer
150 views

Is linear filtering possible on depth textures in OpenGL?

I'm working on shadow maps in OpenGL (using C#). First, I've created a framebuffer and attached a depth texture as follows: ...
-1
votes
1answer
81 views

What is the best way to approach a multi pass rendering system?

I am trying to code a new feature in my engine but I can't find a way to implement my idea, which is the next one. I am trying to get multi pass rendering with more than two passes. I know how to do a ...
0
votes
1answer
67 views

OpenGL/C++ Rotate relative to shooting gun

I'm trying to make a 2D game where I have a gun that i use to shot things in the direction of the mouse resulting in an angle that I can get. I have some problems with the trajectory of the bullet ...
1
vote
0answers
42 views

GLSL link fails with C9999 (too many buffer declarations?)

I'm receiving a C9999 (*** exception during compilation ***) linker error for an OpenGl 4.6 compute shader. It seems to be related to the number of SSBOs I have declared (14 separate declarations), ...
1
vote
0answers
65 views

OpenGL model not rendering properly

I have been playing with OpenGL for a while and I came into the wall that I don't know how to pass. I am trying to render a model of an object based on a .obj file. In that file I have position ...
0
votes
1answer
68 views

Attempt to fix sprite sheet pixel bleeding in OpenGL 2D causing sprite distortion

While working on a project, I encountered the common problem of pixel bleeding when trying to draw subregions of my sprite sheet. This caused sort of "seams" to appear at the edges of my ...
0
votes
1answer
24 views

Corrupt Save File Problem Csharp Opentk

I am trying to save player's objects but my loaded result is corrupt and placed in weird shapes like 3D arrows. Weirdly enough when terrain is saved, the terrain is fine but objects added later cause ...
1
vote
0answers
57 views

Basic 2D Lighting Optimization Issue in Fragment Shader with OpenGL (GLSL)

I'm using a fragment shader to implement 2D lighting (code further below). Even though I am satisfied with the visuals of the light i noticed that it has a quite big GPU usage, and when trying to add ...
0
votes
0answers
53 views

How to convert OpenGL 2.0 code to OpenGL-ES 2.0?

I have a 3D game library that uses OpenGL 2.0 for PC and I need to convert it to OpenGL-ES 2.0 to compile it for Android. Because the library is huge, I'd like to avoid converting it line-by-line by ...
0
votes
0answers
40 views

Z-Buffer Problem

I was working on my engine and while implementing post processing a very weird bug appeared. It seems to come from the Z-Test but I can't firgure out what exactly it is hapening First of all here's ...
0
votes
0answers
30 views

Knowing the size of a framebuffer when rendering transformed meshes to a texture

I have a couple of 2D meshes that make a hierarchical animated model. I want to do some post-processing on it, so I decided to render this model to a texture, so that I could do the post-processing ...
0
votes
2answers
224 views

Does SDL2 completely encapsulates Direct3D and OpenGL?

I'm starting to study game development but the concepts of how the SDL2 lib works are still a bit blurry to me. I get that both Direct3D and OpenGL are two sides of the same coin. They both are used ...
1
vote
1answer
55 views

Why should every light source have its own ambient light?

I'm currently learning how to use OpenGl, and I'm following a tutorial on learnOpenGL. I'm at the lightning chapter, and it has introduced basic lightning, ambient and diffuse with specular highlight. ...
1
vote
0answers
57 views

glReadPixels performance not improving with PBO

I'm currently using glReadPixels to read from the depth buffer to calculate where on the map the player is pointing, for the purpose of placing objects on the ground. I do this after rendering the ...
1
vote
1answer
109 views

Unable to create Shader Object for Geometry Shader (GL_GEOMETRY_SHADER)

I am just starting with OpenGL using c++ on Ubuntu 18.04. The problem I have is that when I try to link Geometry Shader in my main program, the following function call is unable to create an object (...

1
2 3 4 5
82