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
36 views

Single Array Texture, multiple wrap modes

I have a array texture of which I would like some of its sub-images have wrap modes of GL_REPEAT and others to be ...
1
vote
2answers
23 views

unsmooth blending with deferred shading and light volumes

So I implemented deferred Shading with a single full screen light pass (picture 2) (by passing the light-data as an array to the shader) and deferred shading with point light volumes (picture 1) (by ...
0
votes
1answer
38 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 ...
0
votes
1answer
47 views

Distance between moving, rotated rectangles in snake game

I am trying to implement basic Snake game with movement based on timestep. For now I've got something along those lines: Update function: ...
0
votes
2answers
70 views

Vertexes passed to OpenGL becoming zero

I've got two methods of test code. The first uses a single VBO with the vertices and texture coordinates interwoven to draw a square to the window. The second uses an array of three VBOs to define the ...
2
votes
0answers
37 views

OpenGL : Blending & feedback effect

I'm struggling on a simple project, as an example/sandbox, I'm rendering a small oscillating rectangle on my output. I'm not using glclearcolor() but instead, on ...
0
votes
1answer
25 views

Depth to World Space Position problem

I am having a problem with turning depth to world space position. I am using GLSL. What could go wrong? Here is the code: ...
-1
votes
1answer
33 views

How can I add one OPENGL page to another when ENTER key is pressed?

I created one GLUT project which has my project's introduction page. When I pressed ENTER key, it should redirect to my front page of project which I created as another project.
4
votes
0answers
85 views

Why use sprite tile maps on the GPU in WebGL?

I'm trying to figure out the best way of rendering my layered tiled maps with WebGL, and have come across this tutorial several times: https://blog.tojicode.com/2012/07/sprite-tile-maps-on-gpu.html ...
1
vote
1answer
53 views

Seam on UV Sphere

I created a uv sphere model in Blender, and I'm loading it as an obj into my OpenGL game. I'm attempting to model a 2d image as a texture for this sphere to make the moon, but I've run into this issue....
0
votes
0answers
50 views

OpenGL fixed function - WASD 2D movement

I need to make a simple object (like a turtle) move on a 2D scene. The keys w, s, a and <...
1
vote
1answer
91 views

Why does my stencil buffer allow pixels through?

I'm rendering a scene using OpenGL. The scene consists of a grassy environment and a small lake (visible as two surfaces). To achieve water surface transparency, I'm using a stencil buffer to render ...
0
votes
2answers
102 views

How to process events as well as do OpenGL rendering using multithreading?

I am working on a very complicated graphics rendering, using OpenGL, and it is very time consuming, in the sense that it creates a delay in the event handling, of my application to an extend that, the ...
0
votes
1answer
64 views

What is the proper way to create a camera matrix?

I am having issues when trying to create a camera transform. It seems to have odd distortions and it does not seem to rotate properly, though it will translate alright. While I have seen issues like ...
1
vote
0answers
37 views

How can I reduce a frustum to the subset that passes through a portal AABB?

I'm trying to implement portal based occlusion culling: There are sectors and portals. When a portal is visible, the sector it is connected to is rendered. The sector is made of polygons and ...
0
votes
0answers
26 views

WebGL transparent gradient mask at edge

I need to make a feature in WebGL, where I have horizontal list of meshes (example 20) and I want to show only 3 and 2 at edge are fade in/fade out. And it slowly animates from one side no another (...
1
vote
1answer
63 views

Why is my tessellation output failing to reach my geometry shader?

I'm attempting to render grass using GLSL tessellation and geometry shaders. For vertex input, I'm using position and normal. For reference, here's an image of the grassy field without tessellation (...
0
votes
0answers
74 views

For drawing many layered 2D tiles, should one use the painter's algorithm, or Z-buffering?

Sorry if this question doesn't make sense, I'm still very new to WebGL / OpenGL. Basically, I'm trying to draw a tilemap similar to the one in Stardew Valley. Here's a screenshot from that game: https:...
0
votes
2answers
78 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
40 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
114 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
82 views

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

Here is my code : ...
0
votes
1answer
45 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
72 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
108 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
106 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
83 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
195 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
72 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
64 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
258 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
36 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
12 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
42 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
60 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
73 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
24 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
84 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
38 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
55 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 ...
0
votes
1answer
117 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 ...
0
votes
1answer
282 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
48 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
136 views

text rendering artifact when rendering in 3D opengl GLfW

Main.cpp ...
0
votes
0answers
39 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
48 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
33 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
18 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
121 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
91 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: ...

1
2
3 4 5
83