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
0answers
15 views

How to add vec2 for UV for texture mapping when using indices to build cube

I am trying to apply texture mapping to my cubes but are unsure on how to proceed. Current I am using indices to avoid having to repeat vec3s to make a cube and a vertex array of the points and their ...
0
votes
0answers
20 views

glCopyImageSubData slower than binding & drawing

I've read that above GL4.3, to copy one tex to the other, glCopyImageSubData will be the fastest solution, but after some forloop nested compare, it just not is the case here , glCopyImageSubData is a ...
0
votes
2answers
57 views

When does a “frame” start and end?

Here is the main loop that I currently have (and it does work perfectly): ...
1
vote
1answer
48 views

Improve cube rendering performance in lwjgl

I've been coding a minecraft-like game in lwjgl using cubes. I've reached a point where I can render 6 chunks of blocks before it starts lagging. I've searched online for optimizations and one of the ...
0
votes
0answers
24 views

Very small line when two sprites are exactly next from eachother

Recently, I have been thinking about a hangout game, not really need to go into detail, because I am focusing on creating the engine itself. Basically just to make my brain not hurt while making the ...
0
votes
1answer
39 views

Not understanding how indices and texturePositions are mapped to vertices in LWJGL

I've been following this tutorial on OpenGL and LWJGL and at some point three different lists are introduced without really explaining how they interact with each other. Can someone explain how it ...
-1
votes
0answers
25 views

Optimizing GL render

I have two questions : 1- I'm sending different Uniform Buffer Objects (UBO) to different programs, would it be (and how much of) an improvement to combine all the UBO into a single big one that is ...
1
vote
0answers
40 views

Collision detection stop movement

I am making a simple first person 3D game in OpenGL with C++. I am just wondering on how you make an object stop moving when it collides with another object. This is what I am using for detecting ...
2
votes
1answer
22 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 ...
2
votes
1answer
56 views

OpenGL 2D texture lookup returns zero (black)

I am trying to use a 2D texture as a lookup table for pre-computed values. In each case I set all values of the texture to 0.5 for testing. When I use a 1D texture, it works and I get 0.5: ...
2
votes
0answers
44 views

Synchronizing transformation of a Rect class between CPU and GPU

I implemented a Rect class in my custom game engine that utilizes openGL. I decided to approach the whole Rect class design like ...
0
votes
0answers
35 views

rotate sprite without stretching

I am attempting to rotate the sprites in my game, but they get stretched whenever it happens. I know that it is due to the screen not being square, but I can not figure out the correct way to ...
0
votes
0answers
62 views

Workaround for texture coordinate problem on border of terrain “chunk”?

I am working on clipmap terrain with streaming chunks loaded into a texture array. There are currently 2 texture arrays, one for the heightmap chunks and one for the normal map chunks. Chunks load in ...
0
votes
1answer
41 views

Why is my OpenGL code not rendering anything?

I have been following the LearnOpenGL Hello Triangle tutorial, and nothing is rendering except the clear color. Any help finding what is wrong would be appreciated. Using LWJGL 3.2.3 OpenGL and GLFW ...
0
votes
0answers
15 views

handling obj file without normal [duplicate]

I am trying to build an obj file loader and I have written code to read an obj file with face f with v/vt/vn - vertex, texture coordinate, and normal. While going through the obj file, there are so ...
1
vote
0answers
56 views

Why is this GL_TRIANGLE fan texturing incorrectly?

I am constructing some terrain for a 3D game (in C) as a 2D grid of tiles, the corners of which have height into the 3rd dimension. In the middle of each tile is another vertex, the height of which is ...
2
votes
1answer
38 views

Matrix math in cascade shadow mapping

I am implementing cascade shadow mapping algorithm and currently stuck with matrix transformations - my AABBs, when projected in light space are pointing in the direction opposite to the light: I was ...
1
vote
0answers
29 views

Visualizing collision rectangles in world space

