Invisible Geometry

Started by
15 comments, last by BitMaster 10 years, 9 months ago
Nah I have it clearing the window to like a sky blue... The cube should be black (or maybe even full white) but it should show up against the blue
Advertisement

bumping with a quick update. I modified my transform making routine that my model class calls so that it also dumps my manually-calculated transform matrix as well as the matrix OpenGL-calculated through the use of glMultMatrixf (and then a call to glGetFloatv), and I got them showing up exactly the same, so I now know my matrix math should be spot on. Still having absolutely 0 luck in getting the VBO to render though. Preferably I'd like to use glLoadMatrix instead of the alternative method of issuing a series of glMultMatrix calls -- or even using glRotate, glScale, etc (Though I think those are for immediate mode drawing right?)

Preferably I'd like to use glLoadMatrix instead of the alternative method of issuing a series of glMultMatrix calls -- or even using glRotate, glScale, etc (Though I think those are for immediate mode drawing right?)


gLLoadMatrix, glMultMatrix, glRotate and the other functions of a similar vein are all the same: completely deprecated in modern OpenGL. When they were used, they never made a distinction between immediate mode or not. glRotate was just a fancy way to create a rotation matrix and calling glMultMatrix, the same for the others.

A lot of places I been reading, call it immediate mode; only reason I called it that -- the term seemed to kinda make sense though. So if you don't use LoadMatrix, MultMatrix, or Rotate (as well as the others), then what does one use? Obviously there's a projection and a modelview projection (That my camera class uses); but then I have to transform my model also into modelview. What's the "bridge" between doing my matrix multiplication for the model's properties, to bringing them into modelview? (And now that I think about it, how does that integrate with the vertices I've pushed to the VBO? Do all vertices of the model have to be transformed and then pushed into the VBO?)

In modern OpenGL you set the camera matrices as uniforms for the shader. Depending on the OpenGL and shader version you are using the shaders might be able to access the old pipeline's modelview and projection matrix.

How do you create your OpenGL context? How do you initialize it? For example if you are requesting a forward compatible context instead of a compatibility context you will have the old functionality disabled by the driver.

Oh. well that kinda turns my view (No pun intended) on its side. Didn't know shaders were the only way to do camera matrices (As far as being modern OpenGL compliant I mean). I always thought shaders were only for hardware accelerators; which is fine... I mean I'm on one, I expect users of the engine to be on one etc. But I thought using shaders would mean only accelerator-powered machines would be able to run the engine. I didn't want to force myself into a corner and only write for accelerators; as there can be a rare moment that a software based renderer would be useful; for that though I guess I'd just write another driver class and utilize the deprecated stuff huh?

As for the creating of the OpenGL context; basically all of my window settings, application hWND, etc. are all stored in a settings class and then passed to the OpenGL driver that creates the MFC Window (For now I have it rolled into the driver; bad design I know, but being one person I have to go where my immediate needs take me). In addition to creating the MFC window via the standard CreateWindowEx MFC call it then (A few lines later) calls wglCreateContext and then wglMakeCurrent; checks the extensions and sets the VBO function pointers if the card manufacturer driver has that feature.Then it calls glViewport, glMatrixMode(GL_PROJECTION),glLoadIdentity(), gluPerspective with the appropriate parameters. Then it makes two more calls after that: glMatrixMode(GL_MODELVIEW),glLoadIdentity() (Figuring the camera class will pick up from there).

EDIT 1: Looked back over my reply and saw a couple of spelling mistakes: Meant -> mean, and right -> write (herp derp lol)

EDIT 2: Here is what my matrix dumps look like:


Dumping Old OpenGL generated ModelView matrix...
m[0]: 1.0000000 m[1]: 0.0000000 m[2]: 0.0000000 m[3]: 0.0000000
m[4]: 0.0000000 m[5]: 1.0000000 m[6]: 0.0000000 m[7]: 0.0000000
m[8]: 0.0000000 m[9]: 0.0000000 m[10]: 1.0000000 m[11]: 0.0000000
m[12]: 0.0000000 m[13]: 0.0000000 m[14]: 0.0000000 m[15]: 1.0000000

That's after the camera has been set.

Dumping Manually generated Model transform (Without spatial-transforms) matrix...
m[0]: 40.0000000 m[1]: 0.0000000 m[2]: 0.0000000 m[3]: 0.0000000
m[4]: 0.0000000 m[5]: 40.0000000 m[6]: 0.0000000 m[7]: 0.0000000
m[8]: 0.0000000 m[9]: 0.0000000 m[10]: 40.0000000 m[11]: 0.0000000
m[12]: 0.0000000 m[13]: 0.0000000 m[14]: -5.0000000 m[15]: 1.0000000

That's the combination of all the matrix functions for the model (Without multiplying by the camera model-view or the projection matrix).

The scale of the model is (40, 40, 40)

The position of the model is (0, 0, -5)

and there's no rotation

So the model transform looks spot on if my understanding of OGL matrix layout locations are correct (I think I'm referring to what they call the data storage of the matrix?) -- Yet I get nothing except the blue screen that I'm clearing the window to.

EDIT 3: 06/30/2013 ~2:35PM EST

Here's some more in-depth data dumps (Hopefully it helps). To keep the post from being too spammy, I'm encasing them in code blocks, despite them not actually being code.


 
[Cube-Test Statistics]:
'Unique' Vertex List:
[   0]:    X:-5.98050165    Y:5.96046448e-008    Z:-0.987541199
[   1]:    X:-0.980615139    Y:5.96046448e-008    Z:-0.987541199
[   2]:    X:-5.98050165    Y:4.95865297        Z:-0.987541199
[   3]:    X:-0.980615139    Y:4.95865297        Z:-0.987541199
[   4]:    X:-5.98050165    Y:4.95865297        Z:-6.10226059
[   5]:    X:-0.980615139    Y:4.95865297        Z:-6.10226059
[   6]:    X:-5.98050165    Y:5.96046448e-008    Z:-6.10226059
[   7]:    X:-0.980615139    Y:5.96046448e-008    Z:-6.10226059

Model Point Vertices:
[   0]:    X:-5.98050165    Y:5.96046448e-008    Z:-0.987541199
[   1]:    X:-0.980615139    Y:5.96046448e-008    Z:-0.987541199
[   2]:    X:-5.98050165    Y:4.95865297    Z:-0.987541199
[   3]:    X:-5.98050165    Y:4.95865297    Z:-0.987541199
[   4]:    X:-0.980615139    Y:5.96046448e-008    Z:-0.987541199
[   5]:    X:-0.980615139    Y:4.95865297    Z:-0.987541199
[   6]:    X:-5.98050165    Y:4.95865297    Z:-0.987541199
[   7]:    X:-0.980615139    Y:4.95865297    Z:-0.987541199
[   8]:    X:-5.98050165    Y:4.95865297    Z:-6.10226059
[   9]:    X:-5.98050165    Y:4.95865297    Z:-6.10226059
[  10]:    X:-0.980615139    Y:4.95865297    Z:-0.987541199
[  11]:    X:-0.980615139    Y:4.95865297    Z:-6.10226059
[  12]:    X:-5.98050165    Y:4.95865297    Z:-6.10226059
[  13]:    X:-0.980615139    Y:4.95865297    Z:-6.10226059
[  14]:    X:-5.98050165    Y:5.96046448e-008    Z:-6.10226059
[  15]:    X:-5.98050165    Y:5.96046448e-008    Z:-6.10226059
[  16]:    X:-0.980615139    Y:4.95865297    Z:-6.10226059
[  17]:    X:-0.980615139    Y:5.96046448e-008    Z:-6.10226059
[  18]:    X:-5.98050165    Y:5.96046448e-008    Z:-6.10226059
[  19]:    X:-0.980615139    Y:5.96046448e-008    Z:-6.10226059
[  20]:    X:-5.98050165    Y:5.96046448e-008    Z:-0.987541199
[  21]:    X:-5.98050165    Y:5.96046448e-008    Z:-0.987541199
[  22]:    X:-0.980615139    Y:5.96046448e-008    Z:-6.10226059
[  23]:    X:-0.980615139    Y:5.96046448e-008    Z:-0.987541199
[  24]:    X:-0.980615139    Y:5.96046448e-008    Z:-0.987541199
[  25]:    X:-0.980615139    Y:5.96046448e-008    Z:-6.10226059
[  26]:    X:-0.980615139    Y:4.95865297    Z:-0.987541199
[  27]:    X:-0.980615139    Y:4.95865297    Z:-0.987541199
[  28]:    X:-0.980615139    Y:5.96046448e-008    Z:-6.10226059
[  29]:    X:-0.980615139    Y:4.95865297    Z:-6.10226059
[  30]:    X:-5.98050165    Y:5.96046448e-008    Z:-6.10226059
[  31]:    X:-5.98050165    Y:5.96046448e-008    Z:-0.987541199
[  32]:    X:-5.98050165    Y:4.95865297    Z:-6.10226059
[  33]:    X:-5.98050165    Y:4.95865297    Z:-6.10226059
[  34]:    X:-5.98050165    Y:5.96046448e-008    Z:-0.987541199
[  35]:    X:-5.98050165    Y:4.95865297    Z:-0.987541199

Model position: (0,0,-5)
Model scale: (40,40,40)
Model rotation: (0,0,0)

Dumping rotation matrix X...
Values:
     m[0]: 1.0000000     m[1]: 0.0000000     m[2]: 0.0000000     m[3]: 0.0000000
     m[4]: 0.0000000     m[5]: 1.0000000     m[6]: 0.0000000     m[7]: 0.0000000
     m[8]: 0.0000000     m[9]: 0.0000000    m[10]: 1.0000000    m[11]: 0.0000000
    m[12]: 0.0000000    m[13]: 0.0000000    m[14]: 0.0000000    m[15]: 1.0000000


Dumping rotation matrix y...
Values:
     m[0]: 1.0000000     m[1]: 0.0000000     m[2]: 0.0000000     m[3]: 0.0000000
     m[4]: 0.0000000     m[5]: 1.0000000     m[6]: 0.0000000     m[7]: 0.0000000
     m[8]: 0.0000000     m[9]: 0.0000000    m[10]: 1.0000000    m[11]: 0.0000000
    m[12]: 0.0000000    m[13]: 0.0000000    m[14]: 0.0000000    m[15]: 1.0000000


Dumping rotation matrix z...
Values:
     m[0]: 1.0000000     m[1]: 0.0000000     m[2]: 0.0000000     m[3]: 0.0000000
     m[4]: 0.0000000     m[5]: 1.0000000     m[6]: 0.0000000     m[7]: 0.0000000
     m[8]: 0.0000000     m[9]: 0.0000000    m[10]: 1.0000000    m[11]: 0.0000000
    m[12]: 0.0000000    m[13]: 0.0000000    m[14]: 0.0000000    m[15]: 1.0000000


Dumping rotation matrix...
Values:
     m[0]: 1.0000000     m[1]: 0.0000000     m[2]: 0.0000000     m[3]: 0.0000000
     m[4]: 0.0000000     m[5]: 1.0000000     m[6]: 0.0000000     m[7]: 0.0000000
     m[8]: 0.0000000     m[9]: 0.0000000    m[10]: 1.0000000    m[11]: 0.0000000
    m[12]: 0.0000000    m[13]: 0.0000000    m[14]: 0.0000000    m[15]: 1.0000000


Dumping scale matrix...
Values:
     m[0]: 40.0000000     m[1]: 0.0000000     m[2]: 0.0000000     m[3]: 0.0000000
     m[4]: 0.0000000     m[5]: 40.0000000     m[6]: 0.0000000     m[7]: 0.0000000
     m[8]: 0.0000000     m[9]: 0.0000000    m[10]: 40.0000000    m[11]: 0.0000000
    m[12]: 0.0000000    m[13]: 0.0000000    m[14]: 0.0000000    m[15]: 1.0000000


Dumping translation matrix...
Values:
     m[0]: 1.0000000     m[1]: 0.0000000     m[2]: 0.0000000     m[3]: 0.0000000
     m[4]: 0.0000000     m[5]: 1.0000000     m[6]: 0.0000000     m[7]: 0.0000000
     m[8]: 0.0000000     m[9]: 0.0000000    m[10]: 1.0000000    m[11]: 0.0000000
    m[12]: 0.0000000    m[13]: 0.0000000    m[14]: -5.0000000    m[15]: 1.0000000


Dumping OLD OpenGL ModelView matrix...
     m[0]: 1.0000000     m[1]: 0.0000000     m[2]: 0.0000000     m[3]: 0.0000000
     m[4]: 0.0000000     m[5]: 1.0000000     m[6]: 0.0000000     m[7]: 0.0000000
     m[8]: 0.0000000     m[9]: 0.0000000    m[10]: 1.0000000    m[11]: 0.0000000
    m[12]: 0.0000000    m[13]: 0.0000000    m[14]: 0.0000000    m[15]: 1.0000000


Dumping Manually generated Model transform (Without spatial-transforms) matrix...
     m[0]: 40.0000000     m[1]: 0.0000000     m[2]: 0.0000000     m[3]: 0.0000000
     m[4]: 0.0000000     m[5]: 40.0000000     m[6]: 0.0000000     m[7]: 0.0000000
     m[8]: 0.0000000     m[9]: 0.0000000    m[10]: 40.0000000    m[11]: 0.0000000
    m[12]: 0.0000000    m[13]: 0.0000000    m[14]: -5.0000000    m[15]: 1.0000000



Begining Model-to-scene transformation

Retrieved OpenGL Projection Matrix:
     m[0]: 0.99984771     m[1]: 0.0000000     m[2]: 0.0000000     m[3]: 0.0000000
     m[4]: 0.0000000     m[5]: 0.99984771     m[6]: 0.0000000     m[7]: 0.0000000
     m[8]: 0.0000000     m[9]: 0.0000000    m[10]: 0.99984771    m[11]: 0.0000000
    m[12]: 0.0000000    m[13]: -5.0000000    m[14]: 10.0000000    m[15]: 1.0000000


Internal Engine Camera View Matrix:
     m[0]: 1.0000000     m[1]: 0.0000000     m[2]: 0.0000000     m[3]: 0.0000000
     m[4]: 0.0000000     m[5]: 1.0000000     m[6]: 0.0000000     m[7]: 0.0000000
     m[8]: 0.0000000     m[9]: 0.0000000    m[10]: 1.0000000    m[11]: 0.0000000
    m[12]: 0.0000000    m[13]: 0.0000000    m[14]: 0.0000000    m[15]: 1.0000000


Proj x Camera_ViewMatrix matrix:
     m[0]: 0.99984771     m[1]: 0.0000000     m[2]: 0.0000000     m[3]: 0.0000000
     m[4]: 0.0000000     m[5]: 0.99984771     m[6]: 0.0000000     m[7]: 0.0000000
     m[8]: 0.0000000     m[9]: 0.0000000    m[10]: 0.99984771    m[11]: 0.0000000
    m[12]: 0.0000000    m[13]: -5.0000000    m[14]: 10.0000000    m[15]: 1.0000000


ProjView x Model Matrix:
     m[0]: 39.9939079     m[1]: 0.0000000     m[2]: 0.0000000     m[3]: 0.0000000
     m[4]: 0.0000000     m[5]: 39.9939079     m[6]: 0.0000000     m[7]: 0.0000000
     m[8]: 0.0000000     m[9]: 0.0000000    m[10]: 39.9939079    m[11]: 0.0000000
    m[12]: 0.0000000    m[13]: -200.0000000    m[14]: 395.0000000    m[15]: 1.0000000

EDIT 4: 06/30/2013 ~9:51PM EST Kept looking at my data dump in the previous edit and wondering how the number of points could be the same count as the 'unique' vertices. It's because I duplicated the for loops in the data dumps and didn't change the upper limit control loop variable. I apologize; this should be correct now. I didn't bother doing another redump since I played around with the model scaling and its position a bit which would change the values of the matrices (Still haven't had any luck though; so the posted dumps are still ok to work with as the vertex positions haven't changed just the model's matrix values -- not even the math behind the matrix multiplication routines)

I would strongly suggest downloading GML. It's header-only, so there are really no excuses. Compare the result of its old OpenGL pipeline replacement functions with yours.

And while there are implementations of OpenGL which are designed to run in pure software you should think very carefully before you aim for those. Consider this: Your average smartphone or tablet renders using OpenGL ES. OpenGL ES 2 (which you could nowadays safely assume to be the default) is largely equivalent to OpenGL 2 (restrictions to this statement apply if you dig deeper), just without the fixed-function pipeline.
Even the 25/35$ Raspberry Pi does OpenGL ES 2.

There are really only three scenarios where you should seriously consider doing software rendering:
1) it can be difficult to have good graphics hardware on servers, especially if you want a cheap one.
2) your users are an computers more than a decade old.
3) your users don't install graphics drivers.

(1) is seldom an issue - most servers don't need good (or any) graphics cards and if they do you usually have a budget where they are affordable. My day job is in a field where average usually non-gamer users encounter 3d graphics. Extremely seldom you run into (2), frighteningly often you encounter (3) though. I think we can safely assume that people actually interested in games will somehow manage to get graphics drivers installed though.

This topic is closed to new replies.

Advertisement