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

1
vote
0answers
146 views

Point light shadowmapping woes [closed]

I'm doing point light shadow mapping and I'm tearing my hair out trying to iron out a bug. The problem is shadows are basically "inverted" somehow, or wierdly placed. Here's five screenshots; you ...
0
votes
1answer
98 views

Deferred lighting and point light volumes

I'm doing deferred point light shadow mapping and I am drawing my point lights using light volumes. Normally I access the position/diffuse texture/normals using this in the fragment shaders: vec2 ...
3
votes
1answer
186 views

What is the maximum number of shaders I can have in OpenGL 4?

What is the maximum limit of shaders I can have on the GPU? With 1000 different objects, I might have 1000 * 5 shaders (vertex, tcs, tes, geo, frag) on the GPU at a time. Though only one will be ...
0
votes
1answer
105 views

WebGL wrong scaling of rectangle

I'm working with this tutorial http://www.html5rocks.com/en/tutorials/webgl/webgl_transforms/ and my result is, that the rectangle moves in the direction of it's scaling values, and also scales at ...
2
votes
1answer
154 views

Use different values for Depth Test and Depth Write in OpenGL

Is there a way to use something similar to PolygonOffset to make a depth test more permissive (move fragment depth towards eye) but still write the original depth value to the depth buffer? The only ...
1
vote
1answer
103 views

Techniques for managing vertex buffer memory

I'm learning OpenGL and I haven't seen any advice on managing vertex buffers in all of the tutorials I've read. The basic problem is that I have some memory allocated as a buffer B in which I'm going ...
4
votes
1answer
109 views

OpenGL - What steps to take to correctly set up an Uniform Block Array

I have managed to get uniform blocks to work, but I seem to make something wrong when trying to setup an array of uniform blocks. Assume this glsl: layout(std140, binding=1) uniform LightingBlock ...
2
votes
2answers
105 views

OpenGL - How to draw each nth triangle using glVertexAttribPointer

I have a vertex buffer. There are situations when I don't want to render the whole mesh, but let's say each nth triangle of the mesh. I am using VAOs and VBOs. My data in the buffer is like this: ...
0
votes
2answers
94 views

Achieving a fixed frame-rate with varying scenes

I am working on an OpenGL 3D model viewer app for iOS. I have to load, view and navigate extra detailled 3D models on an iPad. I hardly achieve 2 fps, if i load and navigate a very complex model. I ...
0
votes
1answer
136 views

Pixel Buffer Object (PBO) does not work correctly

I've written a very simple OpenGL application. Its goal is to load a texture and draw it on a plane using a PBO. If I use the function 'glTexSubImage2D' the plane is not textured and the function ...
2
votes
1answer
124 views

How I reuse the same vertex data, but have different colors, for my sphere objects?

I'm using OpenGL to display a 3D network, with nodes represented as spheres (I haven't gotten to edges yet). I'm a total novice, and having a bit of trouble wrapping my head around OpenGL. These ...
3
votes
1answer
176 views

How to achieve cavalier projection using OpenGL fixed pipeline?

I want to make a quick demo program showing a cube, or a user loaded model, rotating in screen rendered with one of three projections: perspective, isometric and cavalier. Using the fixed pipeline, ...
-1
votes
2answers
183 views

How to translate along Z axis in OpenTK

I am playing around with an OpenGL sample application I downloaded for Xamarin-Android. The sample application produces a rotating colored cube I would simply like to edit it so that the rotating cube ...
0
votes
3answers
104 views

Using same buffer for vertex and index data?

Is it possible to use the same buffer for both GL_ARRAY_BUFFER and GL_ELEMENT_ARRAY_BUFFER? I load both vertex data and index data into a big slab of memory, so it would be easier for me to just load ...
0
votes
2answers
505 views

openGL Camera setup for Zoom in/out centered at point under cursor

I am trying to implement a zoom in/out navigation mode in a openGL 3dViewer. I was able to implement zoom functionality centered at screen center just by moving eye towards the center in perspective ...
0
votes
0answers
25 views

opengl output to texture with 4 levels of depth

i'm building a game where transparency is important. I can live with being restricted to four levels of depth and my current plan is to do two passes: 1. render everything to a texture using ...
0
votes
1answer
196 views