I am calculating collision for my fps-camera by checking if the x/z-position of the camera is inside a plane. And the detection works fine. The plane is represented as two-component vectors min and ...
2
votes
1answer
47 views

Drawing OpenGL camera frustum

I am trying to display camera frustum in my OpenGL application. I calculate the vertices of the frustum pyramid using reverse projection from screen space to world space. The camera uses perspective ...
0
votes
0answers
14 views

Directional lighting messups with uniforms

Recently, I've been making a 3D game, and I have more progress! I am trying to implement lighting, but when I want to change the directional light uniform manually, it gets weird. Here's an example ...
0
votes
1answer
43 views

What happens if first we scale a rotation matrix and then multiply it with an object?

This question has been bothering me lately. I know the correct order to scale, rotate and transform a matrix but the question I have is very different. What if we first scale our rotation matrix by ...
1
vote
1answer
29 views

Scene graph with camera

I need help with a little problem in my project, in which I have a scene graph with the intented camera like this: MovementNode Camera Node Mesh Object My problem is that I have the propagation of ...
1
vote
0answers
131 views

Understanding the math behind perspective matrix in OpenGL

I've been trying to figure out the math behind perspective matrix for 2 weeks now but I'm failing badly. I understand the theory behind the perspective matrix but I am not sure how the math works. The ...
0
votes
0answers
19 views

OpenGL sampling a multidimensional texture

Preface: In my AI project I'd like to do UV mapping of my mesh with a neural texture consisting of 16 channels with 512x512 values of type float16. The result will be a neural frame consisting of 16 ...
1
vote
1answer
71 views

How to fix shadow not casted to terrain when rendering using default and terrain shader (depth shader included)?

Given that I have the TerrainShader class and DefaultShader class. Also a FBO (Frame Buffer Object) shadow map The ...
0
votes
1answer
23 views

OpenGL translation based on “scaled” pixels? (Not physical pixels)

My (2D!) game runs in a “scaling mode” so to speak, and I’ve yet to find anyone asking this question anywhere. Basically, I want to achieve a sort of “scaling algorithm” whether graphics are ...
1
vote
0answers
45 views

How to move the shadow map with the camera?

I implemented a directional light and a shadow map for that light based on learnopengl.com tutorials. And it is working great, but I would like to move the shadow map with camera/player, so I have ...
0
votes
1answer
53 views

What is a correct approach to gamma correction in OpenGL?

I'm currently reading about the topic of gamma correction and am a bit confused about what should I, as a game developer, do about it. There seem to be a few options here: Don't do anything at all ...
1
vote
0answers
19 views

OpenGL Per-Object Outlining issues

I'm trying to draw onlines around the objects, the outlines for any object should be see though very other object, I've successfully been able to draw the outline but the pixels get discarded in the ...
1
vote
0answers
42 views

How to move player camera with mouse in LWJGL 2?

I making a 3D game like Minecraft in LWJGL 2 and now, I want to move player camera with mouse like Minecraft. Here are the codes I have: com/kg/kgcraft/KGCraft.java: ...
0
votes
1answer
63 views

Shaders overriding other shaders

Recently, I've been making a 3D game and I have been having trouble with making multiple shaders. I've researched this for a bit, and told that I had to use ...
0
votes
1answer
42 views

glm::perspective() with wide field of view

I'm still pretty new to this GL stuff, but I've managed to put together some C and C++ code that allows me to construct simple 3D objects consisting of line segments and display them on my laptop ...
0
votes
0answers
27 views

Python Opengl Procedural Terrain Rendering

I am rendering procedural terrain in Python using OpenGL. Once generated, data for each terrain tile is stored in lists. However currently I am only getting around 25fps despite rendering only around ...
0
votes
0answers
19 views

Slick-Utils texture not loading after binding to FBO

Recently, I am making a 3D game using LWJGL, and finally got framebuffer textures to work! The problem is, though, is that I think the default shader that is used for the cube doesn't work or the ...
0
votes
0answers
24 views

