You can put in the version of OpenGL you want - probably 4.6 with "Compatibility" profile - that will include the "old-fashioned" stuff like immediate mode, which I think you said you were using. It will generate a header and source file that you can download and add directly to your project in place of the usual opengl.h. There are a few different libraries/tools out there for this, but one I like is Glad, which is an online loader generator. You'll also need code to load the function addresses from the driver for newer functions (this is called a "loader"). Despite that the OpenGL implementation in the driver is 4.6, you won't be able to access the newer functionality without the appropriate declarations. It sounds like your version of the opengl.h header is too old, and doesn't include the declarations for functions and constants from newer versions. In case it is relevant, CodeBlocks' autocomplete did not recognise the command glClipControl, whereas it did recognise the glGetString, in spite of it not knowing the constant GL_SHADING_LANGUAGE_VERSION that I passed to glGetString. There are more details here: How to use maximum resolution (pixel density) with OpenGL in MS Windows about the template that I have borrowed and modified, in case that helps diagnose the problem. Here too, the constant parameter was not recognised. The only other time I've encountered a problem like this so far, was with const GLubyte* SHADINGLANGUAGESTRING = glGetString(GL_SHADING_LANGUAGE_VERSION). I know that this function became available only in OpenGL version 4, however, my code reports, via const GLubyte* VERSIONSTRING = glGetString(GL_VERSION), that it is using version 4.6.0. I don't know if the problem is with the function itself - the IDE seemed not to object to it, in any case. Did you mean." followed by a suggestion of something else with a similar spelling, and a similar error, for the other constant. The specific errors from the IDE are "GL_LOWER_LEFT undeclared (first use in this function). However, the IDE did not recognise the definitions of the two constant parameters. The last step remaining seemed to be to set glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE). Having done so, I changed glDepthFunc(GL_LEQUAL) to glDepthFunc(GL_GEQUAL) and set glClearDepth(0.0f). I did this in order to justify upgrading my projection matrix again, this time to a reversed- $z$ style, again based on what I've read in books. I was able to induce $z$-fighting by having the ratio of the distances of the far and near clipping planes nice and large, and making two very large distant triangles, one parallel to and not far behind the other. They move only when the camera orientation changes, as desired. These render correctly behind everything else, and exhibit no parallax, and no change in size. This all worked, and allowed me for the first time, to use infinitely distant objects, i.e. This mapped $z = -\infty$ in camera space to $z = 1$ in normalised device coordinates. Having had success with a hand-made projection matrix emulating what glFrustum used to do before it was deprecated, I upgraded to a hand-made infinite projection matrix having no far clipping plane, based on what I've read in books. I am writing basic code to draw triangles, lines etc to translate and orient them, and to project them in perspective, solving the occlusion problem using the depth buffer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |