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 20 Jan 2011
Offline Last Active Dec 04 2012 02:24 AM

Posts I've Made

In Topic: Bump Mapping

13 March 2012 - 10:09 AM


If texture sampling is set to repeat, for instance, sampling (x, y) and (x + 1, y) will return the exact same value, whatever x and y. If texture sampling is set to clamp, you'll always get the border values, etc.
When re-constructing the normals, you need to sample a pixel's direct adjacent pixels. And the pixels' coordinates are separated by 1/texture(Width/Height)
I don't know if I'm being clear, but I don't really know how to explain it better in english and without drawing stuff :)

When you consider the pixel at varTexture0, when you add 1/512, if your texture is 512, then you will sample the neighbour pixel. Try to draw a sample 16x16 pixel texture on a piece of paper, with the upper left pixel being (0, 0) and the bottom right (1, 1), then see what happens when you increase a texture coordinate by 1/16 as opposed to increasing by 1.


In Topic: Bump Mapping

09 March 2012 - 02:46 PM


when sampling your bump texture, you might want to add/substract "1.0 / textureWidth" and "1.0 / textureHeight", instead of just "1.0" :)
(texture coordinates go from 0 to 1, so when you add 1 to your current coordinate, you'll sample a pixel "outside" your texture)


In Topic: Level of details for particle systems

04 January 2012 - 03:03 PM

Excellent idea ! Didn't think about that one, and it's probably the simplest to implement :) I would just need to accumulate delta time so that the speed of the particles, etc. won't slow down.

In Topic: My object isn't entirely drawn

13 September 2011 - 09:42 AM

This happens if I draw a cube or a cylinder. Please help me

Ok, I replied a bit to quickly, didn't see that you already disabled backface culling ^^'
If you post the piece of code which renders your models, I think it'll be easier for people to spot what might go wrong.

In Topic: Linking OpenGL headers with FreeGLUT and GLEW on a mac

27 July 2011 - 09:35 AM

Hi there,

I don't know FeeGlut, but one easy solution is to replace the lines

#include <GL/gl.h>
#include <GL/glu.h>

by :

#if defined(__APPLE__)
# include <OpenGL/gl.h>
# include <OpenGL/glu.h>
# include <GL/gl.h>
# include <GL/glu.h>

When you're using the OpenGL framework on a Mac, all the GL headers are available in <OpenGL/**.h>
Also, the #if defined(__APPLE__) is optional : if you're only developping on a Mac, just #include <OpenGL/whatever.h> directly ^^