How many texture units are available per shader stage when compared to the total number available on hardware?

The answer to the question How many textures can usually I bind at once?, given here, explains that: OpenGL 3.x defines the minimum number for the per-stage limit to be 16... and that there can be a ...
0
votes
0answers
17 views

Issues with percentage closer filtering

I'm trying to code a simple game via OpenGL C++. I've implemented a point light, parallax effect with textures, objects from blender etc. but I seem to have an issue with my percentage closer ...
0
votes
1answer
29 views

FBO not rendering or changing anything

Recently, I am making a 3D game. I want to do special post processing effects, like pixelization. I used this to load do everything with FBOS, but it's kindof weird... In some code for the ...
0
votes
1answer
42 views

Post Processing without using FBOs?

Recently, I've been making a 3D game (hint hint my questions), and I recently have modified a pixelization shader from a unity shader graph tutorial. The thing is, I want to render the shader on the ...
2
votes
1answer
82 views

OpenGL height map accuracy for planetary rendering

I am trying to implement planetary rendering and I am trying to use OpenGL tessellation to model the terrain. Here is an overview picture using cube faces projected onto a sphere: If I use the ...
1
vote
1answer
27 views

Find out triangles that are not occluded from a camera view?

For a project i need to find out triangles that are directly seen by the camera / user. Triangles that are occluded by other triangles should be ignored. There may be 200 thousand triangles in a model,...
0
votes
0answers
17 views

OpenGL never reverts to default FrameBuffer

So I'm trying to change the texture using FBOs, When I run it, The whole game gets drawn in the new FBO that I created then deleted, Here's the function ...
0
votes
0answers
23 views

How to set camera coordinates without making a Camera class?

Recently, I have been making a 3D game (and asking alot of questions about it), and yet again, I've run into another problem. I'm trying to rotate a cube across the "camera" origin, which is ...
1
vote
0answers
39 views

How to properly delete unwanted models

I am implementing bullets into my game, and each bullet has a lifetime. Whenever the bullet has existed for a set amount of time or collides with an object, the bullet should be deleted. I implemented ...
0
votes
0answers
43 views

Help needed to render textures using fragment shader (or procedural textures)

Recently, I have been making a 3D game. I was messing with my shader files, when I ran into a problem. The "texture" I made for the fragment shader just renders on top of the object, and ...
3
votes
1answer
226 views

What is GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS?

I am a beginner in OpenGL. I am learning about textures in OpenGL. What I don't understand is how to determine how many texture units are in the GPU. I heard someone said that you can see how many ...
0
votes
1answer
52 views

Need help getting an objects orientation / all my OpenGL rotations are reversed

I'm using OpenGL on Ubuntu Linux with the Eclipse IDE and the GCC compiler. I am bringing blender models into a homemade renderer/game engine. I parse a text file containing object descriptions to ...
0
votes
0answers
26 views

How to a select a single 3D object out of multiple objects using mouse click and move it using mouse drag in OpenGL

I am rendering multiple 3d objects on the screen but i want to select one particular object by clicking on it and then move it using mouse drag but i cant figure it how to do it because on clicking ...
0
votes
0answers
22 views

Not clearing FBO's Texture error in battery economy mode

When rendering inside a FBO's texture, I'm not using glClear() but overwriting each fragment, GL_BLEND is set to true. This works just fine, but I just realised when my laptop switch to economy mode, ...
0
votes
0answers
24 views

Screen space reflections shown at incorrect position

I have been trying to add a SSR post-processing effect into my engine for a while now, but it always seems to fail on the same thing: Reflections are not properly positioned below the object instead ...
0
votes
1answer
34 views

Lag Spike When Creating Model

I am creating a game using OpenGl in c++. Whenever I create a new model while the game is running, such as fire a bullet, there is a huge lag spike. The function that creates the model is below. ...

1
2 3 4 5
83