Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 08 Nov 2007
Offline Last Active Sep 02 2013 05:07 AM

Topics I've Started

UBO not working in vertex shaders

09 November 2012 - 01:37 AM

Hi all,

Iv'e got a little issue, on osx and ogl 3.2 ubo data doesn't seem to be sending correctly to the vertex shader only. Some data is sending which makes me think the buffer is offset or something. The strange thing is though ubos work fine on the fragment shader, and on windows this problem does't appear at all. If I swap the ubo out for individual uniforms then that works, but It's not really an option...oh the ubos are defined as std140, and the data I'm passing from the app is in multiples of vec4s so there shouldn't be an issue there. Maybe a mac driver issue? Anyways, any help appreciated.

D3DXCreateTextureFromFileInMemory memory ownership

21 August 2011 - 09:19 AM

Hi all,

When using D3DXCreateTextureFromFileInMemory(), Does DirectX make a copy of the data passed to it? The reason I ask is because I retrieve a file from an archive, pass the loaded data into D3DXCreateTextureFromFileInMemory(), then delete the loaded data (assuming DirectX makes its own copy). After I delete the data my application runs very slow. However, if I don't delete the data then the application runs fine.

HLSL bool register count

18 August 2010 - 03:23 AM


Ive created a shader which has 5 simple if statements and another that contains an if statement inside of it. Im getting an error that informs me I have reached the maximum ps_3_0 boolean register limit of 16.

Now, it also suggests trying to place any bools contained in structs at the start of the struct. So I tried this and the shader compiled fine.

Can someone please explain why moving the boolean worked? I assume it had something to do with structure packing. Here is the structure as it was when the error was produced.

float4 ambient;
float4 diffuse;
float4 specular;
float3 position;
float pad1;
float3 direction;
float pad2;

float attenuation0;
float attenuation1;
float attenuation2;
float range;

float falloff;
float theta;
float phi;
bool shadowsEnabled;

int type;

Encoding Matrix data into textures

12 August 2010 - 12:31 AM


Im currently creating a texture to hold matrix data. This is then passed of onto the GPU so that I can manipulate vertices based on those matrices using vertex texture fetching.

Im using DX9, shader model 3, and an ATI 5770.

At the moment I have 38 matrices and im simply encoding them into a 1D texture. I calculate the texture size by (numBones * 4). The 4 is there because you need 4 pixels to store a 4x4 matrix.

That works fine, however, if I increase the size of the texture to something like 700 pixels wide then my data seems to become corrupt somehow. The shader doesn't seem to read the values correctly at larger texture sizes.

I figured it might have something to do with mipmaps but I have them turned off...I think.

Any help would be great

EDIT : All fixed. Turns out the texture needed to be power of 2. Which is odd because caps says my card supports non power of 2 textures. Can anyone shed some light on this?

[Edited by - Helo7777 on August 12, 2010 9:00:05 AM]

tips for an FPS camera?

22 December 2008 - 03:36 PM

Hi A bit of an art question i guess. Just wondering what is the best way to create a counter strike style FPS in terms of the models and FPS camera. Eg, the camera for the player, do you just create the models in such a way that you just stick the camera at the head of the model? Or do you model just arms and weapons for the player then offset them from the FPS camera? Im used to using cubes and triangles(programmer art) so the model and animation thing is abit new to me. Any other suggestions would be great. Thanks.