OpenGL is a graphics standard and API which targets the desktop and workstation markets. It is designed to be easy to accelerate with dedicated computer hardware, and hence most implementations give greatly improved performance over traditional software rendering. Currently, OpenGL is used for ...

learn more… | top users | synonyms

2
votes
1answer
86 views

When should a VBO be unbind or not?

Searching about VAOs and VBOs I read here and here that I can optionally unbind them to avoid accidental modification so I gave it a try. The problem is that unbinding the VBO causes an access ...
2
votes
0answers
130 views

How to “hot-reload” a glsl shader

I am wondering if its possible to dynamically change shaders while the code is running. In my game, I want to have a development mode in which users can change the shader source and dynamically see ...
2
votes
0answers
26 views

OpenGL cubemap binding

I'm experimenting a strange behaviour of textures inside my shaders. Basically I need and bind two cubemap textures inside my shader but only one gets actually bound. I've tried swapping the two ...
3
votes
1answer
156 views

Trying to implement forward rendering in OpenGL

I'm working on implementing forward rendering in my 2D engine, as far as I'm aware everything should be set up correctly, I've ran into some issues earlier but I'm sure I've fixed those at this point. ...
3
votes
1answer
59 views

OpenGL cube map is always black

When creating and rendering a skybox with a cube map texture, the skybox is black. Here is how I create the cube map texture: GLuint loadCubemap(std::vector<std::string> faces) { GLuint ...
2
votes
1answer
95 views

Translation Matrix not working properly

Hello, I get this result when i try to scale and then translate a vec4 in my shader. I created a mat4x4 class on my own and some functions wich return some matrices for me, everything works, but not ...
1
vote
0answers
60 views

Implement gpu based dynamic geometry lod with openGL

I'm currently working on my own game and for that I wanted to implement LOD, to boost the performance. I found a very nice tutorial on the internet: http://rastergrid.com/blog/2010/10/gpu-based-...
6
votes
1answer
165 views

How to find out at runtime if Vulkan and/or OpenGL support is available?

I'm building an engine, which has Vulkan for its primary rendering engine. But to have at least some backwards compatibility with devices that don't get drivers for (Mainly mobile) it I want to ...
3
votes
1answer
65 views

OpenglGL Render two scenes with one draw call

I need to draw a normal-vector scene and default scene. I could achieve this my having two programs with different fragment shader to produce the following images. It will require me to draw ...
1
vote
1answer
45 views

How to “port” Java2D code to LWJGL

I've been following some game tutorials on youtube and developed a custom engine using Java (Graphics2D, BufferStrategy and such). I have a class "Surface", which represents any 2D object (image, ...
2
votes
1answer
67 views

OpenGL GLSL using projection,view and transformation

I have been trying to get a simple triangle to render on the screen but an unable to using the Projection, View and Transformation Matrix's but an unable to get anything to the screen. Main loop ... ...
2
votes
1answer
88 views

OpenGL 2D instancing: glDrawArraysInstanced with a divisor renders nothing

I've been learning OpenGL for the past week, following tutorials here and there. I was looking to create a SpriteBatch-type of solution for 2D rendering, and for it I thought of utilizing instanced ...
2
votes
0answers
52 views

What happens to Buffer data that isn't used?

I have a vertex struct that has 5 glm::vec3 but some of my objects only use 2 or 3 of those members. So I have two questions : 1.) What happens to the large buffer I create, even though I don't use ...
0
votes
0answers
26 views

2D Camera in LWJGL 3

I am trying to implement a simple 2D camera in LWJGL3. The camera has an orthographic projection and can move in 2D space. This is run once at game start-up: GL11.glMatrixMode(GL11.GL_PROJECTION)...
1
vote
1answer
44 views

Specular Light not working (Phong Lighting)

There seems to be a problem with my current Phong Shading implementation. I have been using the per fragment approach. The specular highlight aspect of the technique is not rendering as it should, as ...
-1
votes
2answers
124 views

What is the most efficient way to render water?

Would I create the water surface mesh in C++, and control the movement/animation in the CPU, and afterward apply any shaders (reflect/refraction/caustics/etc..). Or should I only create the mesh in C++...
1
vote
1answer
27 views

LWJGL version problems