Optimizations using GLSL shaders

I have written a simple OpenGL application using GLSL shaders. Actually, my program just displays a simple cube with a phong lighting effect like below : Here's a peace of the client code : ...
1
vote
4answers
264 views

Are VBOs only for OpenGL 3.x?

Are VBOs only for OpenGL 3.x? I'm using immediate mode and I know it's bad, slow, and deprecated. But then I looked at display lists but they are deprecated too. I guess the VBO is the only one left ...
0
votes
1answer
75 views

Jagged text + additive blend in openGL

I am having some trouble understanding how openGL blend modes work. At first I was using glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) and it all looked fine except that I couldn't use any ...
1
vote
1answer
147 views

What should I do when a VBO becomes too large in OpenGL?

Currently I have one buffer for my vertex data and one buffer for normals data. I fill them and then pass them to OpenGL for rendering. The problem is when I load too large mesh file like "Lucy" from ...
4
votes
1answer
380 views

OpenGL glDisable(GL_TEXTURE_2D) vs glBindTexture(GL_TEXTURE_2D,0)

I would like to ask which one of the glDisable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D,0) is better to use after I finished my texture rendering. Is there any difference performance-wise?
2
votes
1answer
640 views

Deferred Rendering With Diffuse,Specular, and Normal maps

I have been reading up on deferred rendering and I am trying to implement a renderer using the Sponza atrium model, which can be found here, as my sandbox.Note I am also using OpenGL 3.3 and GLSL. I ...
0
votes
0answers
59 views

How to create a 2D overlay over a 3D game? (LWJGL/OpenGL) [duplicate]

GameDev! I would like to create a 2D overlay over a 3D world, using LWJGL (Java version of OpenGL), to show information to the player, for example, a chat box, health bar, selected cannonball type, ...
1
vote
1answer
220 views

Shadow map: depth texture always returns 0

I'm implementing a shadow map for the sun light in my voxel engine using a depth texture attached to a framebuffer. But when I sample the depth texture during the normal pass, the value returned is ...
0
votes
0answers
57 views

Diffuse Mapping in a Game

I want to figure out the diffuse maps of some rusted objects that I plan to render in my game arena. I have taken the images of some sample objects and have also scanned them for a model of the ...
0
votes
1answer
118 views

why is glVertexAttribDivisor crashing?

I am trying to render some trees with instancing. This is rather weird, but before sleeping yesterday night, I checked the code, and it was in a running state, when I got up this morning, it is ...
1
vote
1answer
41 views

vertex is bending inwards

I am trying to draw a picket fence, but the center of the picket vertex looks bent in the middle, why is the picket bending inwards to the left? // draw fence pickets float a; for (a=-25; a<=25; ...
12
votes
6answers
791 views

Seamless tilemap rendering (borderless adjacent images)

I have a 2D game engine that draws tilemaps by drawing tiles from a tileset image. Because by default OpenGL can only wrap the entire texture (GL_REPEAT), and not just part of it, each tile is split ...
1
vote
0answers
78 views

Text alignment in OpenGL with FreeType2

I'm trying to implement font rendering and have got into some trouble with glyph metrics. Here's the code where I get the metrics: Glyph gl; gl.width = face->glyph->metrics.width / 64; ...
2
votes
1answer
140 views

How do I check why is no output on screen?

I'm using OpenGL 3.3+, and I'm trying to create an orthographic projection to draw on screen. I have the model data in a buffer: X Y 0, 0 50, 100 100, 0 And I create my Model-View-Projection ...
1
vote
0answers
106 views

What's the best way to set up an OpenGL draw loop in windows?

On mac os x, there's a way to pass the system a function pointer that is triggered at an ideal time to start your drawing code. These are the CVDisplayLink tools. I'd like to understand how to do ...
1
vote
1answer
111 views

Gamma Space and Linear Space with Shader

I am using Unity and I can choose between two color space mode in the settings: Gamma or Linear Space. I am trying to build a Custom Lighting Surface shader but I am facing some problems with those ...
1
vote
0answers
74 views

Converting signed normalized integer to unsigned normalized integer image format

Given I have my texture data in client memory as signed normalized integers. I want the samples in the shader in the range [0,1]. Can I simply specify: format = GL_RGBA; internalFormat = GL_RGBA8; ...
1
vote
1answer
287 views

