Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 08 Sep 2006
Offline Last Active Jun 11 2014 10:54 AM

Topics I've Started

Hardware Depth Cube FBO's

21 January 2013 - 10:20 PM

Hey Everyone,

I've been reading throughout gd.net and Google about hardware depth cubes (rendered from an FBO) and how they are both hardware supported (or not) depending on which threads I read, and which GL/Shader/Extensions versions I am targeting. I'm targeting GL2.0 (GLSL 120) at the moment, and wondering if that's too low hardware requirement for them to be typically supported?


I'm trying to gather metrics at the moment to figure out if it's worth switching to GL3 (most likely 3.2), or not. I'm also wondering if it's just the depth texture lookup that's not supported or the sheer rendering to each of the six cube faces that's not supported for depth cubes? This is all leading up to getting omni-directional shadow mapping to work (ideally on an NVidia 8800 min-spec system), so any thoughts or links to papers/examples are appreciated.




Wrong faces displaying gDebugger(FBO/CubeMap)

11 January 2013 - 10:15 PM

Hey Folks,

For the last few weeks I've been working on omni-directional shadow-mapping for my game. I've noticed that gDebugger is showing all six faces of my FBO CubeMap as the exact same texture data, even though I have verified that each camera direction is set up correctly and working normally. I use FBO's (2d) throughout my game for lighting, cartoon edging, as well as post-fx so I'm fairly confident it's implemented okay (though there could be something wrong), no framebuffer status errors have occurred and gDebugger hasn't tripped with any errors so I'm at a loss. I've even tried attaching each face as a separate color attachment then using glDrawBuffer to activate each one as I run through my 6 rendering passes and that has produced the same results.


I am targeting OpenGL 2.0, so I cannot use FBO Layering/GeoShaders, so I was wondering if anyone has any pointers on the subject? Is there any settings that if (not)set will copy/render the scene to all 6 faces? I'm more than happy to post some code (specifics would be appreciated only because the code is scattered through numerous files). I have to admit it's pretty much the same as every post I've seen on gd.net about fbo's/cube maps (although I seem to be missing the special sauce and cannot see it). I've tested this with an Intel HD Graphics 4000, NVidia 660M (Optimus technology) both of which produce this issue so it's definitely something I'm (not)doing.


Any suggestions are appreciated. Thanks!

OpenGL 3.2/GLSL 1.5: Lighting Problems

20 July 2010 - 02:27 AM

Hey Folks,
I'm writing a lighting demo right now using OpenGL 3.2 / GLSL 1.5, and ran into a bit of a snag. I'm defining my static light position in object coordinates but for some reason it travels as I move. I've tried multiplying the current modelView against the lightPosition but no deal. To make things slightly more complicated I apply multiple transforms (1 to pos/rot camera, then 1 for each mesh instance) to place in the world. I tried multiplying the light-pos by the modelview (matCamera uniform) before mesh transformations are applied to each mesh, but no deal.

Any help would be greatly appreciated. The vertex/fragment shader code is written below.

**Vertex Shader*:

#version 150

uniform mat4 matModelView;
uniform mat4 matProjection;

in vec4 position;
in vec3 normal;
in vec2 texcoord;

out vec2 fragTexCoord;
out vec3 fragNormal;
out vec3 fragEye;

uniform mat4 matCamera;
uniform vec3 lightPosition;

void main(void)
fragTexCoord = texcoord;
fragEye = (matModelView * position).xyz;
gl_Position = matProjection * matModelView * position;
fragNormal = normalize(fragEye - lightPosition);

**Fragment Shader**:

#version 150

uniform vec3 lightPosition;
uniform vec4 lightColor;

uniform sampler2D textureUnit0;
uniform sampler2D textureUnit1;
uniform int textureUnitsUsed;
uniform vec4 tintColor;
uniform bool textureEnabled;

uniform mat4 matModelView;
uniform mat4 matProjection;
uniform mat4 matCamera;

in vec2 fragTexCoord;
in vec3 fragNormal;
in vec3 fragEye;

out vec4 fragColor;

void main(void)
// Get Texture Unit Colors
vec4 tu0 = texture(textureUnit0, fragTexCoord);

// Apply Tint As Base Color
fragColor = tintColor;

// If enabled apply texture
if ( textureUnitsUsed > 0 )
// Texture Unit 0 is Base Texture
fragColor *= tu0;

// If more than 1 Texture Unit is defined,
// use color-multiplication for blending.
if ( textureUnitsUsed > 1 )
vec4 tu1 = texture(textureUnit1, fragTexCoord);
fragColor *= tu1;

// Lighting
vec4 diffuse = vec4(1.0, 1.0, 1.0, 0.1);
float dp = dot(fragEye, fragNormal);
float range = clamp(distance(fragEye,lightPosition), 0.0, 10.0) / 10.0;
fragColor *= ((1.0-dp) * diffuse * range);

Separate Base/Derived Methods in a Class

06 July 2010 - 03:17 PM

Hey Everyone,
I was recently writing some code and came across this interesting problem (or at least I think it is). I have 2 mesh classes, one for immediate mode rendering data (base class), the second is for vbo rendering data (derived class). In my graphics manager I have a method called "Draw", which for the life of me I cannot remember if there is a way in C++ (VS2005) to allow for each type (base/derived) to have their own implementations.

I'm reluctant to add a virtual "Draw" method to each of my Mesh classes, but any suggestions to solve the problem are welcome.

Mesh* pMesh = new MeshVBO();
GM g;

class GM
// This method always get hit.
virtual void Draw(Mesh*& m)
// draw immediate

virtual void Draw(MeshVBO*& m)
// draw vbo

Taskbar overlapping WS_POPUP?

04 May 2010 - 04:00 PM

Hey Everyone, I'm writing an app where I need the main window to be full screen. I've set my window style to be "WS_POPUP|WS_VISIBLE" (as well as tried adding clip sibling/children and maximized) and changed the window dimensions to the size of the resolution of the computer, but when I run the app starts fullscreen then after around 2 seconds the taskbar appears on screen. I am initializing OpenGL after creating this window. I've noticed that if I do not call SwapBuffers(), the taskbar issue does not happen. I have tried using the PFD-composition and it does not seem to resolve the problem. Has anyone else experienced this issue? It's a rather standard setup of OpenGL so I'm not sure what the issue is. Any help would be appreciated. C Info: Visual Studio 2005 Standard Vista, NVidia Geforce 8600M (latest drivers)