I'll post a picture of the OpenGL renderer in action (so you can see what I mean) note that in order to even see the triangles, I had to fix the first vertex to the co-ordinates: 0.0f, 0.0f, 0.0f, 1.0f (x, y, z, w)
^^^ Note that the pixels that are not red (that area to the lower left) is the background color I defined when I cleared the color buffer.)Quote:Original post by stonemetal
I know Opengl expects a certain triangle winding, counter clock wise by default, for a triangle to be considered forward facing. Directx of course expects the opposite. This could mean that triangles are being culled in opengl that would not be culled in direct X and vise verse. As far as actual coordinates being off I don't know that much about DX OGL differences sorry.
Yes, OpenGL expects the opposite triangle winding to Direct3D, OpenGl requires Anti-Clock-Wise and Direct3D requires Clock-Wise, I've accommodated for this in the renderers (OpenGl will now take in Direct3D information, for testing purposes right now, I'll properly fix this problem at a later stage)
Quote:Original post by Momoko_Fan
Why can't you just use view and projection matrices like everybody else? There's no need to mess with all this RHW stuff, just use standard perspective calculation and you're done. AFAIK Triangle winding is the same in DX and OGL because its possible to import models from one to the other without issues.
Oh snappy snappy, you know you could have worded this reply in a nicer way? You make it sound like I'm a stupid idiot. I would have tried to use the 'normal' way to do it, but like I've said, the code is very hard to mess around with, right now I'm only replacing code with updated code that uses Direct3D9 and OpenGL ( my problem lies with the OpenGL though) The game's original creators have already processed all the projection data prior to the rendering stage, or as much of it as possible. I have to deal with this RHW stuff because otherwise I'd have to do a complete code overhaul and my position on the team is the graphical programmer, I work on the 3D code because I can visualize a 3D scene in my head rather easily with the given information.
And you're wrong, D3D and OpenGL have different triangle winding by default, you can change how they deal with that if you enable backface culling and change the winding then, but that's a short-term unpreferred fix. Also OpenGL and Direct3D have different co-ordinate systems, one is Left-Hand and the other is Right-Hand, I think I've accomodated for this already though... not 100% sure because I can't quite tell until this RHW stuff is down.
Just going to say this for anyone else going to tell me to do this the 'normal/modern' way with the Perspective/Ortho matrix functions:
If anyone else wants to be a smart-arse like Momoko_Fan was, then why don't you try rewriting over 20,000 lines of code for me? remember you have to accommodate for at least two different graphics APIs and comment most of the functions as you go along so you/others know what they do?
[Edited by - RexHunter99 on March 12, 2010 9:10:03 AM]
~With great graphics performance comes great responsibility, just that most programmers don't give a shit about older hardware.