Strange Things happing in DX9/OpenGL Coding.......

  • BlueSkyKnight
  • Topic Author
More
7 years 7 months ago #1 by BlueSkyKnight Strange Things happing in DX9/OpenGL Coding....... was created by BlueSkyKnight
This works in OpenGL but not in DX9
float gridy = floor(texcoord.y*(BUFFER_HEIGHT));
float gridx = floor(texcoord.x*(BUFFER_WIDTH));

color = (int(gridy+gridx) & 1) < 0.5 ? tex2D(SamplerCL,float2(texcoord.x + Perspective * pix.x,texcoord.y)).rgb : tex2D(SamplerCR,float2(texcoord.x - Perspective * pix.x,texcoord.y)).rgb;

For DX 9 I have to write it like this.
float gridy = floor(texcoord.y*(BUFFER_HEIGHT));
float gridx = floor(texcoord.x*(BUFFER_WIDTH));
                //wait What?Why?DX9 Workaround.......
color = (int((gridy+gridx)+(gridy+gridx)) & 2) < 0.5 ? tex2D(SamplerCL,float2(texcoord.x + Perspective * pix.x,texcoord.y)).rgb : tex2D(SamplerCR,float2(texcoord.x - Perspective * pix.x,texcoord.y)).rgb;

It feels like I'm missing something. Is this because the way API read the information? The two game I tested on are Quake 2 XP GL4+ and Borderlands 2 DX9

Please Log in or Create an account to join the conversation.

  • crosire
More
7 years 7 months ago - 7 years 7 months ago #2 by crosire Replied by crosire on topic Strange Things happing in DX9/OpenGL Coding.......
D3D9 does not have native bitwise operators, so I am emulating those. Turns out there is a type issue in my equation, which falsifies the result. I'll have that fixed in the next update.
Last edit: 7 years 7 months ago by crosire.
The following user(s) said Thank You: BlueSkyKnight

Please Log in or Create an account to join the conversation.

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.