Tesselation in Go-GL - opengl

I'm trying to tesselate a simple triangle using the Golang OpenGL bindings
The library doesn't claim support for the tesselation shaders, but I looked through the source code, and adding the correct bindings didn't seem terribly tricky. So I branched it and tried adding the correct constants in gl_defs.go.
The bindings still compile just fine and so does my program, it's when I actually try to use the new bindings that things go strange. The program goes from displaying a nicely circling triangle to a black screen whenever I actually try to include the tesselation shaders.
I'm following along with the OpenGL Superbible (6th edition) and using their shaders for this project, so I don't image I'm using broken shaders (they don't spit out an error log, anyway). But in case the shaders themselves could be at fault, they can be found in the setupProgram() function here.
I'm pretty sure my graphics card supports tesselation because printing the openGL version returns 4.4.0 NVIDIA 331.38
.
So my questions:
Is there any reason adding go bindings for tesselation wouldn't work? The bindings seem quite straightforward.
Am I adding the new bindings incorrectly?
If it should work, why is it not working for me?
What am I doing wrong here?

Steps that might be worth taking:
Your driver and video card may support tessellation shaders, but the GL context that your binding is returning for you might be for an earlier version of OpenGL. Try glGetString​(GL_VERSION​) and see what you get.
Are you calling glGetError basically everywhere and actually checking its values? Does this binding provide error return values? If so, are you checking those?

Related

Modern opengl rendering pipeline

Okay i have been studying opengl online, however most tutorials i have been seeing only cover the fixed pipeline. I am trying to add it into an object oriented project, however i am not quiet sure the modern process with shaders and such. Is the process as easy as binding a buffer, as well as a shader? And what exactly are handles used for? I have added glew and glfw, even though now my log is saying glew failed to initialize, error 1282, thats a whole different topic, unless glew and glfw are incompatable. Can anyone shine a light on this subject?
The handles in opengl are just GLInts, which for example could be used to work with a VBO, VAO, stuff like that.
As for the shader, it uses the glsl shading language. Then they give the functions to compile and link the shader to your opengl context.
Asking how shaders, handles, and setting up the environment work for opengl is a very broad question, you would be better off following a tutorial. A good one would be OpenglDev which covers all the basic concepts, as well as some advanced ones. It's not opengl-es, but if you understand those tutorials opengl-es should be no problem transitioning to. The Visual Studio solution project is available for download Here, which will come with the project already setup with the required libraries.

OpenGL - ARB extension

