Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 07 Feb 2010
Offline Last Active Apr 17 2012 06:14 AM

Posts I've Made

In Topic: GLSL lighting using normals

17 April 2012 - 02:46 AM

Im fairly new to this as well but when i was messing around with lighting in opengl es everything was messed up because i was doing calculations for the normals in diff space. so i made sure that everything was in the same space (i used worldspace for mine). try to go through ur shader and make sure ur calculations are done in the same space and make sure u normalize in the vertex shader AND in the fragment shader.

hope it helps.

EDIT: upon further consideration i think u may be rotating the light together with the cube which is why the light stays on the same face (used to happen to me all the time as i kept messing up the push pop matrix order)

In Topic: FBO and RBO and how they are used

06 April 2012 - 08:18 AM

EDIT: NVM i figured it out during the weekend.

In Topic: FBO and RBO and how they are used

06 April 2012 - 07:00 AM

Frame Buffer Object really represents just a view of a texture (or a part of a texture). A texture is an array of texels. Not only in DirectX it is called "Render Target" and it really is the same concept. All rendering always DOES go into "textures". Forget about the concept of a "screen", think the way the card thinks: "Give me some rectangular target array and I'll happily apply a pixel shader to each of its fragments". Your application can then present this texture to the user ("send it to screen", which usually DOES involve copying it via "CPU" into a widget or window canvas or whatever, automatically (swap-chain) or manually), or do some more processing, or store it to disk, or whatever.

The OpenGL terminology actually is way more complicated than what I've just presented, study it thoroughly here:


A short answer to the difference between GL FBO and RBO:

There is one active FBO that is the target of all rendering output and it might "contain" several target textures - a colour, another colour texture, maybe yet another texture to store anything auxiliary, a depth (all these are called FB attachments)... You can attach basically "any" number of any textures or RBOs to a FBO at once.

A RBO is a single texture and is one of attachments to a FBO. A RBO content can be modified exclusively by rendering to it while attached to a FBO (possibly with other RBOs or textures or not). RBO content can then be copied to another texture (so called "unpacking"). RBO doesn't have mip-maps. RBO cannot be pre-initialised with any pixel data. I'd use a RBO as a depth buffer (Z-buffer).

An ordinary OpenGL texture can have mip-maps and any of its mip-slices can indeed serve the very same purpose as a RBO, that is serve as a render target.

Also, ordinary textures can serve as "sources" of data in your shaders (actual surface-modifying colour data, normals or anything at all). RBOs are "destination-only". And FBOs, again, encapsulate various textures and/or RBOs and as such don't posses any own data.

Complicated, huh? Posted Image

im starting to get the "picture" now if u know what i mean :D but one more question. most of the examples i find are in linear programing so my question is should i make an FBO for each texture the same way you make a VBO for each model or make one for all the textures?(which thinking about it makes no sense but just to be sure)

In Topic: Shader ';' : syntax error; parse error

06 April 2012 - 03:23 AM

Doesn't the error log mention line number in shader source where the error is?

mine always says line 1 so.......

In Topic: Shader ';' : syntax error; parse error

06 April 2012 - 01:02 AM

vec3 lightPos = (matWorld * vec4(0.0,1000.0,1000.0,1.0).xyz

I'm sure you need another closed bracket there.

um im just go over to that corner and hang myself. ty for the help.