gl_PointCoord has incorrect/uninitialized value - opengl

I am having trouble to get valid values in my fragment-shader's gl_PointCoord variable. I use libgdx, which is a cross-platform java framework that allows to run the same application on the desktop as well on android. The shader works fine with OpenGL ES on android, only the desktop seems to not provide a correctly interpolated value but always zero.
Could this be an issue with libgdx or with the graphics driver?
NVidia Quadro 3000M
Driver 275.33
Win 7 64-bit (Service Pack 1)
libgdx-0.9.6

fyi: Did not do much research yet, but seems to be a bug in lwjgl or the driver that gl_PointCoord is only available when enabling pointsprite-mode via
Gdx.gl20.glEnable(GL11.GL_POINT_SPRITE_OES);
This is not available in OpenGL 4.2 or OpenGL ES 2.0, but seems to be required to be explicitly set on the desktop.

Related

which opengl version runs on every device?

Using llvm you can write a Programm which runs on PC, Mobile and since WebAssembly even in your Webbrowser. But for an Example Android uses Opengl-ES. Is there any opengl version which can be used on each of these platforms?
There is no single version of OpenGL that runs everywhere, but OpenGL ES 2.0 is pretty close to the lowest common denominator.
WebGL 1.0 is very similar to OpenGL ES 2.0. WebGL 2.0 is a subset of OpenGL ES 3.0, with various restrictions which are required for security.
On desktop systems, there is usually a way to create an OpenGL ES 2.0-compatible context and use the exact same API as on Android. Regular desktop OpenGL has a few incompatibilities with OpenGL ES, see for example this page:
https://www.khronos.org/webgl/wiki/WebGL_and_OpenGL_Differences
Mobile devices almost universally support OpenGL ES 2.0, and most flagship phones support OpenGL ES 3.2. The current distribution of support for OpenGL ES on Android phones is at the bottom of this page: https://developer.android.com/about/dashboards/

Shadow mapping not working on OpenGL 3.3, but working on 4.4

I have my shadow mapping tecnique running fine in my OpenGL application, with my latest 4.4 core profile drivers, however, I'm following the 3.3 specification, that should allow me to run in inferior hardware, with the same graphical result, but it doesn't.
My shadows are not appearing on OpenGL 3.3 hardware, and besides that, the performance is incredibly low, I even run my application on the same graphic card, but with only one version older driver (4.2), and my shadow didn't appear.
The weird thing also, is that before the last actualization, there weren't any of these problems.
I have a Radeon HD 6870 with the latest omega drivers, do I need to compile my application with older drivers versions in order to target old hardware?
Please check that you actually get a valid GPU accelerated OpenGL context of the required version. You may unknowingly request a profile that your driver doesn't properly support and drop to some emulation mode. Check the strings GL_RENDERER and GL_VENDOR and the OpenGL version of your context.
do I need to compile my application with older drivers versions in order to target old hardware?
Certainly not.

Nvidia Nsight 4.0 cannot profile code in OpenGL 4.3

I am using Visual Studio 13 with Nvidia NSights 4.0. In my application I am doing a mix of different types of rendering but, for the purpose of testing the proiler, I did a simple rendering of a scene. I opened the graphics debugger and, when I open the GUI and press spacebar to capture the frame I get this error:
Cannot enter frame debugger. Nsight only supports frame debugging for
D3D9, D3D10, D3D11, and OpenGL 4.2.
Reason: glEnd
I am using a GT540m and I checked my OpenGL version and it is 4.3
If I, then, try to use the performance anaysis tool and trace OpenGL (following the instructions) I always get some percentage of CPU frames and 0 GPU frames.
I have no idea what am I doing wrong. Is there any solution to this or alternative ways to profile OpenGL?
Are you using immediate mode drawing? Ie. glBegin(..); glVertex<> ; glEnd()
From the Nsight User Guide's Supported OpenGL Functions page:
NVIDIA® Nsight™ Visual Studio Edition 4.0 frame debugging supports the set of OpenGL operations, which are defined by the OpenGL 4.2 core profile. Note that it is not necessary to create a core profile context to make use of the frame debugger. An application that uses a compatibility profile context, but restricts itself to using the OpenGL 4.2 core subset, will also work. A few OpenGL 4.2 compatibility profile features, such as support for alpha testing and a default vertex array object, are also supported.
So, replace the immediate mode rendering with newer drawing functions like glDrawArrays and glDrawElements that vertex array objects.
Better yet, create a core profile context to ensure you aren't using deprecated functionality.
My advice: stay away from outdated tutorials online and read the latest edition of the Red book (OpenGL Programming Guide), which only covers modern OpenGL.
You can also try the more basic GPUView tool that can be found in Win 8 SDK
UPDATE:
As for why 0 GPU frames are retrieved, are you sure that your GPU is on the list of supported hardware. I had the same problem where NSight was mostly working (was able to profile other aspects) but 0 GPU frames were collected. Later realized that my card was not officially supported.
Now available Nsight 4.5 RC1, works with cuda sdk 7 RC, and among its features, now support openGL 4.3 !

