Note that there are some explanatory texts on larger screens.

plurals
  1. POd opengl custom vs fixed-pipeline matrix weirdness
    primarykey
    data
    text
    <p>I have recently been working on shifting over to handling my matrix controls myself, so that my engine will be ready to shift over to a 4.0+ context, <em>though currently I am using a 2.1 context with Derelict</em>. I have tried all kinds of matrix calcs and nothing seems to work with my shader(nothing on screen except for FPS counter unless I switch back to fixed-pipe, or if I switch the vs to set gl_Position = vec4(position,1.0);). Even when I grab the values that OpenGL normally sets and put them into it I get the same. </p> <p>I added print out of both my matrix and the one that the fixed-pipeline returned to the draw calls and the output is IDENTICAL. I've already checked and double checked my shader code, so I'm pretty lost as to from where this bug is coming.</p> <p><em>This happens on both OSX and Windows. I have a <code>glGetError()</code> check every draw call and am not getting any errors. Shaders link and validate with out warning or error.</em></p> <h1>code for uniform loading:</h1> <pre><code>glUniformMatrix4fv(ModelViewLoc,1, GL_FALSE ,modelview); glUniformMatrix4fv(ProjectionLoc,1, GL_FALSE ,projection); </code></pre> <h1>Vertex Shader:</h1> <pre><code>#version 120 //layout(location = 0) in vec3 position; attribute vec3 position; uniform mat4 ModelView; uniform mat4 Projection; void main() { mat4 mvp = Projection*ModelView; gl_Position = mvp * vec4(position,1.0); //gl_Position = vec4(position,1.0); } </code></pre> <h1>Fragment Shader:</h1> <pre><code>#version 120 uniform float slider; void main() { vec4 diffuse = vec4(vec3(slider),1.0); gl_FragColor = diffuse; } </code></pre> <h1>debug output:</h1> <p>Model 1:</p> <pre><code>OpenGL ModelView: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -2, -2, -8, 1] mine: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -2, -2, -8, 1] OpenGL Projection:[1.30323, 0, 0, 0, 0, 1.30323, 0, 0, 0, 0, -1.0002, -1, 0, 0, -0.20002, 0] mine: [1.30323, 0, 0, 0, 0, 1.30323, 0, 0, 0, 0, -1.0002, -1, 0, 0, -0.20002, 0] </code></pre> <p>Model 2:</p> <pre><code>OpenGL ModelView: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2, 2, -8, 1] mine: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2, 2, -8, 1] OpenGL Projection:[1.30323, 0, 0, 0, 0, 1.30323, 0, 0, 0, 0, -1.0002, -1, 0, 0, -0.20002, 0] mine: [1.30323, 0, 0, 0, 0, 1.30323, 0, 0, 0, 0, -1.0002, -1, 0, 0, -0.20002, 0] </code></pre> <p>*<em>UPDATE</em>*I have released the code for matrix lib @ github.com/mclark4386/DMath See anything there?^^;</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload