Welcome, Guest.
Username: Password: Remember me

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

Strange Things happing in DX9/OpenGL Coding....... 3 months 1 week ago #1

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
My PayPal Me Link If you like to donate paypal.me/BlueSkyDefender

Also my steam page steamcommunity.com/id/BlueSkyDefender
The administrator has disabled public write access.

Strange Things happing in DX9/OpenGL Coding....... 3 months 1 week ago #2

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2457
  • Thank you received: 1393
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.
Cheers, crosire =)
Last Edit: 3 months 1 week ago by crosire.
The administrator has disabled public write access.
The following user(s) said Thank You: BlueSkyKnight