which is this case is a float indicated by the 'f' on the literals, then all will be good custard. If you don't do that then it will dumb-down/demote everyone to the simplest type. So even one implicit or explicit integer type and everybody goes that way. So in particular 1/800 => 0 and 1/600 => 0 ..... and the transform goes belly up because all coordinates map to (0, 0) { rather singular eh ? }. In the setting of my utility library this gives the right matrix :
m_orthographic_projection = [[0.00195312, 0, 0, 0], [0, 0.00260417, 0, 0], [0, 0, -1, 0], [-1, -1, 0, 1]]
ie. there were zeroes where the 0.00195312 ( 1/800 ) and 0.00260417 ( 1/600 ) are. Groan. Three weeks to sort that out .... :-))))
You can see that the assumed screen dimensions here are 800 x 600. Interestingly with the fixed function aspect of pipeline one can set the transform from Normalised Device Coordinates ( a cube of side length two centred on the origin ie. [-1, +1] for each dimension ) to the screenbuffer ( using "window" coordinates ) via, say :
glViewport(0, 0, m_CurrentWidth, m_CurrentHeight);
so to do the HUD stuff you specify in screen coordinates within the client code ( remembering that the sense of the vertical scale has flipped sign c/w world space ) eg.
m_logo_1 = new TextString(glm::vec2(0.0f, TransformGlobals::getClientScreenHeight()),
glm::vec2(0.0f, -50.0f),
glm::vec2(200.0f, 0.0f),
m_FontLogo1,
"Einstein At Home",
TextString::SOLID,
color1);
which the orthographic projection transform squashes down to NDC ( plus clip & toss any z coordinate ), which is then inflated back to window coordinates just prior to the rasteriser. Neat huh? The orthographic projection is done inside the vertex shader :
#version 150
// This is a vertex shader. Creates a parallel sided quadrilateral
// area based at lower left corner, with offsets along the sides.
// Both dimensions of texture coordinates are bound/clamped to
// zero and one at extents.
void main()
{
// Start at lower left corner.
vec2 position = base_position.xy;
// With texture coordinates of zero.
pass_text_coords.st = vec2(0.0, 0.0);
// For odd numbered vertices.
if((gl_VertexID % 2) == 1) {
// Add the width_offset.
position += width_offset.xy;
// With the 's' texture coordinate is 1.0.
pass_text_coords.s = 1.0;
}
// For the vertex numbered two & three.
if(gl_VertexID > 1) {
// Add the height offset.
position += height_offset.xy;
// With the 't' texture coordinate being 1.0.
pass_text_coords.t = 1.0;
}
// Emit final position of the vertex.
gl_Position = HUDMatrix * vec4(position, 0.0f, 1.0f);
}
.... now if anyone has been following me in the least ( just remember to fake it until you make it folks ) this shader is very suspiciously like the one for rendering 3D text. Yep. You would be right. All the constructs are the same*, you just decide by using a certain transform matrix as to whether you'd like to leave the textured parallelogram apparently out there in the 3D world or slap it onto the near face of the NDC cube. In fact that suggests a certain code factorisation .... eh ? :-)))
Cheers, Mike.
* Indeed an even broader generalisation beckons. We have been doing linear/affine ( straight lines and line segment ratios preserved ) but if you want to go for something curvilinear eg. WAVES, then just make the right 4x4 matrix to transform with. The vertex shader won't know any different. Merely change the client side load pointer for setting the uniform variable values .... oh what fun awaits. But don't screw up the transform sequence aka matrix multiplications do not commute.
I have made this letter longer than usual because I lack the time to make it shorter ...
... and my other CPU is a Ryzen 5950X :-) Blaise Pascal
To demonstrate the calibre of the intellect ( ahem ) driving this .... err ..... project, I'll show you what the assistance of a professional programmer can achieve - my son Stephen in this instance. :-)
Cheers, Mike.
I have made this letter longer than usual because I lack the time to make it shorter ...
... and my other CPU is a Ryzen 5950X :-) Blaise Pascal
I've found this great new book about programming :
.... it has a terrific section entitled "Dealing with Answers On Stack Overflow That Start With 'You wanted to know how to do X but you should do Y instead because I said so even though it's not actually the answer to your question"
Cheers, Mike.
I have made this letter longer than usual because I lack the time to make it shorter ...
... and my other CPU is a Ryzen 5950X :-) Blaise Pascal
I do get to work on this sometimes this despite an incredibly busy life offline. I should have read Homer's Odyssey. Or Sisyphus : :-)
.... I talk the talk but only limp the walk. :-)
FWIW : I have finally sorted out all of the dependencies in the often obtuse committee camel structure which is OpenGL 3.x and 4.x, but I cry to learn that 5.x is going to return to higher level constructs ! Seriously. It has been 'discovered' that maybe, just maybe, they went too low level after 3.1 ...... already in some 4.x versions I see a very similar deconstruction ( in object oriented terms ) that I have produced ie. Pipeline, Program, Buffers, Shaders, Textures etc. There is even an analogous procedure that closely follows my RenderTask class. In the end it is rather obvious anyway. Oh well. :-)))
So finally I have a functioning RenderTask variant that takes a listing of vertices ( each with a cluster of attributes ), a listing of indices to those vertices, and upon triggering will render each vertex in the order that the indices prescribe. Please don't laugh ! This was not a trivial exercise to untangle all the sequence dependencies*that exist with state machine manipulation. And to make, as far as I know, a pretty much idiot proof interface to my library ( called ogl_utility ). Meaning that a given RenderTask constructor cannot be called unless all the requisite data & desired behaviour has been specified. The rest occurs via magic. I believe that to have been the hardest part, other constructs will be an overlay/derivation upon that.
Hence I'm making globes & spheres using the ogl-utility library. These are good test objects to muck about with as they are curve-linear. My next target is to render those with some pattern. I've done all that before in bespoke sense ie. not using my ogl_utility library ( which can solve many other scenarios also ). I have converted about one half of the original Starsphere program to this new paradigm.
Do you know that with a latitude/longitude grid on a sphere one can trace along all said lines, starting at the North Pole and returning to the North Pole, along a continuous path without re-tracing along any line ( you may cross over previous lines in the path ) ? Yes you can. It's an optimisation question ( Hiss. Boo ! ) in that one can present a single GL_LINE_LOOP request to the pipeline rather than a series of GL_LINES. I keep getting diverted by such interesting questions**.
Cheers, Mike.
* They made an especially significant inconsistency in what happens while a index buffer is bound. Unlike any other buffer binding : that affects the local state of a Vertex Array Object and is not part of the global state of the entire OpenGL instance. If you understand that sentence at all, then you have my sympathy because it means that you have stood upon the same land-mine as myself, and probably more that once because that is what it took to properly reveal the inconsistency. Right ? :-)))
** I'll give you a gentle pat on the head if you can tell me how ! :-))
I have made this letter longer than usual because I lack the time to make it shorter ...
... and my other CPU is a Ryzen 5950X :-) Blaise Pascal
.... Or I feel that way at least. Pardon me for mentioning that I've now completed a build script to download & create - from source code - the Mingw-w64 compiler targeted for producing Windows 32 bit executables. And all that on 64 bit Ubuntu 18.04 LTS .... and proved it by building not one, but four BOINC libraries. Epic. :-)
Don't worry if that doesn't make sense ... just be happy ....
Cheers, Mike.
I have made this letter longer than usual because I lack the time to make it shorter ...
... and my other CPU is a Ryzen 5950X :-) Blaise Pascal
LOL. I obviously need to get
)
LOL. I obviously need to get hold of Flat Eric, and not worry too much about the 150+ lurk ratio ( = reads/posts ). :-)
Cheers, Mike.
I have made this letter longer than usual because I lack the time to make it shorter ...
... and my other CPU is a Ryzen 5950X :-) Blaise Pascal
OK. Update OR "Beware The
)
OK. Update OR "Beware The Template Expansion From A Third Party Library". First the good news :
and so we have 2D text on the HUD with the rotating 3D stuff in the background! Looking more like the good old Starsphere every day. :-)
Nailed it. The problem was the compiler's deduction of the template type for glm::mat4. If you consistently put in a type T eg.
which is this case is a float indicated by the 'f' on the literals, then all will be good custard. If you don't do that then it will dumb-down/demote everyone to the simplest type. So even one implicit or explicit integer type and everybody goes that way. So in particular 1/800 => 0 and 1/600 => 0 ..... and the transform goes belly up because all coordinates map to (0, 0) { rather singular eh ? }. In the setting of my utility library this gives the right matrix :
.... coming out at runtime as :
m_orthographic_projection = [[0.00195312, 0, 0, 0], [0, 0.00260417, 0, 0], [0, 0, -1, 0], [-1, -1, 0, 1]]
ie. there were zeroes where the 0.00195312 ( 1/800 ) and 0.00260417 ( 1/600 ) are. Groan. Three weeks to sort that out .... :-))))You can see that the assumed screen dimensions here are 800 x 600. Interestingly with the fixed function aspect of pipeline one can set the transform from Normalised Device Coordinates ( a cube of side length two centred on the origin ie. [-1, +1] for each dimension ) to the screenbuffer ( using "window" coordinates ) via, say :
glViewport(0, 0, m_CurrentWidth, m_CurrentHeight);
so to do the HUD stuff you specify in screen coordinates within the client code ( remembering that the sense of the vertical scale has flipped sign c/w world space ) eg.which the orthographic projection transform squashes down to NDC ( plus clip & toss any z coordinate ), which is then inflated back to window coordinates just prior to the rasteriser. Neat huh? The orthographic projection is done inside the vertex shader :
// This is a vertex shader. Creates a parallel sided quadrilateral
// area based at lower left corner, with offsets along the sides.
// Both dimensions of texture coordinates are bound/clamped to
// zero and one at extents.
uniform vec3 base_position;
uniform vec3 height_offset;
uniform vec3 width_offset;
uniform mat4 HUDMatrix;
out vec2 pass_text_coords;
void main()
{
// Start at lower left corner.
vec2 position = base_position.xy;
// With texture coordinates of zero.
pass_text_coords.st = vec2(0.0, 0.0);
// For odd numbered vertices.
if((gl_VertexID % 2) == 1) {
// Add the width_offset.
position += width_offset.xy;
// With the 's' texture coordinate is 1.0.
pass_text_coords.s = 1.0;
}
// For the vertex numbered two & three.
if(gl_VertexID > 1) {
// Add the height offset.
position += height_offset.xy;
// With the 't' texture coordinate being 1.0.
pass_text_coords.t = 1.0;
}
// Emit final position of the vertex.
gl_Position = HUDMatrix * vec4(position, 0.0f, 1.0f);
}
.... now if anyone has been following me in the least ( just remember to fake it until you make it folks ) this shader is very suspiciously like the one for rendering 3D text. Yep. You would be right. All the constructs are the same*, you just decide by using a certain transform matrix as to whether you'd like to leave the textured parallelogram apparently out there in the 3D world or slap it onto the near face of the NDC cube. In fact that suggests a certain code factorisation .... eh ? :-)))
Cheers, Mike.
* Indeed an even broader generalisation beckons. We have been doing linear/affine ( straight lines and line segment ratios preserved ) but if you want to go for something curvilinear eg. WAVES, then just make the right 4x4 matrix to transform with. The vertex shader won't know any different. Merely change the client side load pointer for setting the uniform variable values .... oh what fun awaits. But don't screw up the transform sequence aka matrix multiplications do not commute.
I have made this letter longer than usual because I lack the time to make it shorter ...
... and my other CPU is a Ryzen 5950X :-) Blaise Pascal
To demonstrate the calibre of
)
To demonstrate the calibre of the intellect ( ahem ) driving this .... err ..... project, I'll show you what the assistance of a professional programmer can achieve - my son Stephen in this instance. :-)
Cheers, Mike.
I have made this letter longer than usual because I lack the time to make it shorter ...
... and my other CPU is a Ryzen 5950X :-) Blaise Pascal
I wonder what the label is
)
I wonder what the label is all about in the given context... ;-)
Einstein@Home Project
RE: I wonder what the label
)
His way of expressing annoyance that he got the writing backwards. :-)
Cheers, Mike.
I have made this letter longer than usual because I lack the time to make it shorter ...
... and my other CPU is a Ryzen 5950X :-) Blaise Pascal
I've found this great new
)
I've found this great new book about programming :
.... it has a terrific section entitled "Dealing with Answers On Stack Overflow That Start With 'You wanted to know how to do X but you should do Y instead because I said so even though it's not actually the answer to your question"
Cheers, Mike.
I have made this letter longer than usual because I lack the time to make it shorter ...
... and my other CPU is a Ryzen 5950X :-) Blaise Pascal
This Year's Update ( LOL )I
)
This Year's Update ( LOL )
I do get to work on this sometimes this despite an incredibly busy life offline. I should have read Homer's Odyssey. Or Sisyphus : :-)
.... I talk the talk but only limp the walk. :-)
FWIW : I have finally sorted out all of the dependencies in the often obtuse
committee camelstructure which is OpenGL 3.x and 4.x, but I cry to learn that 5.x is going to return to higher level constructs ! Seriously. It has been 'discovered' that maybe, just maybe, they went too low level after 3.1 ...... already in some 4.x versions I see a very similar deconstruction ( in object oriented terms ) that I have produced ie. Pipeline, Program, Buffers, Shaders, Textures etc. There is even an analogous procedure that closely follows my RenderTask class. In the end it is rather obvious anyway. Oh well. :-)))So finally I have a functioning RenderTask variant that takes a listing of vertices ( each with a cluster of attributes ), a listing of indices to those vertices, and upon triggering will render each vertex in the order that the indices prescribe. Please don't laugh ! This was not a trivial exercise to untangle all the sequence dependencies* that exist with state machine manipulation. And to make, as far as I know, a pretty much idiot proof interface to my library ( called ogl_utility ). Meaning that a given RenderTask constructor cannot be called unless all the requisite data & desired behaviour has been specified. The rest occurs via magic. I believe that to have been the hardest part, other constructs will be an overlay/derivation upon that.
Hence I'm making globes & spheres using the ogl-utility library. These are good test objects to muck about with as they are curve-linear. My next target is to render those with some pattern. I've done all that before in bespoke sense ie. not using my ogl_utility library ( which can solve many other scenarios also ). I have converted about one half of the original Starsphere program to this new paradigm.
Do you know that with a latitude/longitude grid on a sphere one can trace along all said lines, starting at the North Pole and returning to the North Pole, along a continuous path without re-tracing along any line ( you may cross over previous lines in the path ) ? Yes you can. It's an optimisation question ( Hiss. Boo ! ) in that one can present a single GL_LINE_LOOP request to the pipeline rather than a series of GL_LINES. I keep getting diverted by such interesting questions**.
Cheers, Mike.
* They made an especially significant inconsistency in what happens while a index buffer is bound. Unlike any other buffer binding : that affects the local state of a Vertex Array Object and is not part of the global state of the entire OpenGL instance. If you understand that sentence at all, then you have my sympathy because it means that you have stood upon the same land-mine as myself, and probably more that once because that is what it took to properly reveal the inconsistency. Right ? :-)))
** I'll give you a gentle pat on the head if you can tell me how ! :-))
I have made this letter longer than usual because I lack the time to make it shorter ...
... and my other CPU is a Ryzen 5950X :-) Blaise Pascal
Just to surprise you all,
)
Just to surprise you all, here is a screenshot of my latest effort, which I dub "Starsphere II" :
The prize here is the Earth within the celestial sphere of course. It's an interesting problem to
- create a mesh model for a sphere, then
- overlay the texels onto the mesh, with
- a coordinate singularity ( same point for all longitudes ) at each pole, plus
- the wrap around/sewing in longitude at the horizontal edges of the original texture, and
- all this done in using a set of abstractions of the OpenGL rendering pipeline ( version 3.2 and above ) that I call my ogl_utility set.
See https://github.com/hewsmike/Einstein-At-Home-Screensaver/tree/solarsystem-sdl2 for details. But don't get too excited as I haven't managed the cross compilation to Windoze yet. I just love Linux ....
Cheers, Mike.
I have made this letter longer than usual because I lack the time to make it shorter ...
... and my other CPU is a Ryzen 5950X :-) Blaise Pascal
It's official ! I am a Linux
)
It's official ! I am a Linux God !
.... Or I feel that way at least. Pardon me for mentioning that I've now completed a build script to download & create - from source code - the Mingw-w64 compiler targeted for producing Windows 32 bit executables. And all that on 64 bit Ubuntu 18.04 LTS .... and proved it by building not one, but four BOINC libraries. Epic. :-)
Don't worry if that doesn't make sense ... just be happy ....
Cheers, Mike.
I have made this letter longer than usual because I lack the time to make it shorter ...
... and my other CPU is a Ryzen 5950X :-) Blaise Pascal
Congrats Mike....Just you
)
Congrats Mike....Just you just have to wait for Ubuntu 20 next week..lol