Questions tagged [opengl]

OpenGL is a graphics standard and API which targets the desktop, workstation and mobile segments. OpenGL is used for applications like CAD software and computer games. It is also cross-platform and with bindings for several programming languages. Use this tag together with the appropriate language tag for code that uses OpenGL libraries; add the 'glsl' tag for questions which include GLSL shader code.

Filter by
Sorted by
Tagged with
1 vote
2 answers
48 views

Generate vertices and normals for a flat shaded cylinder

I would like to generate list of vertices and normals (with the correct indices) for rendering a cylinder barrel (I ommited the end caps for brevity). The normals should not be interpolated (flat ...
user avatar
2 votes
2 answers
61 views

Event Dispatcher for GLFW/Glad

I've tried to write an event dispatcher for a GLFW/Glad library. However I am not very used to writing efficient code (spent the majority of my life writing in C# and performance was never really the ...
user avatar
0 votes
1 answer
31 views

Reviewing my shader class for efficient use

Im just trying to setup my shader function in a class in a way that would make me work with it easier and in a more understandable way. In Shader.h: ...
user avatar
3 votes
2 answers
267 views

Rubik's Cube rotation with OpenGL

I've been trying to make a rubik's cube project and it succeeds nicely . The only problem(or something like that) is that i need to optimize my code for easier understanding and more flexibility. Here'...
user avatar
0 votes
0 answers
45 views

"Smoothing" colors in mutliple-color gradient in fragment shader

TL;DR How to better avoid some of the colors in the gradient looking like brighter/darker lines and make them blend in with neighboring colors. Not too concerned with performance/color accuracy but ...
user avatar
  • 101
1 vote
1 answer
120 views

OpenGL mesh class and derived primitive class

Introduction After finishing most of the tutorials on https://learnopengl.com/ I started to encapsulate code in their respective classes and started to write a mesh class and a polygon class as my ...
user avatar
1 vote
2 answers
81 views

3D object in OpenGL

I made a 3D object in OpenGL. But I think my code is extremely bad and now, I want to make my code better. Here is my code: ...
user avatar
  • 117
5 votes
3 answers
111 views

OpenGL Hello Triangles

Here is my OpenGL "Hello, Triangles" program. I tried to avoid all the deprecated functions and put the triangles in a buffer. Even in two different ways. It is a bit bloated by the shader ...
user avatar
1 vote
1 answer
116 views

OpenGL Shader Loader in C++

I made my own custom OpenGL shader loader for C++. Please tell me is I'm doing anything incorrectly or anything to improve on. I've tested this and it works perfectly fine. main.cc ...
user avatar
8 votes
1 answer
138 views

tiny mandelbrot

When I first got the idea for creating a tiny mandelbrot renderer I knew It would be possible since people having creating tiny demos for a while and that I would probably use a shader. However at ...
user avatar
  • 669
4 votes
1 answer
118 views

Sweep & prune broadphase algorithm

My game engine uses the following broadphase collision detection algorithm: ...
user avatar
  • 153
1 vote
0 answers
81 views

Border Radius in OpenGL

I'm a total noob to OpenGL just following the tutorial at learnopengl.com. Anyway, I'm trying to build a GUI that involves rectangles that have border radiuses. I figured I could do this using the ...
user avatar
4 votes
1 answer
415 views

C++ wrapper class for array of OpenGL buffer objects -- just the constructors

A similar question was asked here, and I'm trying to do the same thing. But I'm trying a different approach by deriving from std::array, and This is a very focused ...
user avatar
3 votes
1 answer
1k views

OpenGL Mesh Class

I've written a simple mesh class. The purpose of it is to build a mesh, draw it to the screen, and provide some means by which the mesh can be transformed/scaled, etc. This was done with GLAD, GLFW, ...
user avatar
8 votes
2 answers
135 views

Remaking a 1998 RTS game in C++

I am remaking a very obscure old game called Rival Realms. The full source is here if you're interested. I come from a Java background so C++ is still fairly new to me. I recently performed a ...
user avatar
  • 257
9 votes
4 answers
2k views

A camera controller API for my game engine

As a hobby I am working on a game engine in order to learn C++ and graphics programming, now I have completed my first iteration of my camera system using OpengGL and GLM. Because I am mostly self ...
user avatar
9 votes
3 answers
2k views

pyopenGL OBJ loader improvements

Current OBJLoader: Using pygame's obj loader as a base, I created a new obj loader for Python OpenGL. The loader includes the following functionality: Collect vertices, normals, and texture to draw ...
user avatar
  • 191
1 vote
0 answers
36 views

OpenGL fragment shader optimization questions [closed]

My (simple) game engine has one big fragment shader for the whole scene. Right now, with multiple objects, collision detection and bloom post-processing (4 linear passes) I get frame times of ~18ms ...
user avatar
  • 153
2 votes
1 answer
269 views

Shader class in OpenGL

Im am currently wrapping all OpenGL ressources (which are simply a GLuint) into classes that own and manage the deletion of them, to make it possible to use OpenGL in an object oriented fassion. Since ...
user avatar
  • 399
7 votes
3 answers
749 views

C++/Opengl voxel renderer

I have tried going back to C++ after long time of mainly doing C#. I realize that the code is far from perfect, however I would really appreciate if someone could point of what exactly is wrong and ...
user avatar
  • 71
4 votes
0 answers
264 views

Python OpenGL snake

So I decided to dust off my Python and OpenGL knowledge and make a simple snake-like game. I will be really grateful for any critique or improvement. snake.py <...
user avatar
  • 41
5 votes
1 answer
426 views

OpenGL shader abstraction class

I have implemented a class to abstract the process of building a shader program in OpenGL (For now it does not deal with uniforms). I would like some feedback on the coding style, and more ...
user avatar
  • 490
4 votes
2 answers
71 views

Loading and drawing an image

I have some functions and structs for loading and drawing an image with OpenGL. The two main places I would like feedback are: I've tried to separate the OpenGL-specific code into the implementation ...
user avatar
  • 1,132
3 votes
0 answers
81 views

Multithreaded OpenGL Rendering Pipeline

I've decided to move my rendering code to a separate thread, to help facilitate the move I've created a pipeline system for rendering. With this pipeline I can insert commands into a queue which will ...
user avatar
  • 153
6 votes
1 answer
102 views

Per pixel Image Computation with Gamma Correction in OpenGL and C [closed]

I've been working on a way to optimize pixel computation in OpenGL with C. If this information helps, my current environtment = Linux (terminal) + GPU (Nvidia 1080Ti). I'm working with old OpenGL (...
user avatar
  • 163
7 votes
2 answers
330 views

Universal OpenGL object RAII wrapper class

I created a universal OpenGL object RAII wrapper class, that only takes care of object creation and destruction. Here's my code and reasoning behind it: I first wrote a class that would take ...
user avatar
  • 225
8 votes
1 answer
187 views

Note-drawing program

This program draws a random music note on a staff, refreshing the note every second. It compiles with g++ and also emscripten, so it is runnable in both the browser and on desktop. This is my first ...
user avatar
  • 1,132
4 votes
1 answer
1k views

C++ OpenGL - GLFW Window Abstraction

I made a GLFW window abstraction, as I find it very useful for me to make such abstractions while learning an API, and It actually pretty much eases my work while coding. Anyways, share your ...
user avatar
3 votes
1 answer
249 views

C++ OpenGL GPU resource wrapper pattern

So with OpenGL(and I'm assuming other GPU APIs) you create different buffers/programs/etc that live on the GPU and you are given a handle to them when created. For instance, if you want a buffer to ...
user avatar
  • 415
3 votes
0 answers
296 views

Using a large number of actors in one render scene with vtk python

I used vtk python examples to write this function where it produces two lines with respect to a reference point like [0, 0, 0]. This function will return an actor ...
user avatar
  • 131
1 vote
0 answers
141 views

C++ OpenGL minimal VAO example

Alright, so first, the reason I'm posting this is because I've seen so many tutorials that conflict with each other, and I would like to get this all straightened out. (Ignore the lack of shaders/mvp ...
user avatar
  • 415
3 votes
3 answers
177 views

Refining an OpenGL tutorial demo

I'm working my way through the examples in an OpenGL website; I'm now on tutorial 2 ("the first triangle"). Among the (many) things I've changed from the sample include: Replacing the hodge-podge of ...
user avatar
  • 47.8k
5 votes
1 answer
176 views

Mouse control of a camera in an OpenGL program

Introduction I'm doing an OpenGL program in C. As of now I'm working on the 3D camera system and got the control right. Now I'm working on the mouse control. It works, but I have used two different ...
user avatar
  • 153
3 votes
0 answers
614 views

Implementing Cyrus Beck algorithm for convex polygons

I have found the coordinates of the centroid for finding the direction of the normal vectors of the edges of the convex polygons. This method seems to work in the cases I tested. Is this fool proof ? ...
user avatar
8 votes
2 answers
1k views

Abstracting OpenGL shaders and uniforms into objects for ease of use

I am following an OpenGL tutorial series and it got to the point where the program needed some code abstraction. I followed the tutorial on the abstraction of VBOs, IBOs and the like and when it got ...
user avatar
6 votes
2 answers
1k views

Simple OpenGL / C++ Game Engine

I come from a C# background and recently have been trying to improve my C++ and OpenGL. I've hacked together a basic 3d engine and am looking for feedback as to how to improve it. One bit I'm most ...
user avatar
  • 111
3 votes
1 answer
261 views

2D rendering abstraction

This is a simple 2D rendering abstraction that I've been using for my game. It's basically a vector of quads. It has functions for defining quads (position, rotation, texture coordinates) and a ...
user avatar
2 votes
2 answers
142 views

C++ OpenGL Debug Utility (Completed)

So I had posted C++ OpenGL Debug Utility before to get some feedback on it, this is a more complete version of the class. (Again, looking for feedback/critiquing of any sort. {As I'm in the early ...
user avatar
  • 415
3 votes
1 answer
123 views

C++ OpenGL Debug Utility

Edit: A follow up post can be found here. So I've started a c++ project, coming from Java / C# there are many obvious differences. Below is an example of a class I've been working on: .h ...
user avatar
  • 415
1 vote
0 answers
360 views

GLSL Simplex Noise with derivatives

I recently made 2d simplex noise based coherent noise in GLSL. [Here] is the shader toy. I wanted to make an implementation of simplex noise on the gpu in order to get better performance than the CPU ...
user avatar
  • 621
3 votes
1 answer
156 views

Voxel engine to draw cubes

I am an amateur in OpenGl and for this reason I am seeking to learn only modern OpenGl the 4.x stuff. Once I had completed basic tutorials (rotating cubes, for example) I decided I would try and ...
user avatar
2 votes
1 answer
679 views

GLFW simple event handler

I wrote a simple concept of an event system in cpp. It is uses a namespace and a global state, but normally a global state with namespaces is bad practice. Is there a better way to do simple event ...
user avatar
3 votes
1 answer
3k views

Window class for a game engine

I am writing my own game engine, and I wanted to share with my own window class written in C++ using GLFW as the windowing API. Is there someone who can help me better this class? I'm not a complete ...
user avatar
5 votes
0 answers
1k views

3D FPS Camera in OpenGL

So I've got a basic FPS camera working which can move around the 3D space. Having trouble with physics but thats not why I'm here! So the code below creates a scenegraph which contains torus model ...
user avatar
  • 151
1 vote
0 answers
291 views

Golang Opengl OBJ Loader

I'm trying to get better in go by make a 3D game. (Yes, I know that's a lot of work but I'm doing it for experience and not to make a profit.) And I want to improve the loading of the OBJ Files as ...
user avatar
2 votes
1 answer
2k views

Better QOpenGLWidget by delaying GL code to initializeGL with lambda functions

When I am writing OpenGL applications with the QOpenGLWidget class, deciding what code goes into the initializeGL function has ...
user avatar
  • 103
1 vote
1 answer
639 views

Modern OpenGL shader wrapper v2

This is a fixed up version (following RAII principles) of my previous reviewal. I have moved the construction of the object entirely to the constructor to prevent any bad object states. The only ...
user avatar
2 votes
1 answer
352 views

Implementation of OpenGL context

context.h: ...
user avatar
0 votes
1 answer
165 views

OpenGL framework "SOGL"

Here is my repo, pull requests are always welcome ^^ I know that OpenGL frameworks already exists (OGLPlus, for example) but I developing another one following this set of reasons: To understand how ...
user avatar
2 votes
1 answer
1k views

Modern OpenGL wrapper abstractions (shaders)

I am experienced with other languages, but not so much with the latest C++ standards. I was wondering if anyone had any tips on how to improve my code or any critique on my implementation. This is not ...
user avatar