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
1
vote
1answer
194 views

C++ Mouse picking for ray to plane intersection

I'm making a C++/OpenGL application (decidedly without GLM), and I'd like to understand how to create a ray from the camera eye to the mouse pointer, as well as detect an intersection point from the ...
1
vote
2answers
994 views

Opengl - Glsl for loop array iteration bug

I am facing a really weird bug. On an old copy of my engine, i was doing a loop to render all the lights in my scene: ...
0
votes
0answers
12 views

3D terrain editor brush using compute shader

i am working on 3D terrain editor, and i have simple brush for adding or subtracting height. Right now I am calculating new Heights on CPU dependent on brush radius. ...
3
votes
1answer
315 views

GLSL shader algorithm to render a sprite map with a single draw call (on a single sprite mesh)

I'm trying to render a tile map world on a single sprite mesh (instead of one sprite per tile.) This significantly reduces the array vertex bus labor for extremely large worlds: In order to do this, ...
0
votes
1answer
116 views

OpenGL concatenate vertex data into one big VBO

I successfully can render two triangles (with a texture) that looks like the side of a crate and also "walk" around it. Also, a small .obj file parser is available which gives me a float array of the ...
0
votes
1answer
87 views

I can't make the cube map to use shadow mapping - or it seems so

Basically, I'm following tutorials as I'm very new to OpenGL. I managed to perform shadow mapping towards just one direction, meaning I created 2D texture depth map. Now with omnidirectional shadow ...
3
votes
1answer
2k views

Procedural terrain using 3D noise

I'm coding a procedural terrain generation based on this article from GPU Gems 3. But using CPU (not GPU). I'm stuck at generating the procedural terrain. I just can't figure out how make a 3D ...
4
votes
3answers
2k views

GLSL: sampler2D fallback to constant color?

So I have the following situation: I'm sharing a blinn shader accross many meshes. Some meshes have specular & normal maps, others do not. I'd like to, without making the shader code too ...
5
votes
1answer
672 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 ...
0
votes
1answer
841 views

How to improve the performance of my OpenGL rendering context? [closed]

I have written a benchmark program that compares the performance of OpenGL and DirectX libraries. The problem is that OpenGL gets much lower performance than Direct3D. At the end the program generates ...
0
votes
1answer
53 views
3
votes
1answer
1k views

GLSL Core Functionality Geometry Shader examples

I'm doing some research on geometry shaders and am having problems finding code examples/tutorials that does not use one of the extensions introduced before it was core functionality of OpenGL 3.2. ...
13
votes
1answer
20k views

OpenGL/GLSL: Render to cube map?

I'm trying to figure out how to render my scene to a cube map. I've been stuck on this for a bit and figured I would ask you guys for some help. I'm new to OpenGL and this is the first time I'm using ...
5
votes
1answer
19k views

How do I pass vertex and color positions to OpenGL shaders?

I've been trying to get this to work for the past two days, telling myself I wouldn't ask for help. I think you can see where that got me... I thought I'd try my hand at a little OpenGL, because ...
88
votes
15answers
51k views

What are some good learning resources for OpenGL? [closed]

I have been using the OpenGL ES on the iPhone for a while now and basically I feel pretty lost outside to the small set of commands I've seen in examples and adopted as my own. I would love to use ...
4
votes
2answers
5k views

computing gl_FragDepth

I am trying to draw spheres using a billboard, so I have a normal map with a z component that I am sampling in my fragment shader. I just need to add this z component to the depth of my fragment to ...
11
votes
3answers
3k views

Why is it possible to encounter a texture coordinate greater than 1 or less than 0

I'm studying a text about texture mapping and in the preparing to draw session, I read: Define the texture wrapping ...
0
votes
1answer
39 views

OpenGL approach to depth-testing-like combination of a large buffer of fragments

I have a depth buffer and color buffer created by another effect. The buffer is more than double my screen size. It is not rendered from geometry, but as a whole it resembles a rendered scene with an ...
0
votes
1answer
110 views

Animate some tiles of tile map

I have a game where each "tile" of the terrain is a triangle (Settlers 2). Those are placed next to each other and in way creating an infinite world (right/bottom jumps back to left/top). There is a ...
1
vote
1answer
39 views

How can I implement a side scrolling seamless fog shader?

I've run into a problem trying to code a 2d game. The way I've set up the game is that you run through underground dungeons and fight enemies, for ambiance I've added a smoke/fog shader to superimpose ...
-2
votes
0answers
40 views

How do I bind a bone vector to a glBuffer?

I want to shred the bone with the vector of weight. However, running the c++ and the GLSL code below, I get an error: glBufferData import problem vertex shader :S How should ...
10
votes
3answers
699 views

How to hide a post-processed mesh outline when/where the mesh is hidden

I'm working on setting up an active outline in my 3d engine, a highlight effect for selected 3d characters or scenery in the screen. After working with the stencil buffer and getting some ...
1
vote
1answer
249 views

Show only some parts of a point cloud. OpenGl4

I am developing an opengl 4.0 app which is showing a point cloud. In the other hand, I have an array "pos" where I have some x,y,z positions: ...
0
votes
1answer
584 views

LibGDX - Draw multiple textures with different positions with one shader?

currently I'm optimizing my render calls by drawing multiple textures with one shader. The background textures who all share the same position are no problem. But now I want to draw some Textures with ...
0
votes
1answer
69 views

