Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 01 Mar 2007
Offline Last Active Apr 15 2016 05:06 AM

Posts I've Made

In Topic: Rendering a texture

25 July 2013 - 01:33 PM

Thanks RobTheBloke for your detailed help! You pushed me in the right direction:)


The problem was: When I uploaded the images with glTexImage2D I had no OpenGL context. I find it very strange that glError() did not tell any error though...


One last question: How is it possible NOT to have a valid context? I mean after I create a context and "activate" it by calling wglMakeCurrent (), isn't the context now active forever? In other words: I thought after calling wglMakeCurrent() I can use OpenGL calls in my code in every function I want. Did I miss something?

In Topic: Am I the only one that finds OSG's code disgusting?

05 April 2013 - 05:57 PM

I agree, OSGs code is a mess. But its the lack of documentation that really makes working with OSG such a pain in the ass...

In Topic: Loading and caching resources

23 November 2012 - 07:13 AM

Thanks to all of you guys! I have chosen the custom key struct with operator<(). The extended string approach also would have worked, but the struct is more flexible.

@rip-off: I think your operator<() contains a bug. Assume these values for a and b: {52,30, "Foo"}, {50,40, "Foo"}
Your width has the highest priority, so operator<(a,b) should return false. But your operator< will return true, since a.width < b.width is false but a.height < b.height evaluates to true.

My struct looks like this (I hope its correct;)
struct TextureCacheID {
    std::string textureFilename;
    uint width, height;

    bool operator<(const TextureCacheID& rhs) const {
        return (textureFilename < rhs.textureFilename) || 
               ((textureFilename == rhs.textureFilename) && (width < rhs.width)) ||
               ((textureFilename == rhs.textureFilename) && (width == rhs.width) && (height < rhs.height));

In Topic: UI components: Scaling

21 November 2012 - 03:23 PM

@frob: Could you please elaborate your first approach a little bit more? Do you mean I determine whether I scale a component based on the smaller dimension of the window?

In Topic: Engine Design: Shadow Mapping

19 July 2012 - 01:50 PM

When I use a texture atlas for multiple depth maps I assume I the part of the atlas specific for a certain light is selected by setting the viewport?

@AgentC: I do not know the maximum number of available registers from VS to PS (I use Shader Model 3), but I do not think this will be a problem. My shaders are relatively simple - just Pos, Normal and Tex Coordinates and then one additional texture coordinate for each Depth Map. I also just want to implement standard Shadow Mapping.

But do you think my idea with the fixes sampler registers (i.e. s10 for depth map 1, s11 for depth map 2 etc) is good?

Another question just came into my mind: Lets say I have 3 lights and I pass that information to my HLSL shader per constant float u_numLights;
Now I could write a for loop in the Pixel shader to iterate over all depthmaps and make the test if the pixel is in shadow. But my simple problem is: The samplers aren't an array, so I can't just use an array expression like this:
for(int i=0; i < u_numLights; i++) {
    depth = tex2D(sampler[10 + i], texCoords);
I have to address each sampler with its full name, like depthMap1, depthMap2 etc, which makes it impossible to use a loop. Or do I miss something?