Questions tagged [opengl]

OpenGL (Open Graphics Library) is a graphics standard and API which is platform-independent and available for desktop, workstation and mobile devices. It is designed to provide hardware-accelerated rendering, and hence gives greatly improved performance over traditional software rendering. OpenGL is used for applications like CAD software and computer games. The OpenGL standard, as well as OpenGL ES, is controlled by the Khronos group.

Filter by
Sorted by
Tagged with
3 votes
2 answers
943 views

Rotate a cylinder from XY plane to given points

I am given geometry of a cylinder which lies on the XY plane with 1 unit radius. And given coordinates of 2 points in 3D I need to move the cylinder so that it connects the two points. What I tried ...
Akshay Jain's user avatar
1 vote
1 answer
3k views

Background behind 3D model

I have object loader, which i want to have background. I tried to put jpg image like texture to my application. I tried to make that with FreeImage library, but the image didn't show. Also i tried ...
I.To's user avatar
  • 13
3 votes
1 answer
555 views

OpenTK - Vertex attribute layout issue

I use C# and OpenTK as my OpenGL implementation. My Vertex layout consists of 6 Doubles and one Float: ...
enne87's user avatar
  • 601
5 votes
1 answer
540 views

Where is the best place for Tangent-bitangent calculation, in shader or in C/CPP code?

I have two methods of calculating tangent and cotengent (needed for normalMap lighting calculation). The one is doing it from CPP code (with assimp library for example) The second is doing it ...
Irrmich's user avatar
  • 153
0 votes
0 answers
86 views

Image cleaning - removing all regular shapes ( circles, squares, text, icons etc. )

I'd like an automatic method to clean images. I've been looking at the GIMP, and its command line (cli) interface, in scheme / lisp. It looks very promising, but I'm a complete novice, so I'd be ...
Peter Brooks's user avatar
4 votes
0 answers
207 views

selectively setting stencil value based on vertex property in vertex shader

Just like the question says. Is it possible to selectively set the value of the stencil buffer based on a property of a vertex, like the value of its normal, during its vertex processing phase? ...
cybergla's user avatar
3 votes
0 answers
86 views

What is a good algorithm, and framework, to calculate centres of gravity or mass (cog)?

I'd like to take an photograph, subdivide it into a tesselation, either of squares, or (ideally), hexagons, and then find the centre of gravity (or, if you prefer, centre of mass) of each cell of the ...
Peter Brooks's user avatar
9 votes
1 answer
3k views

OpenGL specular shading - Gradient banding issues

I use Phong shading as my lighting model. Nevertheless, the specular shading produces gradients in the light cone: Hopefully you can see the gradient starting from the lower left corner expanding ...
enne87's user avatar
  • 601
4 votes
1 answer
2k views

What Are The Default Values of `glReadBuffer/glDrawBuffer(s)` for an FBO?

glReadBuffer(...)/glDrawBuffer(...)/glDrawBuffers(...) access part of a framebuffer's state. ...
geometrian's user avatar
  • 1,980
8 votes
1 answer
2k views

How much precision (half, float, double, etc) is enough for a Color class?

While doing some reading on how real-time applications handle color under OpneGL, I noticed that some examples implemented Color as a collection of 4 floats, while ...
AndrewSteer's user avatar
5 votes
1 answer
453 views

How do CAD programs render non-polygonal 3D objects?

How CAD programs handle displaying B-Reps and NURBS/T-Splines in their viewports? Assuming viewport uses OpenGL API - are those programs transform every object into triangles and creating/deleting ...
pmakal's user avatar
  • 53
3 votes
1 answer
933 views

ping pong between same framebuffer two color attachments

In order to optimize I'm trying to set up a setup which ping pong between same framebuffer two color attachments to apply some postprocess effects. It seems to work (effects are applied) but ...
mdkdy's user avatar
  • 2,169
5 votes
1 answer
2k views

GLSL - Merge two textures

I would like to display arbitrary 3d meshes with black edges (black outline, black ridges, etc.). Thereby I have created two different textures: One color texture and one anti-aliased edge texture. ...
enne87's user avatar
  • 601
2 votes
2 answers
275 views

Can I use the same vertices to render multiple things?

I'm passing my vertex shader a bunch of vertices and color data. I would like to first render the triangles and then render a point at each vertex. The triangles render fine, but I can't think of a ...
GodProbablyExists's user avatar
6 votes
1 answer
802 views

mapping 3d texture on view frustum (or part of it)

I'm implementing volumetric fog in my OpenGL renderer. First I inject color into 3D texture using compute shader, atomic operations and shadow map visibility check. The information I use to compute ...
mdkdy's user avatar
  • 2,169
1 vote
1 answer
806 views

How to use Shaders with vertex & index buffers?

