Click here to Skip to main content
15,886,567 members
Everything / Multimedia / OpenGL

OpenGL

OpenGL

Great Reads

by Carlos Jiménez de Parga
A reusable Visual C++ framework for real-time volumetric cloud rendering, animation and morphing
by Petrov Vladimir
Former NeHe OpenGL Lessons adapted to MSVS-15 pro MFC in INICODE and the samples of the Joystick implementation
by Vasily Tserekh
A simple 3D exploration of a plaza in OpenGL and C#
by logicchild
An article that explains how to use this library

Latest Articles

by gabriel4sonic
Shows how to use OpenGL in a .NET WPF application by directly incorporating an OpenGL window as a child of the main WPF window, making it behave more like a control
by ColleagueRiley
A multi-platform single-header very simple-to-use framework library for creating GUI Libraries or simple GUI programs.
by EgorYusov
This article introduces Diligent Engine, a modern cross-platform graphics API abstraction library and rendering framework
by EgorYusov
This article describes Unity low-level plugin interface and the Unity graphics interface emulator that facilitates native plugin development.

All Articles

Sort by Updated

OpenGL 

1 Mar 2024 by gabriel4sonic
Shows how to use OpenGL in a .NET WPF application by directly incorporating an OpenGL window as a child of the main WPF window, making it behave more like a control
25 Feb 2024 by ColleagueRiley
A multi-platform single-header very simple-to-use framework library for creating GUI Libraries or simple GUI programs.
8 Jan 2024 by Maxim Kartavenkov
You can see an answer from your error message text: Exception thrown at 0x00000000 in Application.exe: 0xC0000005: Access violation executing location 0x00000000. This means that your code call something at the address of 0x00000000. So...
4 Jan 2024 by Rick York
This is rather odd. Mostly because I have worked extensively with OpenGL and this is something I have never found necessary to do. You might have better success in finding out what the errors were and fixing them. I wrote this function a while...
4 Jan 2024 by P. Mehroof Abid
When I call while (glGetError() != GL_NO_ERROR); it gives the following exception: Exception thrown at 0x00000000 in Application.exe: 0xC0000005: Access violation executing location 0x00000000. And my error checking code is like this: ...
24 Oct 2023 by samas69420
I have a window made with win32 API and inside this window, there is a smaller window in which another thread draws images using opengl. I removed the default frame and painted the visible portion of the big window so I can use it as a custom...
18 Aug 2023 by EgorYusov
This article introduces Diligent Engine, a modern cross-platform graphics API abstraction library and rendering framework
7 Aug 2023 by Sona from kerala
I want to draw a filled rectangle in vC6 using OPENGL..pls help me with this
12 Jul 2023 by EgorYusov
This article describes Unity low-level plugin interface and the Unity graphics interface emulator that facilitates native plugin development.
20 Apr 2023 by huguidesr
I've been trying to draw a bitmap int array using glTexImage2D, but it only outputs white nothingness. It outputs jumbled messy pixels from out of bounds memory if I initialize the int aray as a char array instead, but it only renders whiteness...
20 Apr 2023 by Rick York
I don't have an answer for you but here are a few sample projects you might get a hint from : 50 OpenGL Win32 Projects in One[^] 50 OpenGL MFC Projects in One[^] Your Own Quadrics in OpenGL MFC[^]
17 Apr 2023 by Chillzy
So I went onto a different forum and I asked this question, and somebody helped me solve it. It turns out that the coordinates for the octahedron were wrong. The problematic ones were top-north-east and bottom-south-east. I'll give a list of the...
17 Apr 2023 by Chillzy
I'm working on a program where I need to make spheres. My chosen method is to create an octahedron https://i.stack.imgur.com/xHpcm.png[^] and through tessellation shaders, subdividing it and then normalizing the coordinates into an octa sphere...
6 Apr 2023 by KarstenK
This clearly looks that you missed to draw one part. Most common reasons are: a) you draw it on the wrong position or b) ferget to draw it c) draw with clear color float vertices[] = { //top-north-east 0.0f, -1.0f, 0.0f, // is...
17 Dec 2022 by Steffen Ploetz
High-end quality in text rendering concerns not only the characters, but also the character spaces - and here FreeType is not quite up to date anymore: The kerning used by FreeType is not always available (especially with newer fonts).
5 Nov 2022 by Steffen Ploetz
My way to have a first sample program running with "Texus' Graphical User Interface" (TGUI) - a cross-platform modern C++ immediate GUI, on which I use "Simple and Fast Multimedia Library" (SFML) as backend.
26 Oct 2022 by Shao Voon Wong
H264/HEVC Video Encoder for recording OpenGL rendering
11 Sep 2022 by sorauts
The following code successfully renders an image using an absolute path; unsigned int renderer_id; std::string filepath; unsigned char* local_buffer; int width; int height; int bpp; std::string...
11 Sep 2022 by Rick York
You are missing some steps, at least in the code you have posted. Take a look at the call that maps the image into OpenGL : glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, local_buffer); You need to make...
6 Sep 2022 by EgorYusov
An implementation of a basic path tracer with Diligent Engine
27 Aug 2022 by ShahadBattar
I'm using C++ openGL and I need my window size to remain constant.I've used the following function to disable the maximize button:void toggleGlutWindowMaximizeBox(char *szWindowTitle){ long dwStyle; HWND hwndGlut; hwndGlut = FindWindow(NULL, szWindowTitle); dwStyle...
27 Aug 2022 by Member 3203938
Process Non-Client HitTest Add ON_WM_NCHITTEST() to MessageMap LRESULT OnNcHitTest(CPoint point) { LRESULT oHitItem= __super::OnNcHitTest(point); if(oHitItem >= HTSIZEFIRST && oHitItem
14 Jun 2022 by MARLON LESUEUR
So I am learning opengl and am doing a tutorial but everytime I run my code my triangle comes out as white instead of the rgba value I set in the fragment shader. if there is anything else wrong with the code it would be helpful if you could...
26 May 2022 by HMonty
Hi everyone, I´m learning OpenGL with c++ from a series of tutorials where they explain how to do that, currently I'm in the mouse detection section but I have some questions. They use the SDL library to do that but I'm using GLUT because it...
6 May 2022 by Petrov Vladimir
Masking Texture in OpenGL from Bitmap Image File using Class CImage (just call the File Name)
3 Apr 2022 by Carlos Jiménez de Parga
A reusable Visual C++ framework for real-time volumetric cloud rendering, animation and morphing
22 Nov 2021 by jason lyman
I'm having trouble drawing stuff to the screen instead I just see the gui instead #include "imgui.h" #include "imgui_impl_glut.h" #include "imgui_impl_opengl2.h" #ifdef __APPLE__ #include #else #include...
18 Nov 2021 by candijen
I am beginner in Opengl. All my objects get the same texture. I want them to have three different textures, wood.jpg and Green.jpg and cookie.jpg. What can I do to fix this. This is in my code. Mesh cube; Mesh Fence; Mesh GM; ...
17 Nov 2021 by Rick York
I believe the problem is you are calling glGenTextures(3, texture); three times. That should be called only once. glBindTexture should still be called for each texture.
4 Oct 2021 by OriginalGriff
As Richard says, posting this here isn't the right place - there are 15,049,311 members here, all of whom are allowed to submit articles for moderation before publication and the chances of the specific article's author seeing this question are...
4 Oct 2021 by Member 14172998
Santhosh G, I've seen your post "Pixel Shader for Edge Detection and Cartoon Effect" and I find it very useful. A question regarding use of the example code. Can I use modified parts of it (shader code) in my commercial product (adding credits...
4 Oct 2021 by Richard MacCutchan
If you have a question about an article then please use the forum at the end of the article, so the author gets notified. The chances of them happening to see this question are not high.
17 Aug 2021 by Richard MacCutchan
See Getting Support — osgEarth 3.1 documentation[^]
5 Aug 2021 by sujay jay
#include #include #include #include #include void display(); void GoMenu(int value); void fish1(); void fish2(); void fish4(); void land(); void sea(); void sky(); void water(); void man(); void...
5 Aug 2021 by merano99
I had no Idea what freeglut is doing, but i used a freeglut_staticd.lib and asked the Debugger what is going on when pressing a Button. The window procedure for handling Win32 events in freeglut is a callback funtion fgPlatformWindowProc()...
9 Jun 2021 by Rageh11111
// C program to illustrate OpenGL game #include #include #include #define pi 3.142857 int c = 0, d = 0, left = 0, right = 0; int m = 0, j = 1, flag1 = 0, l = 1, flag2 = 0, n = 0, score = 0, count = 1; void myInit...
6 Jun 2021 by OriginalGriff
Do you have any idea how much work explaining code line by line is? Every single line needs a paragraph of explanation! For example: int next = r.Next(); Create a new variable called "next" which can hold a integer value. From...
24 May 2021 by peanutpig
i want draw a model BoundingBox in osgearth,but position is not suitable osg::ComputeBoundsVisitor boundVisitor; node->accept(boundVisitor); osg::BoundingBox boundingBox = boundVisitor.getBoundingBox(); osg::Matrixd...
16 May 2021 by Steffen Ploetz
Creation of a basic X3DOM editor based on OpenGL with as little code as possible, that is running on ReactOS and Windows, to check out the capabilities of X3DOM.
10 May 2021 by Steffen Ploetz
Check whether ReactOS is able to run OpenGL, determine a convincing IDE and get started with the OpenGL on ReactOS.
4 May 2021 by Rakshith P 2021
story.txt - Google Drive[^] What I have tried: i tried to change the 62 bit to 32bit but didnt work and also tried to debug it in the bin and still didnt work
16 Apr 2021 by Steffen Ploetz
Basic light source approaches and related material properties handling for OpenGL
23 Mar 2021 by Ally Terna
I am trying to make a cube in my OpenGL project. My code for some reason is not rendering and I have no idea why. Even though nothing draws, I am not getting any errors or warnings. All I see is a blank screen, but no cube. How do make the cube...
9 Mar 2021 by Steffen Ploetz
Box, cylinder, cone and sphere construction for OpenGL with texture and light effects
27 Feb 2021 by Southmountain
This post sheds some light on all WGL functions(wiggle functions) in OpenGL extension for Microsoft Windows system
4 Feb 2021 by RickZeeland
See answer here: c++ - OpenGL Rotation - Stack Overflow[^]
1 Feb 2021 by Member 15062255
in Unity for generating a quad we need to define triangles and vertices how to define a quad in pyglet as I do in unity What I have tried: I'm just starting out in pyglet
1 Feb 2021 by Richard MacCutchan
Start by consulting the pyglet Documentation — pyglet v1.5.11[^].
21 Jan 2021 by Divin Ookken Athappan
Step by step explanation of 3D image rendering using OpenGL
18 Jan 2021 by Jon
A high level library allowing quick and easy creation of Vulkan samples
3 Dec 2020 by gxzid
how draw like this [^] What I have tried: how draw like this
3 Dec 2020 by Rick York
Here's a sample for you : Getting Started With OpenGL[^]
3 Dec 2020 by OriginalGriff
Two things: 1) Don't use link shorteners - it makes you look like a spammer or a troll as you have no idea what you will find at the other end. I checked this one using a sandbox before I let it through. 2) While we are more than willing to help...
19 Nov 2020 by Paolo Mazzon
Good day, I'm trying to configure visual studio code well to learn Opengl I use Glad and GLFW libraries this is the project that works in Xcode but I hate Xcode and I want to make it go to Visual studio Code. Git: ...
19 Nov 2020 by Rick York
It appears to me that the module containing MyClassShader is not being compiled or it is not part of the link process. Another possibility is you have not implemented its constructor and its use and setFloat methods.
13 Nov 2020 by Member 12224804
I want to make a 3d space with Stereographic camera not perspective on web-based software or application using C#. the 3d space need to rotate zoom and pan the camera is fixed in the center and offcource fixed particles and draw lines as...
26 Oct 2020 by Roullakis
I'm trying to get Stencil Test to work using SharpGL. The following simplified example does not work. It should have displayed only section of the second rectangle, however it displays the entire rectangle. Any help would be much appreciated. ...
24 Sep 2020 by Member 14772350
Getting started with Volume Rendering using OpenGL[^] What I have tried: Hello everyone in the link at the top the volume display at gray level I want to display it with color by the application of the transfer function but I do not know how I...
24 Sep 2020 by Richard MacCutchan
You should post the question in the forum at the end of the article, so the author can help you.
23 Sep 2020 by EgorYusov
Introduction to amplification and mesh shaders, the new programmable stages available in modern GPUs, and how to use them to implement view frustum culling and object LOD selection on the GPU using the Diligent Engine API
7 Sep 2020 by VD-Flash
Here is the solution to your problem. I was experiencing the same problem as you when I first used FreeGLUT. First confirm that you have a OpenGL32 and FreeGLUT library. If you are using MinGW then these should be located in the lib directory...
7 Sep 2020 by Rick York
If you know how to load a file and make a usable texture from it then you are almost all the way there. To access a texture resource, call LoadBitmap. From there, follow similar steps to what you did with the file's texture. Both methods...
7 Sep 2020 by VD-Flash
Hello readers. Here I am with another problem. I learnt Win32 and OpenGL programming. I found that bitmaps can be stored in resource scripts for easy and quick access. I also know how to create a texture in OpenGL by loading an image from a file....
7 Sep 2020 by KarstenK
Normally frameworks are working and you have some bug or misuse in your code, like missed initialization or connecting to your objects or structures. Tip: try some example code from the framework and insert your code
7 Sep 2020 by Richard MacCutchan
It would help if you posted your query in the proper forum: Bugs and Suggestions[^], and provided a link to the page and exact details of what you mean by "not working".
30 Jul 2020 by SADEGH2077
This code is for TO OPENGL 4.6 Not responsive please help Visual Studio cli c++
30 May 2020 by Member 14816523
Hi, I am working on the OpenGL Application. which can open and read multiple video file frames. so, in output is can play three different videos at the same time without async frames rendering. what are odds get the sync frames rendering? After...
13 May 2020 by Askar Azhibaev
Calculating the pi number faster using a simple formula
22 Apr 2020 by Member 14810494
I know that this response is over 3 years removed form the original posting, but I ran across this posting while researching and wanted to offer a response. I've experienced this type of undefined reference before. It can happen when one is...
22 Apr 2020 by Member 13013288
I'm a student working with OpenGL in C++. I'm trying to get freeGLUT to work with MinGW. I'm asking because I've already tried a ton of sites, multiple times and there is no clear solution, at least to my knowledge. I've had this problem for months.Although using Visual Studio would be the...
30 Mar 2020 by Vasily Tserekh
A simple straightforward car race game with minimum LOC.
30 Mar 2020 by Vasily Tserekh
Collision algorithms aren't rocket science and this article proves this idea.
27 Mar 2020 by 99dc
Best answer - uses WPF instead of OpenGL but shows basic principles and actual code Medical image visualization using WPF[^]
8 Mar 2020 by Richard MacCutchan
So a five year old comment is probably no longer relevant. I would suggest going to OpenGL - The Industry Standard for High Performance Graphics[^], and checking the current information.
8 Mar 2020 by Vaclav_
I own few years old "OpenGL Programming guide" book and have played with OpenGL - in Windows. I need a refresh course, so I found this ( 5 years old article !) An Introduction to OpenGL Programming | Linux Journal[^] One of the comments ,...
3 Mar 2020 by 8BITDEVreal
so i am new to lwjgl and am i messing with making a 3d game with so i was learning about shaders and i followed the tutorial and i got this error message 0(1) : error C0000: syntax error, unexpected $undefined, expecting "::" at token "#" 0(5)...
3 Mar 2020 by 8BITDEVreal
i figured it It don't seem to support #version anymore and in and out are also invalid so i found it was just a error with my shader code as i am following a tutorial series a couple years old my new vertexShader: precision highp float; void...
2 Mar 2020 by Richard MacCutchan
You need to check the documentation for the correct syntax for your code, and the error messages. As this is a specialised library, you will most likely get a faster response at the LWJGL Forum - Index[^].
30 Jan 2020 by Roman Sedaikin
SpaceVIL is a cross-platform and multilingual framework for creating GUI client applications for .NET Framework, .NET Core and JVM. This article discusses the SpaceVIL framework, its capabilities and a brief story of its creation.
29 Dec 2019 by OriginalGriff
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you. So we need you to do the...
16 Dec 2019 by Rick York
No, one should not call main from anywhere. It is the designated entry point for CLI programs. For GUI programs in windows the entry point is WinMain. This is a bit confusing. How is it you have a button in a window with a CLI program? If you want to learn how to use OpenGL in a WinForms...
16 Dec 2019 by SIDHARTH S
Is it possible to call the function int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(500, 500); glutInitWindowPosition(100, 100); glutCreateWindow("Window"); glutDisplayFunc(display); ...
15 Nov 2019 by Michael Adaixo
Loading textures - exploring multi-threading in C++
18 Jul 2019 by lock&_lock
I need to perform pixel manipulation from images in glut OpenGL (I know it's old, but I'm bound by many other reasons). I need to change the image several times while showing them at the same time as well. I'm trying to use key event to perform that. Also, I'm using SOIL library to load my...
18 Jul 2019 by Rick York
The only thing your event handler does is load an image. What handles display of the image? Usually, when you load an image you have to invalidate the display window so that it is redrawn. I see no code that does that so that is probably what you lack to make it work.
15 Jul 2019 by Stefan_Lang
This is just a guess, as the code is too long to fully analyze, but judging by your problem description this is just a corner case, and there is a piece of code in Ray::cast() that is likely to cause issues in corner cases: const float den = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);...
15 Jul 2019 by Member 14074655
Hi, I' m pretty new to C++ and OpenGL and was coding a C++ OpenGL version of the 2d Raycasting Challenge from the Coding Train YouTube channel(ep.145). The entire thing seems to work well except for one thing. In the project whenever the 0 deg ray (the ray which points directly to the right)...
1 Jul 2019 by Stefan_Lang
On top of what Carlo said in solution 1, there are two more issues: Quote: return x == 0 || x == width || y == 0 || y == height; Never compare floating point variables using == or != . These values are prone to subtle variations due to rounding effects, and therefore a direct comparison will...
1 Jul 2019 by Member 14074655
Hello I'm pretty new to C++ and am trying to simulate natural selection, similar to this video - https://www.youtube.com/watch?v=0ZGbIKd0XrM . I'm trying to add random movement in my game through random angles and moving speed amount of distance to that angle. However in the case of the code...
1 Jul 2019 by CPallini
The root of the problem is this piece of code: Quote: if(angleOfSense==-1) aom = LO + static_cast (rand()) /( static_cast (RAND_MAX/(HI-LO))); else aom = angleOfSense; It computes a random angle only the first time it executes (when angleOfSense is equal to its...
25 Jun 2019 by MaximilianW
OpenGL rendering to WPF window
14 Jun 2019 by KarstenK
You should optimize your code. Like adding all meshes to a vector isnt a good idea. What about having an array of structs with a single mesh and shader. This would reduce looping times. And you should draw each mesh in a single step, but start the render engine once and draw ALL meshes. ...
14 Jun 2019 by Member 14131869
I am working on a graphics engine in c++ and DirectX 11. While importing scenes (using Assimp) I have to render multiple meshes with separate shaders. I do this by the following method I have an std::vector to store shaders and another one for meshes. After I open the file I add all the meshes...
14 May 2019 by Member 9641602
I tried to continously decrease the sphere radius using a loop, but it does not seem to work.The animation for increasing sphere size is working fine. Not able to understand why decreasing radius is not rendered. I request anyone to share any sample code that can help to smoothly animate the...
14 May 2019 by CPallini
You are assigning double values to the int variable r (and apparently ignoring compiler warnings...).
10 May 2019 by Member 14074655
I'm trying to make a color picker tool using OpenGL, and have made a reasonable demo. When I click a color it uses the glReadPixels function to find the color. This does work however it also takes the color of the background when I click on the background. Is there a way to see if I clicked on...
10 May 2019 by phil.o
Have you tried some basic examples on how to handle mouse in opengl? opengl click handler[^]
14 Apr 2019 by Martin Vorbrodt
3D Engine, from GLUT to GLFW
13 Apr 2019 by CPallini
Quote: so I guess the problem is in my lookup table function. How do I correctly do this ? I find nothing wrong with your scaling table. Of course you have to initilialize it (calling scaling) before calling makeshift. Note you are assigning a float to an unsigned char. I believe your compiled...