I am using MacBook Pro (13-inch, Mid 2010) and I work with OpenGL. I noticed, some of functions miss in library. I found specifications on the internet about my hardware and it says: "support OpenGL 3.3". It was strange so I printed my OpenGL version and IT IS 2.1, NO 3.3!. (Then I found, newest MacBooks (2014) have the same OpenGL version 2.1, WTF)
Then I almost jumped from window. (JK)
I googled something about 2.1 with some extension ARB, but there is no documentation, no usage, nobody uses it. Can anybody explain me please, what is that? How to use it? What is the difference?
I read (If I understand well), instead of new OpenGL 3.X, there is ARB extension which is similar or something. I hope, if they write to the specification it supports version 3.3, ARB should be the same (the same functions at least).
I would be glad, if somebody explains me what is going on.
Question:
I have problem with multisample texture for FBO drawing. It can be created by function glTexImage2DMultisample with parameter GL_TEXTURE_2D_MULTISAMPLE. It is from version 3.2 or grater.
So what should I use, or is it possible to do it with ARB?
I found GL_ARB_multisample in library. What is that? Any usage? All functions I found on the internet are missing. There are some definitions like GL_MULTISAMPLE_ARB in header. I tried to enable it by glEnable (GL_MULTISAMPLE is defined too), it doesn't work.
Please help me. :(
Edit:
If you know different way to solve this, I would be happy.
Original question: OpenGL - FBO and alpha blending
You must switch OpenGL context from Legacy to Core profile. Core profile requires some changes in your code. You must migrate your code and shaders, because it's new version of OpenGL and GLSL. Check official video, how to migrate and rewrite functions to validate code for new version. Apple Developer Site - OpenGL (The video on the right side).
The important thing, you must do, is add #import <OpenGL/gl3.h> and all functions will be visible for use.
To get it to work, and debug shaders it's necessary set up NSOpenGLPixelFormat. Add NSOpenGLPFAOpenGLProfile key with NSOpenGLProfileVersion3_2Core value to NSOpenGLPixelFormatAttribute array:
NSOpenGLPixelFormatAttribute attribs[] = {
// ...
NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
// ...
};
This helps you to debug your code.
Thanks a lot for help and I hope, this helps you.

Replicating Cathode retro terminal effect?

I'm trying to replicate the effect of Cathode but i'm not really aware of any rendering effects in SDL. Does anyone know the technique used in Cathode? Are they using OpenGL and shaders maybe?
If you are still interested in the subject I'm working on a similar project. The effects were obtained by using GLSL shaders.
You can grab the source code here: https://github.com/Swordifish90/cool-old-term/
The shaders strings might not be extremely readable due to the extensive use of the ternary operators (needed to customize the appearance) but they should give you a really good idea.
If you poke around a bit in the application bundle, you'll find that the only relevant framework is GLKit which, according to Apple, will "reduce the effort required to create new shader-based apps".
There's also a bunch of ".fragdata", ".vertdata", and ".glsldata" files, which are encrypted.
Very unfortunate for you.
So I would say: Yes, it's OpenGL shaders all the way.
Unfortunately, since the shaders are encrypted, you're going to have to locate suitable algorithms elsewhere.
(Perhaps it's possible to use the OpenGL debugging and profiling tools to capture the shader source as it is compiled, but I doubt it.)
You may have realized that Android phones have (had?) such animations when you put them to sleep. That code is available under in file named ElectronBeam.java.
However it is Java code and uses GLES 1.0 with GLES 1.1 Extenstions but algorithm for bending screen should be understandable.
Seems to be based on GLTerminal which uses OpenGL, it would have to use OpenGL and shaders for speed.
I guess the fastest approximation would be to render the text to buffers within OpenGL and use a deformed 2d grid to create the "rounded corners" radial distortion.
But it would take a lot of work to add all the features that cathode has, not to mention to run them quickly.
I suspect emulating a CRT perfectly is a bit like emulating an analog synth perfectly - hard to impossible.
If you want to work quickly and not killing the CPU, the GPU is the best solution! So pixel shaders. pixel shaders can do all of these effects. Once I made such an application. I wrote it in Silverlight, but it does not matter, I used the pixel shader.
Suggests to write this in Qt4 and add to the QWidget pixel shader effects.

how to use glFogCoordEXT in GLSL

I used glFogCoordEXT to distinguish explored and unexplored terrain. But after i use a shader for normal mapping on terrain, its working fine but the fog is no more there.
can some one help me, (i don't know glsl).
I think you used the fixed-function-pipeline before? By using a custom pixel-shader you "overwrite" the fixed-function-pipeline. You have to manually add fog to your pixels inside the normal-mapping-shader, but that is difficult without any knowledge of GLSL. You may try googeling for GLSL fog, there are plenty of fogging-functions for GLSL that work with the built-in variables (which are edited by glFogCoord). You can then try to wire this function into your normal-mapping-shader. Read a tutorial about vertex/pixel shaders before, they are not that hard to understand. Shaders are just mathematics, the language itself is much easier than the C++ code of the actual program.

How to implement 3d texturing in OpenGL 3.3

So I have just realized that the code I was working on for 3d textures was for OpenGL 1.1 or something and is no longer supported in OpenGL 3.3. Is there another way to do this without glTexture3D? Perhaps through a library or another function in OpenGL 3.3 that I do not know about?
EDIT:
I am not sure where I read that 3d texturing was taken out of OpenGL in newer versions (been googling a lot today), but consider this:
I have been following the tutorial/guide here. The program compiles without a hitch. Now read the following quote from the article:
The potential exists that the environment the program is being run on does not support 3D texturing, which would cause us to get a NULL address back, and attempting to use a NULL pointer is A Bad Thing so make sure to check for it and respond appropriately (the provided example exits with an error).
That quote is referring to the following function:
glTexImage3D = (PFNGLTEXIMAGE3DPROC) wglGetProcAddress("glTexImage3D");
When running my program on my computer (which has OpenGL 3.3) that same function returns null for me. When my friend runs it on his computer (which has OpenGL 1.2) it does not return null.
The way one uploads 3D textures has not changes since OpenGL-1.2. The functions for this are still named
glTexImage3D
glTexSubImage3D
glCopyTexSubImage3D