I'm trying to render a randomly generated terrain with vertex buffers and OpenGL. I want to use a shader to color the terrain, but it seemms like my shader isn't used. I have used shaders before when ...
lega's user avatar
  • 57
5 votes
1 answer
77 views

Texture Parts Terminology

I'm generalizing my texturing code, and have become confused by the frankly contradictory information about textures' pieces. Specifically, I'm looking to understand what exactly the terms "face", "...
geometrian's user avatar
  • 1,980
5 votes
2 answers
980 views

Sharing calculation result between shader programs in OpenGL

Question Is there a way to compute something in a first shader program (eg. screen-space coordinates from word-space ones) and access those results in an another shader program? Possible solutions ...
BPiek's user avatar
  • 307
4 votes
1 answer
2k views

Compute shader not updating buffer, or vertex buffer unable to read the updates

I'm learning OpenGL compute shaders and following this guy's code, and I have stuff drawing, but not updating. The particles are spread out in their starting positions, but they stay there. ...
John Cox's user avatar
  • 161
4 votes
1 answer
636 views

Pixel packed texture source

I am grabbing video from a web cam using Microsoft Media Foundation. The image data is in YUY2 format. The pixels are packed in a 4:2:2 ratio. The color format is YCbCr. The color data gets repeated ...
001's user avatar
  • 165
8 votes
1 answer
1k views

Label Placing for thousands of objects with OpenGL

Question How to manage data (GPU,CPU) for dynamic label placement in 3d for thousands of objects (OpenGL)? Details objects: count: 2k-10k type: points/quads labels: bilboarding data: text and ...
BPiek's user avatar
  • 307
7 votes
1 answer
230 views

Proper architecture for rendering history of streamed data (points)

Overview My program receives some data points (0-400 per sec). ...
BPiek's user avatar
  • 307
3 votes
1 answer
308 views

Can't make blending work

I have a 3 dimensional dataset where each value of the dataset is normalized to [0, 1]. I want to visualize this dataset by using texture, and blending. However, it ...
Sayan Pal's user avatar
  • 263
9 votes
2 answers
873 views

How to unproject quadrilateral into rectangle?

