Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 27 Jun 2011
Offline Last Active Jun 13 2013 03:43 PM

Topics I've Started

[Win32] Addresses

27 May 2013 - 12:01 AM

As an example, the SendMessage(hWnd, CB_GETCURSEL, 0, 0) function returns the selected index of a combo box.
If my purpose is to read this index multiple times, I should call this function multiple times. Or don't I?

Instead, is there an address where these kind of stuff are stored so I can and use it for making things easier?


18 May 2013 - 01:26 AM

From the specification,

void *glCopyBufferSubData(enum readtarget, enum writetarget,
     intptr readoffset, intptr writeoffset, sizeiptr size);

            glCopyBufferSubData copies part of the data store attached to readtarget to the
            data store attached to writetarget. The number of basic machine units indicated by size
            is copied from the source, at offset readoffset to the destination at writeoffset,
            also in basic machine units.

It's not very clear, however, what's the meaning if readoffset, writeoffset and size, and how should them be used.

        glBindFramebuffer(GL_COPY_READ_BUFFER, fboSrc);
        glBindFramebuffer(GL_COPY_WRITE_BUFFER, fboDst);
        glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, ?, ?, ?);


Any clue?


How can I change [-1,1] range from gluPerspective?

17 May 2013 - 02:37 AM

I'm drawing 2D, on different layers, dealing with real coordinates [(0,0), (screenWidth, screenHeight)] instead of the standard [-1,1]. And everything is ok when using gluOrtho2D(0, w, h, 0).

However, I want to be able to render those layers in a 3D space, so the user can merge in the scene. The problem is: with gluPerspective, all my coordinates are changed, and for the reason I'd have to change them all in my code, this is strictly unwanted.

So, is there a (simple) way to solve my thing?

[Win32] "Custom" resize box

11 May 2013 - 12:32 PM

Ok, so I have a rectangle drawn on my screen (via OpenGL), and I want to make it resizable — just like the standard resize box of all windows.
Is there a simple way, other than checking mannualy if mouse position is here or there and changing cursor again and again , to do it?

[GLSL] How to invert texture RGB components?

08 May 2013 - 12:23 PM

 I found that a simple fragment shader for that would be something like:


uniform sampler2D Mtexture;

void main()
    vec4 color = texture2D(Mtexture, gl_TexCoord[0].st);
    gl_FragColor = vec4(1.0 - color.r, 1.0 - color.g, 1.0 - color.b, color.a);

And the OGL code:

    glBindFramebuffer(GL_FRAMEBUFFER, fbo);

    glColor4f(1, 1, 1, 1);
    glBindTexture(GL_TEXTURE_2D, tex);

    glTexCoord2f(0.0f, 1.0f);  glVertex2i(0,0);    
    glTexCoord2f(1.0f, 1.0f);  glVertex2i(width,0);  
    glTexCoord2f(1.0f, 0.0f);  glVertex2i(width,height);  
    glTexCoord2f(0.0f, 0.0f);  glVertex2i(0,height);

    glBindTexture(GL_TEXTURE_2D, 0);
    glBindFramebuffer(GL_FRAMEBUFFER, 0);

However, it's not giving me the expected results, and this is driving me crazy.
Should I disable GL_BLEND before applying the filter? Case not, which function to use?
Should I clear my texture before using a shader on it? <-- Never understood this