1
vote
1answer
46 views

Using depth texture for depth testing

I was wondering if it is possible to render my scene onto a depth texture then using that texture for depth testing in another pass. I have an idea to that in shaders, but is that possible ...
0
votes
0answers
28 views

Problems with drawing billboards [on hold]

I am currently trying to draw billboards and some geometry with "modern opengl approach". Problem is that I cannot force billboards to keep their positions in space. I need to link text positions ...
0
votes
0answers
61 views

Gaussian blur not working correctly

So pretty much I tried to add a gaussian blur to something I am making and it is acting oddly. The setup is like: [All framebuffers are cleared to rgba(0,0,0,0), normal blend enabled] Draw some solid ...
-1
votes
0answers
13 views

cocos2d-x simple shader usage [closed]

I want to obtain color ramp effect from this tutorial: http://www.raywenderlich.com/10862/how-to-create-cool-effects-with-custom-shaders-in-opengl-es-2-0-and-cocos2d-2-x Here is my code in cocos2d-x ...
0
votes
1answer
48 views

Proper way to encapsulate a Shader into different modules

I am planning to build a Shader system which can be accessed through different components/modules in C++. Each component has its own functionality like transform-relevated stuff (handle the MVP ...
0
votes
0answers
12 views

OpenGL textures trigger error 1281 if SFML is not called

I am using SOIL to apply textures to VBOs, without textures i could change the background and display black (default color) vbos easily, but now with textures, openGL is giving an error 1281, the ...
1
vote
1answer
42 views

Problems with texture orientation in space

I am currently drawing texture in 3D space and have some problems with it's orientation. I'd like me textures always to be oriented with front face to user. My desirable result looks like ...
1
vote
0answers
58 views

OpenGL - Cascaded shadow mapping - Texture lookup

I'm trying to implement cascaded shadow mapping in my engine, but I'm somewhat stuck at the last step. For testing purposes I've made sure all cascades encompass my entire scene. The result is ...
0
votes
1answer
22 views

Rendering a mesh in image viewport

I have a mesh made of nearly half to a one million vertices. I also have some 6-DoF camera poses around this mesh. At these poses I'd like to find out which of the 3D points of this mesh get projected ...
2
votes
2answers
108 views

Water silhouette shader using GLSL

I have this problem to solve using Cocos2d-x 3.x: In my game there is water represented by rectangle texture, modified by the code on the go. I also have a character moving around, rotating etc. I ...
0
votes
0answers
19 views

Shader | Special Effect - Unit selection [duplicate]

I would like to know how the shaders used to show which unit is selected are made. Here is an image to illustrate. How the merge effect of the blue circles can be achieved ? I didn't found any ...
0
votes
0answers
71 views

OpenGL shading doesn't work with different projection and view matrices?

I found an online (public-domain) code to do marching cubes, and I am trying to adapt this code to work in my own project. The code uses GLUT and "older-style" OpenGL, whereas I am using GLM and ...
0
votes
0answers
35 views

Barycentric vertex coordinates in GLES 2.0

I have a certain set of polygons, which are stored in a vertex buffer and an index buffer. The polygons are textureless and normalless. The polygons are dynamic, their buffers get constantly emptied ...
1
vote
2answers
123 views

GLSL to Cg: why is the effect different?

With reference to this question, where I was trying to make the shader compile, I am now trying to make an effect appear. The effect can be shown here, through a GLSL shader: But when I use the ...
2
votes
2answers
61 views

Palette reduction to pre-defined palette

I'm writing a bunch of GLSL effects for fun, but I can't wrap my head around this. Basically, I want to reduce a texture's palette into a pre-defined set of colors. For example, a post-processing ...
0
votes
1answer
72 views

Skybox: OpenGL texCUBE vs a textured cube

In OpenGL, the typical way that I've seen to set up a skybox using cubemapping is to create a cube in camera space, prepare a cubemap sampler with the appropriate six-sided texture, and then in the ...
8
votes
1answer
108 views

How can I profile the speed of my vertex and fragment shaders separately?

I'd like to know how I can check to see if either my vertex or my fragment shader is a bottleneck in my rendering pipeline. I've read about using glQueryCounter with the GL_TIMESTAMP target to get ...
1
vote
2answers
91 views

Bad pixels on shader when loading cached binary programs

I have been trying to cache binary shader programs in my game and load them accordingly using "glGetProgramBinaryOES" and "glProgramBinaryOES" respectively. I was successfully able to cache and load ...
7
votes
1answer
142 views

Slow uniform array in shader causing FPS drop

I'm trying to use an uniform array of matrices in my compute shader. However, it's really slow. I've narrowed it down to this lines of code: uniform mat4 someMatrixArray[64]; ... vec4 result = ...
1
vote
2answers
72 views

Accessing uniform variables from a Cg shader in OpenGL

I am trying to implement a simple PC program with OpenGL, using mandatorily Cg shaders (no Unity whatsoever). I have found some tips on this page http://bobobobo.wordpress.com/2008/10/05/cg-1/ and ...
-1
votes
1answer
76 views

Combine Two Shader Program [closed]

For my android application, I want to apply brightness and contrast shader on same image. At present I am using gpuimage plugin. In that I found two separate program for brightness and contrast as ...
0
votes
1answer
106 views

What is wrong with my specular phong shading

I'm sorry if this should be placed on stackoverflow instead however seeing as this is graphics related I was hoping you guys could help me: I'm attempting to write a phong shader and currently working ...
1
vote
1answer
49 views

Depth Map resolution shifting

the problem is with shadow mapping as you can see, actually it works fine but in a certain condition that the Depth Map size must be equal to the size of rendering buffer, I use an infinite ...
2
votes
1answer
161 views

draw fog of war using shaders

I am making a RTS game, and I'd like some advice on how to best render fog of wars, given what I'm already doing. You can imagine this game as being a classic RTS like Age of Empires 2, where the fog ...
1
vote
1answer
134 views

Render 2 images that uses different shaders

Based on the giawa/nehe tutorials, how can I render 2 images with different shaders. I'm pretty new to OpenGl and shaders so I'm not completely sure whats happening in my code, but I think the shaders ...
0
votes
1answer
117 views

Calculating Per Vertex Normal in Geometry Shader

I am able to calculate normals per face in my Geometry Shader but i want to calculate per vertex normal for smooth shading. My Geometry shader is #version 430 core layout ( triangles ) in; layout ( ...
3
votes
1answer
161 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
0answers
24 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
157 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 : ...
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 ...
1
vote
1answer
84 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
1answer
181 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
2answers
360 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 ...
1
vote
1answer
138 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
116 views

Possible to create transparency shader which doesn't stack alpha values

The image above best demonstrates what I'm trying to achieve. It's a transparent shader for objects, but wherever the objects with this shader intersect they don't add together but simply merge with ...
1
vote
1answer
150 views

OpenGL and atlas

I'm trying to draw element from a texture atlas with OpenGL ES 2. Currently, I'm drawing my elements using something like that in the shader: uniform mat4 uCamera; uniform mat4 uModel; attribute ...
1
vote
1answer
67 views

How to create more vertexes from within a shader in OpenGL?

when rendering voxels in octrees, the only information necessary is the current octree-level, -position and colour/texture. But one has to send eight vertices to the rendering pipeline in order to ...
0
votes
0answers
74 views

Finding the correct transformation in vertex shader for easy sprite drawing

Before we begin the question: Here are the necessary meta information: I want to use JOGL / OpenGL to create a library that is only, and I repeat only, able to draw and manipulate 2D sprites on a 2D ...
1
vote
0answers
269 views

Normal mapping does not work correctly using GLSL and OpenGL [closed]

Hello I wrote a simple OpenGl program using GLSL to render a simple uv mapped plane using the normal mapping technics. Here's the display with a simple phong shading (without normal mapping) : Now ...
5
votes
3answers
376 views

How do I send multiple matrices to a vertex shader?

I'm practising animations using bones/skinning. I am trying to send the shader one matrix per vertex. I can think of these two approaches. Method 1 I have one uniform handle for each bone matrix ...
0
votes
0answers
67 views

Minimum/maximum depth of tile in OpenGL

I'm trying to implement tiled deferred rendering, but I'm stuck on calculating the min/max depth for each tile. I'm using compute shader for this. This is my shader code: #version 430 #define ...
2
votes
1answer
126 views

How to work with smaller intermediate textures in OpenGL and GLSL?

I'm working on a project rendering water simulated through smoothed-particle hydrodynamics (SPH) with a non-photorealistic look to use in games. In the actual stage of the project everything about ...
0
votes
1answer
107 views

Strange behaviour using VAO (OpenGL 4.0)

I want to display a simple textured Monkey mesh using VAO. Here's the code in the render part first without VAO to see what is the result I'm looking for. Texture *pTexture = ...
0
votes
1answer
148 views

translate-scroll repeated 2d texture using opengl shader

I managed to implement an infinite 2d texture scrolling using the following shader. btw I'm using cocos2d-x 2.2.1. The vertex shader: attribute vec4 a_position; attribute vec2 a_texCoord; #ifdef ...
0
votes
0answers
107 views

How to fix problem in serpentine case using Blinn/Loop algorithm

I'm trying to implement Blinn/Loop algorithm to render cubic bezier on shader. I calculate the curve type using code below (v0, v1, v2, v3 are cubic bezier segment): CurveType ...
1
vote
0answers
217 views

Shadow mapping implementation not working? [closed]

I am trying to implement Shadow Mapping in my program using Java/LWJGL/OpenGL/GLSL, but I cannot get it to work properly. Let's start off with a screenshot first, then the relevant code and lastly ...
0
votes
1answer
155 views

Textures not displaying. Problem with fragment and vertex shaders

Hi i have newbe question. I am sending to gpu textures unit and they dont display. This is simple version of my fragment and vertexshader. (More complicated version also dont work with other textures ...
1
vote
1answer
101 views

recommended shader pipeline infrastructure in core opengl 3.3

I am writing a game project in Go and I am using an OpenGl 3.3 core context to do my rendering stuff. At the moment I have different types of renderers. Each renderer has it's own pair of vertex- and ...
0
votes
2answers
176 views

How to mix pixel colors in Shader?

I have a pixel that have a colour RGB. This color is calculated by the shader and can be anything. How can I override this color by a colour I choose. If my pixel is white it's simple, I can do this: ...
0
votes
1answer
344 views

Simple curiosity about glDrawElements function

I've written a very simple OpenGL program displaying a white cube. To do the job done I recovered vertex position and indice data from an OBJ file that describes my cube. Here's the OBJ file content : ...