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.
142
questions
4
votes
2
answers
904
views
OpenGL: Freeing allocated memory
Here's a snippet of my code. I have a Button structure made up by 2 Figure structures, which contains vertices, colors and the relative VBOs and VAO.
I have a function to allocate the memory and one ...
3
votes
1
answer
111
views
C++ OpenGL Game Engine
I am currently developing a C++ OpenGL game engine to help myself learn computer graphics and game design later on. However, this project is becoming really big, and I am unsure if I am making the ...
3
votes
0
answers
102
views
Modern OpenGL Context that doesn't rely on CRT
I'm working on a personal OpenGL project. I want my project to not rely on any libraries including CRT.
I have absolutely no experience in shipping software and I want to prepare my code for release.
...
1
vote
1
answer
135
views
Basic GLSL fragment shader with palette lookups and palette shift
I am remaking an old game, which animates water by rotating its palettes over time.
I have written a basic fragment shader to replicate this behavior. It checks which color we are trying to render, ...
1
vote
2
answers
181
views
OpenGL: Rendering the same sprite several times
I've been trying to make refactor really simple 2d sprite engine in OpenGL. As a start, I'm trying to use instanced rendering to render several copies of the same sprite in a square formation across ...
2
votes
1
answer
259
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
...
1
vote
0
answers
139
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 ...
2
votes
2
answers
877
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 ...
1
vote
2
answers
73
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
306
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
75
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
1k
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'...
1
vote
1
answer
408
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
275
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:
...
5
votes
3
answers
244
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 ...
1
vote
1
answer
445
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
161
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 ...
4
votes
1
answer
354
views
Sweep & prune broadphase algorithm
My game engine uses the following broadphase collision detection algorithm:
...
1
vote
0
answers
251
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
578
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
3k
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
184
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 ...
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
3k
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
...
2
votes
1
answer
507
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 ...
7
votes
3
answers
916
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 ...
5
votes
1
answer
727
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 ...
4
votes
2
answers
94
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 ...
3
votes
0
answers
114
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 ...
6
votes
1
answer
143
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 (...
7
votes
2
answers
670
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 ...
8
votes
1
answer
209
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 ...
6
votes
1
answer
2k
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
330
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 ...
3
votes
0
answers
533
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 ...
3
votes
3
answers
221
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 ...
5
votes
1
answer
322
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 ...
3
votes
0
answers
772
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
2k
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
2k
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 ...
3
votes
1
answer
319
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
168
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 ...
3
votes
1
answer
152
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
...
3
votes
1
answer
224
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 ...
3
votes
1
answer
4k
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 ...
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 ...
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 ...
1
vote
1
answer
709
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 ...
2
votes
1
answer
391
views
Implementation of OpenGL context
context.h:
...
0
votes
1
answer
202
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 ...