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
2answers
40 views

Is there a way to figure out in which quad I am in fragment shader?

In my openGL project I draw a lot of quads (composed from 2 triangles) - for sake of example let's say quad 0,1,2 and 3. I process them in single pass. I do transform them with projection view matrix ...
0
votes
0answers
11 views

Opengles glBindBufferBase has weird performance issue

I am now doing some optimization for rendering process. I notice that in my game some objects is totally static and never changed. In my old way, I will create a uniform buffer every frame, and put ...
-3
votes
0answers
70 views

Moving camera with keyboard (WASD) in OpenGL (GLFW) [closed]

I want to move camera with keyboard in OpenGL. I followed this tutorial, but I have no idea how can I use them. This is my code: ...
0
votes
0answers
20 views

OpenGL I want my image to change color based on stencil

I have an image and a rectangle on the screen, using the using this stencil functions I managed to render or not render a certain part of my image. ...
1
vote
1answer
65 views

Optimizing a deferred renderer

I've been creating a game engine with Kotlin and LWJGL. I wanted to render scenes that support many light sources, so I worked on implementing a deferred renderer. My basic pipeline is as follows (...
0
votes
0answers
21 views

Weird Collision Response occurring between 2 objects

I have been trying to program collision response between two objects (with AABBs) and the response is not what I except. Instead of bouncing off (reflective to the collision normal) each other the ...
0
votes
0answers
48 views

Huge texture management in OpenGL

I have developped a big map where the user can navigate. Let's say this map has a resolution of 15000x5000 (for example. It can be even higher). The way I am handling this in 2D is with a Tile Map (...
1
vote
0answers
28 views

LWJGL Using gl_VertexID properly?

I've gotten back to making lwjgl games, and I'm trying to make a sort of wave type vertex shader. I call this to make it wave: ...
0
votes
1answer
18 views

How to update constant buffer patially in OpenGLES

I am wondering what does glMapBufferRange actually do? I am accessing my constant buffer like this way: ...
0
votes
1answer
32 views

OpenGL gl_Position z-range and depth buffer range

Am I correct that the OpenGL depth buffer has values between 0 and 1 while the z component of gl_Position is between -1 and 1?
0
votes
1answer
27 views

Keeping two triangles with different scale attached during rotation

I'm making a simple Lunar Lander clone. The ship is a triangle, and I'm trying to draw the exhaust fumes of the ship. I'm wondering how to draw the exhaust so it's always relative to the ship. I'm ...
0
votes
1answer
108 views

CPU / GPU usage are both below 100% - what is bottlenecking my game?

I've been developing a C++ OpenGL game for the last couple of months. A few weeks ago I was profiling the game and I noticed that the GPU usage was almost at 100% (with the framerate uncapped). I ...
0
votes
0answers
17 views

Does mac OSX support multisampling?

I am using macbook air and writing my rendering app using GLFW library. I am currently enabling multisampling like the way I shown in the code snippet below. ...
0
votes
1answer
22 views

Rendering order objects with transparency?

I do not know if this question might have been asked before, but which method for rendering transparency is more efficient in terms of less lag?: Rendering the scene from front to back with respect ...
1
vote
1answer
39 views

Is there a way to blend an opacity overlay in a "mix" like nature without using an FBO?

I have done this many times whilst using FBO's, but in this unique case i would prefer not to use an FBO. I have tried a multitude of gl.BlendFunc() and ...
0
votes
0answers
42 views

Render 3 textures into an RGB texture?

Flutter has support for external textures, but they have to be RGB. I want to render YUV video to Flutter. On OpenGL I used to create 3 textures, and upload Y,U,V to each corresponding texture. Then I'...
0
votes
1answer
72 views

How to calculate the shadow bounding box with a directional light

I'm trying to implement a directional light in my C++ / OpenGL engine, but I struggle to calculate the shadow bounding box (i.e the shadow frustum). The bounding box has to encompass the main frustum ...
0
votes
0answers
30 views

Drawing 4D coordinates OpenGL WebGL

Quick question summary: how do I make openGL take 4 coordinates per point into the vertex shader from an array? I will then convert these to 3 coordinates (glPosition.xyz). More detailed explanation: ...
2
votes
1answer
28 views

LIBGDX ShaderProgram not passing uniforms

I'm trying to implement a Shader that turns any RGB values below 190 into black. LIBGDX code: ...
0
votes
0answers
33 views

OpenGL : std140 alignment and uint64_t arrays

I have a problem but I can't figure out what is happenning (I think that there is an alignment problem...), so in my OpenGL application I use bindless textures which handles are sent to the shader via ...
0
votes
0answers
27 views

Multipass rendering pipelines comparison (basic, uber, compute, ...)

I'm working on a project in wich as you can see in V1 it's doing a lot of drawcalls, 3 per instance of MyRenderer actually, in the first place I would like your opinion on this pipeline, if I'd be ...
-1
votes
0answers
14 views

How to convert normalized positions into screen positions LWJGL

Recently, I've been making 2D games, working on things, etc, and I've been wondering how I could make it so that the coordinates of glVertex2f() would be the same ...
-1
votes
0answers
53 views

Lifecycle for UI objects

I'm currently developing UI features using OpenGL. The initial way I structured all source code is that before accessing the game loop (rendering functions, event processing...) I define the UI ...
0
votes
1answer
69 views

OpenGL Vertex Shader "joint matrix * weight" multiplication performance

Trying to implement animation on my engine. I'm at the first stage, rendering default pose of skinned meshes. Working as expected but very slow. With the below calculation, the shader takes 6ms to run....
1
vote
1answer
96 views

Orthographic projection not showing a triangle

I just want to draw a simple triangle using GL_LINES primitive with orthographic projection matrix. This is my vertices... ...
0
votes
0answers
38 views

how set set RGB components separately in opengl

Suppose I have previously rendered some set of pixels on the screen that each contain one of the following RGB values: ...
0
votes
1answer
39 views

Tangent Space Light Direction Incorrect?

I have normal mapping with a directional light in place. I noticed the lighting looks off but am unsure why it is happening. I believe it is related to the TBN matrix and possibly the handedness fix ...
0
votes
0answers
17 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
28 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
90 views

When does a "frame" start and end?

Here is the main loop that I currently have (and it does work perfectly): ...
0
votes
1answer
77 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
1answer
60 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
0answers
55 views

OBJ file loader texture coordinates ‘scrambled’

Edit I've rewritten the loader to duplicate data if only one element (v, vt, vn) is different. I get a much better result, but it is still incorrect. The seams on the mesh match what they should look ...
0
votes
1answer
45 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 ...
0
votes
0answers
45 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 ...
0
votes
1answer
36 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 ...
0
votes
1answer
65 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: ...
1
vote
0answers
46 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
42 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
76 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
44 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
17 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 ...
1
vote
1answer
63 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
32 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
172 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
64 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 ...
0
votes
1answer
33 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
137 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 ...

1
2 3 4 5
83