How to deal with VBO and obj files for physics simulation?

I'm having a hard time struggling with obj files and clothing simulations. I first made the obj file processor class that deals with the typical obj file problem: having multiple indices for vertex ...
0
votes
1answer
135 views

How can I access an OpenGl buffer from within a GLSL 330 shader?

I am currently attempting to create a simulation using OpenGl's GPU acceleration for both the simulation computations and rendering. The rendering portion of my simulation is complete and working, but ...
3
votes
1answer
554 views

Specular Light not working (Phong Lighting)

There seems to be a problem with my current Phong Shading implementation. I have been using the per fragment approach. The specular highlight aspect of the technique is not rendering as it should, as ...
1
vote
2answers
51 views

Problem with rendering a quad from four lines

I am having a problem with rendering a quad in opengl via 4 lines (5 vertices via GL_LINE_STRIP). The rendering is generally working fine in terms of connecting the lines into a quad. The problem is, ...
1
vote
0answers
39 views

Orthographic camera produces strange results

I've created a basic orthographic camera using the following view projection matrix: ...
0
votes
0answers
67 views

Texture dimensions guidelines

I have 3 related questions: What are the main optimizations related to power of 2 dimensions for 1D/2D/3D textures? This question gives some answers like mipmapping, but are not well explained and ...
5
votes
1answer
2k views

Drawing fonts with LWJGL3 with OpenGL

I'm very sorry if this question has already been answered, but since I've been struggling with this for many days I thought I'd give it a shot here. My goal is to somehow render some text on the ...
2
votes
2answers
499 views

Why is enabling GL_FRAMEBUFFER_SRGB making the colours brighter?

My understanding of gamma correction is as follows: We want to do colour math in linear space so we can lerp etc. between colour values and get the results we expect. But human eyes don't have a ...
1
vote
0answers
52 views

How can I apply my camera to all graphics objects?

Is there a way to have the camera be applied to all objects? Can you have the camera effect objects that where made with glVertex3f(); This is the fourth time I ...
-2
votes
1answer
71 views

Why is my map not drawing properly?

My code compiles fine but for some reason, I get this white background in my window. what am I doing wrong? I want to draw my map (sorry, there is a lot of code). Here is my debugged window image: ...
1
vote
1answer
76 views

How do I render a word in the middle of the screen using FreeType and OpenGL?

I'm following this tutorial series on making a simple 2D clone of the classic Breakout game, but its author doesn't mention how to render a whole word or sentence in the middle of the screen. He ...
0
votes
2answers
258 views
0
votes
1answer
169 views

OpenGL Parallax Displacement Mapping Not Working

I am attempting to implement parallax displacement mapping into my OpenGL code but it is not working as it should. https://imgur.com/a/9yIQL As I move around, double-lines moves around and if I am ...
4
votes
1answer
964 views

Why is my model rotating opposite direction around the Y axis?

I have a simple scenario. I have a simple scene, and in it I'm drawing a grid and a model, with some axis for orientation. I noticed when I rotate the model about it's local Y axis, if I rotate the ...
0
votes
1answer
36 views

Unable to create OpenGL window in SDL2

I am currently working on a C++ + SDL2 game engine and I am stuck on a problem. The problem is that whenever I pass SDL_WINDOW_OPENGL to ...
4
votes
1answer
661 views

Render Stutter - OpenGL or loop timing?

For some time now i have no been able to pinpoint the nature of the rendering stutter shown above(by not clearing the screen, not using SwapBuffers and drawing only to the front buffer). See the big ...
0
votes
1answer
189 views

Offset on camera following object that accelerates

I have camera a that is actively following an object (a plane) from behind. This object can accelerate or decelerate. I would like to have a camera offset when I move the plane, so it doesn't look so ...
1
vote
3answers
309 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
2answers
203 views

How can I represent a 2d UI?

So, I wanted to start building a desktop application, which is of course with an interface, and I thought that OpenGL would be best. The problem is, once I started following TheChernoProject's ...
0
votes
1answer
69 views

Porting C# OpenGL rendering code to C++ DirectX

I have the following rendering method written in C# and apparently using OpenGL immediate mode, and i'm trying to port it to C++ and DirectX: ...
5
votes
1answer
279 views

How to generate a multiplier map for radiosity

I am following this tutorial: here I am at the part where you are creating a hemicube. I have got the code to render the scene into a texture and therfore an array. Now how can I generate a so-called ...
1
vote
1answer
168 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
0answers
131 views

How is root motion done in Skeletal animation

I am using Assimp library to load bone and mesh data and using basic interpolation to accomplish the animation part. Right now I want to move my character position with animation, i.e. root motion. ...
2
votes
0answers
415 views

OpenGL using quaternion to rotate camera to avoid gimbal lock [duplicate]

I read in many sources about using quaternion to avoid gimbal lock but I can't apply this practically in my code, so I have a camera class I want to rotate it with mouse so I have Euler angles Pitch ...
0
votes
1answer
380 views

Adjusting view matrix when glViewPort & resizing

I have an issue when my window resizes. I have a simple MVP shader like this gl_Position = projection * view * model * vec4(in_Position, 1.0); to render a map ...
8
votes
3answers
9k views

Updating texture memory via shader?

What the title says.Is it possible to update a texture via a glsl shader ? Something like : ...