-1
votes
0answers
49 views

Render To Texture Using OpenGL is not working but normal rendering works just fine [on hold]

DISCLAIMER: THERE IS A BIT OF CODE BECAUSE I ALREADY KNEW THE DIFFERENT QUESTIONS PEOPLE WOULD ASK example: "how did you make your shader attachments" "what was your order of rendering to the ...
1
vote
0answers
65 views

implementing shadows into my 2D GLSL-based lighting system

I'm writing a lighting system in OPENGL using GLSL shaders, and I'm pretty happy with the light casting I have so far, but I'm totally stuck on casting shadows. Everything I've found online on this ...
1
vote
2answers
119 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 ...
0
votes
0answers
115 views

Problem when using two different shaders

I have created a simple shader for drawing my scene in OpenGL. When another shader was introduced, a problem appeared. I use the first shader and draw few objects in the scene. Then I use the second ...
1
vote
0answers
60 views

Different way to pass uniforms to seperate draws in glMultiDrawElementsIndirect

Given OpenGL version 4.3 and GLSL 430, what would be the best way to pass a matrix to each model in a draw call to glMultiDrawElementsIndirect? I am thinking of going the way of a TBO and indexing it ...
0
votes
1answer
84 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
votes
1answer
74 views

Unity's pack 4 floats

Linked to: GLSL pack floats into an RGBA texture I found EncodeFloatRGBA/DecodeFloatRGBA shader functions in Unity https://gist.github.com/hecomi/9580605 Now I try to figure out how they work. So I ...
1
vote
1answer
93 views

In glsl, how do indices work?

I have made a vertex shader and fragment shader and kind of know how they work, and I know that you specify what index you want your vertices to be in inside the shader program. So if the vertex was ...
2
votes
1answer
123 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
102 views

why is my OpenGL texture transparent?

I have a terrain in OpenGL, and two textures which I am combining using GLSL mix() function. Here are the textures I am using. Now I am able to combine and mix these two textures, but for some ...
2
votes
0answers
265 views

Help with 2D sprite instancing [closed]

Alright, so I'm pretty new to OpenGL programming. I've been writing my own engine, initially using the fixed function pipeline. I then did a 1:1 replacement of the fixed-function methods with shaders ...
1
vote
2answers
393 views

OpenGL position from depth is wrong

My engine is currently implemented using a deferred rendering technique, and today I decided to change it up a bit. First I was storing 5 textures as so: DEPTH24_STENCIL8 - Depth and stencil ...
0
votes
1answer
522 views

GLSL billboard move center of rotation

