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
2 votes
1 answer
77 views

Shader Program OpenGL

I am new to OpenGL learning it on amazing website learnopengl.com I wanted to a convenient way to use shader programs thats why I created this struct, please review it. ShaderProgram.h ...
2 votes
0 answers
35 views

Single header geometric mesh library in C

I'm writing a simple physics and rendering demo for my senior capstone class, using GLFW, OpenGL, and GLM. I decided to begin writing a simple geometric mesh creation library in C to make meshes ...
1 vote
0 answers
34 views

An OpenGL backend for displaying a framebuffer of an emulator

Motivation I'm making an emulator. It has its own software framebuffer of size 320x240. Each frame is prepared internally from the emulator, and I just need a way to display it on a window, scaled to ...
  • 421
1 vote
2 answers
173 views

Basic OpenGL application that renders multiple cubes on a textured plane, setup for a 3D game

I'm learning OpenGL and started work on a small 3D game (like Sokoban) for practice. I want to know if the design of my OpenGL code reflects a good understanding of the technology. For example, one ...
  • 11
1 vote
2 answers
64 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 ...
2 votes
2 answers
104 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 ...
0 votes
1 answer
37 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: ...
3 votes
2 answers
480 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'...
0 votes
0 answers
81 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 ...
  • 101
1 vote
1 answer
183 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 ...
1 vote
2 answers
110 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: ...
  • 117
5 votes
3 answers
136 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
182 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 ...
8 votes
1 answer
146 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 ...
  • 669
4 votes
1 answer
156 views

Sweep & prune broadphase algorithm

My game engine uses the following broadphase collision detection algorithm: ...
  • 153
1 vote
0 answers
121 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 ...
4 votes
1 answer
457 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 ...
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, ...
8 votes
2 answers
147 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 ...
  • 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 ...
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 ...
  • 191
1 vote
0 answers
41 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 ...
  • 153
2 votes
1 answer
338 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 ...
  • 399
7 votes
3 answers
805 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 ...
  • 71
4 votes
0 answers
298 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 <...
  • 41
5 votes
1 answer
501 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 ...
  • 490
4 votes
2 answers
74 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 ...
  • 1,132
3 votes
0 answers
93 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 ...
  • 153
6 votes
1 answer
107 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 (...
  • 163
7 votes
2 answers
413 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 ...
  • 225
8 votes
1 answer
191 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 ...
  • 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 ...
3 votes
1 answer
275 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 ...
  • 425
3 votes
0 answers
351 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 ...
  • 131
1 vote
0 answers
170 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 ...
  • 425
3 votes
3 answers
186 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 ...
  • 54.4k
5 votes
1 answer
234 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 ...
  • 153
3 votes
0 answers
677 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 ? ...
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 ...
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 ...
  • 111
3 votes
1 answer
279 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 ...
2 votes
2 answers
148 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 ...
  • 425
3 votes
1 answer
128 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 ...
  • 425
1 vote
0 answers
404 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 ...
  • 611
3 votes
1 answer
184 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 ...
2 votes
1 answer
744 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 ...
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
2k 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 ...
  • 151
1 vote
0 answers
321 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 ...
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 ...
  • 103