Is it possible to create VAO's while my computer doesn't support openGL 3.0 or higher? I managed to create a vertex buffer object and draw a rectangle. But then I changed my lwjgl libraries to the ...
0
votes
1answer
63 views

drawing of heightmap gives weird single pixels

I'm working on a game where I want to generate a heightmap, however it draws a bunch of random white dots in a mostly black background, the function I have looks as following: void heightmap::layer1(...
0
votes
1answer
34 views

Texture Wrapping isn't being applied properly

I've debugged my application with codeXL and can verify that my texture is getting these attributes applied: GL_TEXTURE_MIN_FILTER: GL_LINEAR GL_TEXTURE_MAG_FILTER: GL_LINEAR GL_TEXTURE_WRAP_S: ...
1
vote
2answers
64 views

Why is my depth buffer texture so bright?

https://www.youtube.com/watch?v=QuvAEqgHrMY&feature=youtu.be https://www.youtube.com/watch?v=5ob1JsPIGAs&feature=youtu.be gluPerspective(60, (float)CONTEXT_WIDTH / CONTEXT_HEIGHT, 0.1f, 1.f);...
1
vote
1answer
23 views

Texture Wrapping isn't getting applied to my object

I have a Drawable Class, a Cube Class, and a Texture class. I feel like the texture wrapping isn't being applied due to some values being passed by reference, or just being discarded. My cube just ...
1
vote
1answer
71 views

Full Engine or Not: C++ Programmer Trying to get into Game Development [closed]

I'm a fairly experienced programmer, and I want to try out doing some game development. However, I am unsure of whether or not to use a full engine like Unity or just start with something like OpenGL. ...
3
votes
1answer
37 views

Optimizing black and white matrix block drawing

Disclaimer: I am uncertain if this is the best place to post this question, so please advise me of how I can best find the answer if I am doing something wrong. I am asking this question because I am ...
0
votes
1answer
77 views

Loading non-skeletal animation to opengl via assimp

I'm a newbie in assimp and openGL. I'm trying to import .fbx or .dae formatted file to openGL via assimp. Importing skeletal animation was kind of easy. Lots of introductions and sample projects ...
4
votes
0answers
135 views

How to correctly implement 'layered lighting' with Box2D-Lights

How does one only allow Box2D-Lights to affect one and only one OrthographicCamera. After researching, I found the following answer. This answer goes into detail about how to prevent one camera from ...
2
votes
0answers
103 views

Texture Mapping to procedurally generated geometry