I have successfully set up a billboard shader that works, it can take in a quad and rotate it so it always points toward the screen. I am using this vertex-shader: void main(){ vec4 tmpPos = (MVP * ...
4
votes
3answers
1k views

Implementing skeletal animation and GPU skinning (DOOM MD5)

DISCLAIMER This question has been completely rewritten to narrow the scope of the question in light of previous suggestions and answers, but the same problem still persists. Currently I'm trying to ...
4
votes
1answer
370 views

OpenGL FBO not being drawn to

In my project I'm trying to implement a deferred rendering system, problem is, I can't seem to get a second FBO to work. UPDATE 1 Here is the FBO initialization code: /// G-Buffer FBO GLuint ...
6
votes
1answer
617 views

How would one draw many objects using the same VBO

I'm kind of stuck with this question for some time now, maybe because I don't know exactly what to search for, it might be a term I have not heard of yet as most tutorials ends after drawing one ...
-1
votes
0answers
97 views

Normal mapping and translation, lighting not displaying correctly

I got a normal mapping issue. I have a texture and a normal texture on each model loaded via the ASSIMP library. I am calculating the tangent vectors on each object with the help of the ASSIMP ...
3
votes
1answer
2k views

Skyboxes using glsl Version 330

So I am trying to get a skybox working with OpenGL 3.3 and glsl Version 330. After scouring the web for a while, I could not find a completely modern OGL skybox tutorial anywhere, so I found an older ...
0
votes
1answer
183 views

VBO in a class doesn't draw when The class has a destructor

I am making this class QuadTemplate class QuadTemplate { public: QuadTemplate() { vbo=0; uvbuffer=0; vao=0; TextureID=0; vboType=0; ...
3
votes
2answers
2k views

Rotating an object when the center in not the origin - opengl

I'm beginning with GLSL and I learning the basic, I am using glm to do the matrix calculations at this point everthing ok,the problem is how I can move the origin to the center of my object, not the ...
0
votes
0answers
270 views

GLSL gl_ModelViewMatrix breaks my code?

So I have the following shaders which work (to the extent that they are completed anyway). //Vertex Shader uniform float offset; void main() { gl_TexCoord[0].t = gl_MultiTexCoord0.t; ...
-1
votes
1answer
159 views

OpenGL shader problem

So, I've been working on this game engine for a while now, and just the other day my friend tried running the program and his output doesn't match my output... My Program Output: His Program ...
4
votes
1answer
883 views

variable number of lights in a glsl shader?

I want to render an arbitrary number of lights in my fragment shader. I do not understand how you can properly pass them into the shader though. For example, I want something like this: uniform int ...
2
votes
1answer
1k views

glsl 150 struct in uniform buffer object

Can I do this in opengl 3.2 / glsl 150? glsl shader: struct LightSource { vec4 ambient; vec4 diffuse; vec4 specular; vec4 position; vec4 direction; }; ... layout(std140) uniform ...
2
votes
1answer
139 views

Fragments never falling into spot light's cone

I am using GLSL version 1.20 with OpenGL 2.1 . I am trying to compute when a fragment falls into the area of a spot light. I have already set all the light values with glLightfv and glLightf, also ...
2
votes
0answers
829 views

2D water shader in SFML

I want to implement the algorithm for a 2D water surface described here and here. Before somebody finds out, beats me up and deletes this, I'm gonna say it myself. I posted this question over at ...
0
votes
1answer
172 views

OpenGL RTT FrameBuffer question and Rendering to texture while sampling it

What i need to do: Blur the selected texture and pass the texture to another effect for postprocessing. Notice that i want one texture passed all over. How do i want to do this: Bind the FBO ( ...
2
votes
1answer
172 views

Shadow cubemapping?

I am working on a game with C++ and OpenGL 3.2. I have successfully implemented directional shadow maps and now I'd like to upgrade them to shadow cube maps (for point lights). I've done some Googling ...
0
votes
1answer
431 views

OpenGLES GLSL Shader attributes always bound to 0

So I have a very simple vertex shader as follows #version 120 attribute vec3 position; attribute vec3 inColor; uniform mat4 mvp; varying vec3 fragColor; void main(void){ fragColor = inColor; ...
3
votes
2answers
1k views

Learning OpenGL GLSL - VAO buffer problems?

I've just started digging through OpenGL and GLSL, and now stumbled on something I can't get my head around this one!? I've stepped back to loading a simple cube and using a simple shader on it, but ...
5
votes
3answers
602 views

Finding out what pixel on the screen the fragment falls on

In my 2D game, I render tiles. I want to do lighting without needing an extra buffer the size of the screen. Either in glsl or hlsl, what could I feed to the shader each time I render a bitmap so ...
1
vote
0answers
250 views

Full screen shader causes performance hit

I basically want to have a shader run that can do something like toon shading, or grayscale the whole screen, or radial lighting. To do this, I create a new bitmap each time the display resizes that ...
1
vote
3answers
524 views

Shaders not linking correctly

I'm writing a rather simple "ShaderManager" which aids me with loading shaders in Open GL, altough I am having a few issues: The shaders don't link correctly The the attributes don't bind Here's ...
2
votes
2answers
539 views

Lighting problems with Terrain

I'm in the process of learning Open GL and am having issues with lighting on my Terrian, I don't know if the issue is related to how I calculate my normals or the shader itself (I am using the shader ...
4
votes
1answer
2k views

Proper way to do texture mapping in modern OpenGL?

I'm trying to do texture mapping using OpenGL 3.3 and GLSL 150. The problem is the texture shows but has this weird flicker I can show a video here. My texcords are in a vertex array. I have my ...
1
vote
1answer
777 views

glsl applying shader

I want to use a shader just for learning purposes. But i have a few questions about it. I have the following code: Vertext shader: const float Eta = 0.66; // Ratio of indices of refraction ...
2
votes
4answers
510 views

What is a right datatype in C++ for OpenGL scene representation with use of GLSL

I am programming in C++ OpenGl with GLSL. Until now I have been using a data structure that is composed of std::vector filled with structures of vertexes and with their parameters (position , normal, ...
6
votes
4answers
1k views

Spell Effects/Shaders

I want to be able to achieve spell effects that cause a fragmenting/discoloring effect on the sprite. The first couple seconds of this video http://www.youtube.com/watch?v=HNCFh7mkvuc shows what I ...
6
votes
2answers
911 views

Casting a shadow over a whole scene with GLSL in 2D?

I'm making a (non-isometric) side scrolling 2D game and I want each fragment that I draw to cast a small drop shadow when it is near another object. What sort of algorithms are used in fragment ...
2
votes
1answer
257 views

Bluring behind something then drawing text?

I want to basically make a blur shader in glsl and use it like Windows 7 does for Windows. I want to for example draw something and then blur a rectangle, then draw text over it. If someone could ...