gl_VertexID values when calling glDrawElements

I am struggling a bit to understand the values that gl_VertexID primitive contains when the vertex shader is executed. I have the standard modern rendering pipeline, in which after setting up ...
0
votes
0answers
214 views

Adding 2d hud/gui to a 3d game engine which has no 2d features

I have been following the 3d game engine tutorial series made by theBennyBox for a few months now, and have finally decided to create a game with it. My problem is that it is a 3d only engine which ...
20
votes
5answers
6k views

Why is an engine like Unity3D emphasized over a native library like OpenGL for beginners?

I am just a beginner in 3D games, my preferred platform is Android. I posted a question in some other forum about "What to use: OpenGL or Unity3d?" They all emphasized Unity3D and using its built-in ...
3
votes
1answer
115 views

Using textureGrad for anisotropic integration approximation

I'm trying to develop a real time rendering method using real time acquired envmap (cubemap) for lightning. This implies that my envmap can change as often as every frame and I therefore cannot use ...
0
votes
1answer
144 views

App using LWJGL can't find display mode extension on Linux

I'm running LWJGL app on Ubuntu virtual machine with no phisical graphic card. I set up Xvfb and Mesa3D but it fails with exception java.lang.ExceptionInInitializerError: null at ...
3
votes
2answers
175 views

OpenGL - Index buffers problem

I have a custom file format that has all the needed information for a 3D mesh (exported from 3ds Max). I've extracted the data for vertices, vertex indices and normals. I pass to OpenGL the vertex ...
0
votes
2answers
521 views

GLSL: can i use matrix transformation functions in vertex shader?

I have a working OpenGL code where i render a terrain with some trees. I am doing all the matrix mathematics on the client side. Because of which the frame rate of my app is very low, around 25-30 ...
0
votes
1answer
89 views

Camera rotation around point, but without centering

Let's say i have the following: Point somewhere in space Camera with position and orientation (up, right, forward) I want to rotate camera around the point, but also keep this point in same place ...
4
votes
1answer
468 views

How to efficiently render a large terrain mesh?

Recently I've been stuck on a problem thinking about the best way to generate a terrain into my game. In another projects I normally used heightmaps, so all the core-work was based on the engine used, ...
2
votes
1answer
124 views

Drawing symmetric equilateral triangles

I'm rendering equilateral triangles of different sizes and I'm having trouble making them symmetric along the vertical axis. Here I have rendered two triangles. The triangle on the left (rendered ...
0
votes
0answers
64 views

Bounding box center after transformation - want degree values for GUI

Similar to my previous question, I have a bounding box that I have transformed and scaled. Now, I want to get its center by doing this operation and store this value. bbCenter = glm::vec3(bbMin_x + ...
0
votes
1answer
65 views

Providing texture coordinates and using indexed drawing at the same time

Please consider the following vertex structure struct vertex { vec3 posL, normalL; }; Using this vertex layout, we can provide the vertex data in an interleaved way, i.e. ...
1
vote
2answers
350 views

glGenVertexArrays causes crash

My code keeps crashing at runtime, I have done some creative debugging and determined that it was the glGenVertexArrays that was causing the crash, I've looked around and come across some answers that ...
1
vote
1answer
170 views

Most efficient way of brighten and darken sprites with OpenGL > 2.0

So I have been shading (brighten/darken +adding color) my sprites by using glTexEnvf with GL_MODULATE and GL_ADD and a vertex color. I only had to rebind the batch every time I needed to change from ...
2
votes
1answer
523 views

How do I fit the camera frustum inside directional light space?

I'm trying to improve the coverage of a shadow map for a directional light. Currently, it works great if the camera is looking straight down. However, if the camera is close to the ground and looking ...
0
votes
0answers
51 views

Focus a turntable style camera on an object

I have a turntable style camera in the maya / blender / alembic / opensubdiv example. I want to be able to match the camera translation to any objects translation pivot point in the scene and then ...
0
votes
0answers
37 views

Keeping relative size with different resolution

I'm making a GUI system and want the components having a konstant relative size, even if I'm changing the resolution. Since I'm using the relative OpenGL coordinates to place them, there is no ...