tl;dr: Math problem in projective geometry: How does one find some 4x4 camera matrix that gives a projection as illustrated below, such that points A,B,C,D are somewhere on the edges of the unit box (...
ninjagecko's user avatar
6 votes
1 answer
2k views

Creating an "ink spread" effect with a glsl fragment shader

I have dealt with glsl before, but I still have problems with my understanding of how to achieve certain kinds of effects with per-pixel processing. What I am looking to do is use a fragment shader to ...
aceslowman's user avatar
2 votes
1 answer
188 views

Uniform not set, despite valid location

I try to write a simple triangle mesh renderer with OpenGL. ...
Dragonseel's user avatar
  • 1,810
12 votes
2 answers
39k views

Is there any reason to prefer Direct3D over OpenGL?

So I was reading this, I sort of got the reason why there are a lot more games on Microsoft windows than on any other OS. The main issue presented was that Direct3D is preferred over OpenGL. What I ...
user avatar
5 votes
1 answer
2k views

OpenGL Instanced Rendering with Level of Detail

Problem: I'm trying to draw a scene with a lot (about 10000) of similar objects (in my case bushes, but could be anything). For each bush I have three meshes with a different number of triangles and I ...
AlbertM's user avatar
  • 153
3 votes
1 answer
5k views

Why is my fragment shader not showing any colors?

I am basically following this tutorial about diffuse lighting in OpenGL. I did some modifications but the idea is the same, at least that's what I think. However, my fragment shader is not showing any ...
BRabbit27's user avatar
  • 969
3 votes
1 answer
485 views

Incorrect values written in stencil buffer

I am trying to pick objects on mouse click. For this I have followed this tutorial, and tried to use the stencil buffer for this purpose. Inside "game" loop I am trying to draw 10 (5 pairs) 'pick'...
Sayan Pal's user avatar
  • 263
13 votes
1 answer
20k views

OpenGL GLSL - Sobel Edge Detection Filter

With respect to this topic I've successfully implemented the Sobel Edge Detection filter in GLSL. Here is the fragment shader code of the filter: ...
enne87's user avatar
  • 601
4 votes
2 answers
1k views

How to check which API's are available on a given machine?

I'm building an engine, which has Vulkan for its primary rendering engine. But to have at least some backwards compatibility with devices that don't have drivers for it (mainly mobile) I want to ...
Aaro's user avatar
  • 43
4 votes
3 answers
516 views

OpenGL Vertex - Texture Mapping

I have a mesh loaded by an obj file (wavefront), complete with normals and texture coordinates per face, and its relative texture available. In my C++ / OpenGL code (assignment for a computer graphics ...
phagio's user avatar
  • 67
11 votes
1 answer
1k views

Why do adjacent triangles never overlap when rasterized?

Apologies for the following noob question, it's just I can't find a satisfactory answer anywhere... When I render a simple axis-aligned quad made up of two triangles, I don't understand why there's ...
Reuben Scratton's user avatar
6 votes
2 answers
815 views

Open GL Shader Storage Buffer Objects to replace Vertex Attributes

At first: I already posted this on the stackoverflow community. I'm new and didn't know about this community here. I apologize. I basically got the same question as the guy who asked here: https://...
try_some_ubik's user avatar
1 vote
1 answer
801 views

Texture rendering in OpenGL

I know there are tons of questions about it, but I found nothing useful so far so, here I am. I'm trying to render a texture which is attached to a wavefront .obj mesh. I continued to fail (somehow, ...
phagio's user avatar
  • 67
65 votes
10 answers
47k views

Should new graphics programmers be learning Vulkan instead of OpenGL? [closed]

From the wiki: "the Vulkan API was initially referred to as the 'next generation OpenGL initiative' by Khrono", and that it is "a grounds-up redesign effort to unify OpenGL and OpenGL ES into one ...
galois's user avatar
  • 885
2 votes
1 answer
364 views

Chromakey Conversion

I have a program I wrote that allows chromakey (green screen) using a web cam. I wrote it using DirectShow - I created a custom filter to blend the web cam video with a graphic. It works fine but ...
001's user avatar
  • 165
1 vote
1 answer
136 views

"Anchor" vehicle to 3D path with OpenGL / SDL

As a CG assignment with OpenGL and SDL, I want to create a clone of the videogame WipeOut instead of the classical car racing game. Examples of motion in 2D have been given and are rather simple to ...
phagio's user avatar
  • 67
4 votes
0 answers
666 views

OpenGL ES vertex/fragment shaders - Blinn phong

I'm developing a simple educational project to study OpenGL ES. I'm try to render some simple OBJ models using Blinn-Phong. The first version of the of my implementation calculate all the lighting ...
Fabrizio Duroni's user avatar
0 votes
1 answer
137 views

Optimal 2D graphics resource [closed]

I am a some-what experienced programer, and I have been working on creating a 3D graphics engine utilizing the OpenGL system, primarily focused on use in games. However, I also want to do some work ...
Arden Rasmussen's user avatar
6 votes
1 answer
85 views

Why cant I use `#include` after upgrading my driver

After updating my graphics driver and trying to run this example from John Chapman's blog I got this error ...
ealiaj's user avatar
  • 161
3 votes
2 answers
167 views

Matching an HSV color with a blended color

This is hard to explain but I am going to try, then I will explain it as pure mathematics. Look at this image. So basically this is a moving line, each frame a new segment is added and the previous ...
J.Doe's user avatar
  • 1,445
10 votes
1 answer
546 views

What are sample gaps during scan conversion?

In this tutorial, It is very often the case that triangles are rendered that share edges. OpenGL offers a guarantee that, so long as the shared edge vertex positions are identical, there will be no ...
AlexWei's user avatar
  • 237
7 votes
1 answer
2k views

Generation of lower resolution textures

So I have a game and I am trying to fake glow inside of it by using the hardwares capability to downsize textures causing them to blur. The texture I wish to do this with is in a render buffer that ...
J.Doe's user avatar
  • 1,445
12 votes
2 answers
11k views

OpenGL - Detection of edges

I'd like to load arbitrary meshes and draw thick black lines along the edges to get a toon-shading like look. I managed to draw a black silhouette around the objects by using the stencil buffer. You ...
enne87's user avatar
  • 601
3 votes
1 answer
371 views

What is causing this odd scaling behavior?

OK so I have a simple setup going on. Basically I am just drawing some textures and shapes. However sizing is going weird... let me show you how any maybe you can diagnose. Basically everything is ...
J.Doe's user avatar
  • 1,445
4 votes
0 answers
1k views

Represent vector with arrow

Another code review question. I am trying to draw an arrow to represent a vector. I have started with an unit arrow with vertices defined as follows: ...
Sayan Pal's user avatar
  • 263
3 votes
0 answers
614 views

Can't render multiple VAO's?

I'm a newbie to OpenGL and I was following a series by "thebennybox" on Youtube. Specifically his series on modern opengl programming. I thought I would try to implement his Mesh wrapper using the ...
Jonathon Blow's user avatar
3 votes
1 answer
2k views

How to blend World Space Normals

I am trying to blend two world space normals inside a shader. One comes from a tangent space normal map converted into world space using a classic TBN matrix and the other one is a mesh normal map in ...
MaT's user avatar
  • 1,229