How can I calculate texture coordinates of such geometry? The angle shown in the image (89.90 degree) may vary, therefore the geometry figure is changing and is not always such uniform.(maybe like ...
1
vote
1answer
65 views

glViewport and single-pass cubemap rendering

This question is related to another question of mine on StackOverflow. The problem I'm facing is that while I'm rendering to a cubemap in a single pass using a geometry shader (like I show in my ...
1
vote
3answers
88 views

Process of writing to the depth texture

In openGL, let's say I output one single point from the vertex shader with this value gl_Position = vec4(2.0,3.0,5.0,7.0); what exact math operations happen to "z" after leaving the vertex shader? ...
3
votes
0answers
57 views

I get weird perspective using GLM where the depth is flipped. Please help

The depth is rendered wrong and I can't figure out why. using namespace std; using namespace glm; int width = 640; int height = 480; float aspect = (float)width/height; int fps = 60; void start(){ ...
0
votes
0answers
31 views

Position camera in opengl

I have a camera with a 3D vector that represent the position and a quaternion that represent the camera orientation. I'm trying to rotate and orientate the camera correctly, but I can't. I know that ...
6
votes
1answer
179 views

OpenGL flat shading of non-planar polygons using TBOs

I'm trying to implement flat shading for non-planar polygons (using a single normal vector per polygon) based on buffer textures, but I can't seem to figure out how to set up things correctly. The ...
0
votes
1answer
43 views

Making a button that spawn objects in the world? [closed]

I want to make a button that can spawn an object that I've already created. Though I have no clue how to actually do this / where to start. Has anyone ever done something similar?
0
votes
1answer
45 views

Some OpenGL code not working, but some is

I'm just starting out using GLEW and GLFW in a C++ project for my rendering code, but I'm having trouble actually getting anything to render. I know OpenGL is working in some capacity, because I am ...
1
vote
0answers
47 views

How to create a second Window in OpenGL/GLFW

I would like to have 2 windows. 1 for display purposes and one for settings / buttons (for example to change the color of the background in my main display). How would I go about having a second ...
0
votes
3answers
73 views

I have my mouse coords converted to world coords. Now how do I detect objects with it? (C++, OpenGL, FreeGlut)

I found a way to convert my mouse coordinates to world coordinates that I can easily understand but now I need to know how to use it to check if the mouse is currently over any of my rendered objects. ...
0
votes
0answers
26 views

OpenGL ES vertex/fragment shaders - Blinn phong

I'm developing a simple educational project to study OpenGL ES. I'm try to render some simple OBJ models using Blinn-Phong. The first version of the of my implementation calculate all the lighting ...
1
vote
2answers
45 views

glViewport offset and ortho projection

In all tutorials I found about creating projection matrix based on viewport size all of them assumed that left bottom coordinates of viewport will be (0,0). Now I want to draw to the different parts ...
1
vote
0answers
91 views

Rendering thousands of circles in pyopengl

I am interested in rendering animated 2D vector graphics in python using PyOpenGL. As an initial test, I am trying to render thousands of pixel-perfect circles drawn using shaders. Here is the current ...
0
votes
1answer
60 views

Lighting in Minecraft/Block-esque worlds [duplicate]

Chaps, I'm sure we all know at a high level how Minecraft's lighting engine works. Light sources flood surrounding blocks with light, which themselves flood their neighbors and so forth. However, I ...
4
votes
2answers
120 views

Creating a custom mouse cursor with LWJGL2 in Java

I have been trying to create a custom mouse cursor in my LWJGL2 application running under Linux and I am almost there. I have implemented the following method that I call right after creating the game ...
1
vote
1answer
37 views

Handling light bounding volume

So, i managed to do deferred shading like yesterday or 2 days ago. I got pretty big impact which causes my fps to drop from 1000fps to around 300~fps for 25 lights (after some optimization, i don't ...
1
vote
1answer
58 views

How to enable depth test with QOpenGLWidget? It renders black screen

Currently I am writing a small application with Qt and OpenGl and I choosed QOpenGLWidget for rendering graphics. That's how I declared my widget: class GLWidget : public QOpenGLWidget, protected ...
0
votes
1answer
56 views

Project camera-to-pixel ray in world coordinates

I'm trying to implement a very simple ray tracing function but I have a problem with projecting the camera ray (from camera to pixel) to the world space. In the screen coordinates have the pixel ...
2
votes
1answer
52 views

texelFetch weird behavior

I am writing an isometric game engine on OpenGL (version 3.3 specifically). For each wall tileset i have volume mask tileset for the wall relative volume coordinates. Volume mask looks like this: ...
1
vote
2answers
41 views

Should I use one GLSurfaceView.Renderer for each part of my game?

I am creating a small platformer-like game for Android using OpenGL. The game has 3 main screens/states: Main menu screen Level selection screen The game screen Currently I use a GLSurfaceView....
4
votes
0answers
51 views

Environment mapping without cubemap (need coordinates projection)

I'm working on a project with C++ and glsl (4.1). I have implemented a mirror object which is a plane at height 0 that works as follow: I render the scene with a MVP computed such that the camera ...
1
vote
1answer
56 views

glGenBuffers is NULL

I'm using GLEW 1.13.0, (GLUT), SDL2 and OpenGL 3.3 core. #include <GL/glew.h> #include <GL/glut.h> int main(int argc, char* args[]){ Engine::init(); // Initializes SDL_GL_* attributes ...
0
votes
0answers
22 views

What ways can I draw a single pixel or single fragment with Modern OpenGL? [duplicate]

I've been researching around the internet looking for ways to plot a single fragment or single pixel which ever is more usable for the case I will present now: I want to plot a pixel every click of ...
3
votes
1answer
158 views

When should i use GL_TRUE or GL_FALSE values?

When using GLboolean, should i just use true and false or should i use GL_TRUE and GL_FALSE, when should i prefer using GL_TRUE and GL_FALSE? or maybe i shouldn't care at all (Because both works)? ...
1
vote
1answer
73 views

Rendering issues in Monogame when using shaders

I am currently fiddling with Monogame, trying to work with Shaders and I have encountered a really weird issue. If the first ever draw in the application's lifetime is with a custom shader all further ...