WGL extension and virtualbox

I'm currently trying to use the old Rendermonkey 1.82 on a WinXP virtual machine running in VirtualBox 4.3.8. Sadly it doesn't work for OpenGL, unable to find WGL extensions (exact error msg is: "WGL PBuffer extensions not detected - please update your driver. Won't be able to proceed with OpenGL rendering.")...
Even if the program works using DirectX, I need it for use with OpenGL
Do you know it there is a solution/workaround to this problem?
Consider also that:
- DirectX based 3D acceleration works just fine
- other OpenGL based programs works just fine
- 3D acceleration is enabled in the vm setting
- Updated GuestAddition installed and working

learning OpenGL ES 2.0 under regular OpenGL - compilation

I am learning OpenGL with an aim to build OpenGL ES application for Android / iPhone.
Since I learn it from the beginning, I would prefer to learn the new specification, without touching the old stuff (glBegin etc.). Unfortunately, when I pass some tutorial and implement stuff, it turns out that the examples are incompatible with ES 2.0. For example, after those excellent tutorials I know how to implement lights, what works on my PC, but would not work on a mobile (gl_LightSource is not supported in the latter).
What I would like to do, is to develop the code on my PC, and restrict the API to the commands that are supported under OpenGL ES (like, throw error on glLight). Is that possible?
Assuming you are using Windows for development, then you can restrict the API to just OpenGL ES 2.0 by using Google ANGLE. ANGLE is basically wrapping DirectX, but you use it through a fully standard compliant OpenGL ES 2.0 interface.
If you have an AMD Radeon GPU, you have another option: the AMD OpenGL ES SDK also provides a fully compliant 2.0 interface.
In both cases, if you accidentally use non OpenGL ES 2.0 features, the code will just not compile or fail at runtime in case of unsupported combinations of parameters. Same goes for shaders, the glCompileShader call will fail.
IF you want to learn OpenGL ES 2 and make sure you are only using calls and techniques compatible with OpenGL ES 2, consider learning WebGL.
WebGL is almost identical to OpenGL ES 2. You get the advantage of a javasript console (with firebug or chrome's built-in developer tools) and in some environments (chrome on windows I think?) you get VERY helpful error messages whenever you do something wrong. Add to that you automatically have access to up to 4 implementations of WebGL to test with (firefox, chrome, safari, opera) and you have a pretty good set of tools for testing your OpengGL.
This is essentially how I have been able to learn OpenGL ES 2.
As stated in the Mali GPU OpenGL ES Application Development Guide:
OpenGL ES 1.1 and OpenGL ES 2.0 are subsets of the full OpenGL
standard. When using the OpenGL ES API, there are limitations that you
must be aware of when developing your applications.
For example, the following OpenGL functionality is not present in
either OpenGL ES 1.1 or OpenGL ES 2.0:
There is no support for glBegin or glEnd. Use vertex arrays and vertex buffer objects instead.
The only supported rasterization primitives are points, lines and triangles. Quads are not supported.
There is no polynomial function evaluation stage.
You cannot send blocks of fragments directly to individual fragment operations.
There is no support for display lists.
In addition, the following OpenGL functionality is not present in
OpenGL ES 2.0:
There is no support for the fixed-function graphics pipeline. You must use your own vertex and fragment shader programs.
There is no support for viewing transforms such as glFrustumf. You must compute your own transformation matrix, pass it to the vertex
shader as a uniform variable, and perform the matrix multiplication in
the shader.
There is no support for specialized functions such as glVertexPointer and glNormalPointer. Use glVertexAttribPointer
instead.
You can always refer to the OpenGL ES specification and see if a function / feature is supported.
There is a good set of lessons available for OpenGL ES 2.0 over at http://www.learnopengles.com/. For developing on PC you can try using an emulator; many different GPU vendors provide their own emulators that translate the calls to desktop GL. However, the best way to be sure that your code works as expected is to run it on the actual device.
EDIT: A new emulator for Android has support for OpenGL ES 2.0: http://android-developers.blogspot.ca/2012/04/faster-emulator-with-better-hardware.html