OpenGL texture is not rendered if it is active

I was using QOpenGLWidget to render textured triangle, the code was looking good but the triangle was always rendering black i had problem with it for two days until i accidentally found out what the title says. This is the code, the texture gets loa

Texture sampler IDs do not match texture units

I'm attempting to use 3 textures on a model. I'm loading the images using SOIL and binding them to texture units 1, 2, and 3. But for some reason when I bind samplers 1, 2, and 3 to my shader, 1 produces the image bound to GL_TEXTURE2 while 2 and 3 p

Where objects created when passing parameters must be deleted?

I have something like this: class GLSLShader { public: GLSLShader(GLenum); ~GLSLShader(); }; class GLSLProgram { public: GLSLProgram(GLSLShader *, GLSLShader *); ~GLSLProgram(); private: GLSLShader *m_VertexShader; GLSLShader *m_FragmentShader; }; GL

Animate a scene using OpenGL 3 in C

I am creating an small animation film using OpenGL 3 and implementing it in visual studio community 2015. I am trying to make an animation of a dinosaur moving to the right at least in the first but I cannot make it animate somehow. Here is my main:

From ArrayFire to OpenGL on AMD?

Is it possible to go from ArrayFire to OpenGL and back using an AMD graphics card? There is an article on how to do it using CUDA. Any hints on using a similar method for OpenCL, so it can be used cross-platform? Update What I would like to do in the

Weird OpenGL Vertex Shader problem

Before I start my question, a little bit of background. I started learning OpenGL not so long ago, and I have learned most of what I know about it here. I have only really gotten past 2 tutorials, and yes, I know I will eventually have to learn about

Get initialization of the base class constructor, a bad habit?

I have a base class in an OpenGL project which represents 3DModel in general. Now I want to create a more specialized class that will inherits from 3DModel. My problem is the mandatory base class constructor call in the initialization list. Is there

How to save an image of a screen using JOGL

I have Swing frame and some sprites drawn on it. I need to save this 2D scene as an image using JOGL but every tutorial I managed to find seems to be obsolete. I'm using JOGL 2.1.5.using Screenshot: BufferedImage image = Screenshot.readToBufferedImag

Mix lightmap with diffuse texture

I'm using c++, opengl 4.0 and glsh shader language. I'm wondering how to correctly blend diffuse texture with lightmap texture. Let's assume that we have a room. Every object has diffuse texture and lightmap. In every forum like or stacko

Problems with GLEW with Visual Studios

I have tried several ways to get GLEW working with my VS2010 project. No success. At first I tried using the pre-built libs and dlls from the website. I downloaded these pre-built files from and did something li

Should I calculate matrices on the GPU or on the CPU?

Should I prefer to calculate matrices on the CPU or GPU? Let's say I have the following matrices P * V * M , should I calculate them on the CPU so that I can send the final matrix to the GPU (GLSL) or should I send those three matrices separately to

Create an application on Mac OS X using C ++? (without cocoa)

It seems that in Xcode 4 there is no longer a way to create an application that is not limited to the command line using C or C++. I would like to do so, however Glut seems to be one of the only frameworks available for mac that works with C++ and Op

Quick comparison of two images using OpenGL or DirectX

I need to compare 2 pictures and find pixels that are different with specified threshold. Now I'm doing it just programmatically in for loop, it take about 3 seconds for small 600x400 picture. I'm wondering if there a way to do it faster using OpenGL

OpenGL saves objects for later design

I'm making a program using openGL with transparent objects in it, so obviously I have to paint those last. Unfortunately I was unaware of this requirement when beginning this project and now it would be a real pain to reorder it painting those at las

How to tell the font size in pixels when rendered with openGL

I'm working on the editor for Bitfighter, where we use the default OpenGL stroked font. We generally render the text with a linewidth of 2, but this makes smaller fonts less readable. What I'd like to do is detect when the fontsize will fall below so

opengl video texture ffmpeg

I'm trying to render frames grabbed and converted from a video using ffmpeg to an OpenGL texture to be put on a quad. I've pretty much exhausted google and not found an answer, well I've found answers but none of them seem to have worked. Basically,

What happened with opengl? What kind of nightmare is it now?

I used opengl 2 years ago. In one afternoon I read a tuto, I drew a cube (and then learned how to load any 3d model) and learned home to move the camera around with the mouse. It was easy, less than 100 lines of codes. I didnt get the pipeline comple

Delete 'quad' in openGL

im creating a game, my character shoots a bullet, and is going to collide with an enemy, which is drawn like this in display(); glPushMatrix(); glTranslatef(260, -180, 0.0); e[0] = new Platform(0, 0, 0, 40, 40, 40, 40, 0, textures[17], 260, -180); gl

What rendering engine for a browser?

I'm actually doing a little browser which should be able to parse some code, display a GUI (mainly based on svg elements) and let the user interact with it. Which renderer should I use to paint the GUI? Probably in the future this browser will need 3

Reminder to the non-static method

Think of your basic GLUT programs. They simply run from a main method and contain callbacks like `glutMouseFunc(MouseButton) where MouseButton is the name of a method. What I have done is I have encapsulated the main file into a class, so that MouseB

Overlay on an application in full 3D screen

I want to display some custom graphics on top of a 3rd party fullscreen Windows application. Have you played any Steam games? It has an executable, GameOverlayUI.exe that lets you access Steam windows from within a game. (The GUI elements look custom