Posted by
xghost on
Jul 22, 2014; 10:29am
URL: https://forum.jogamp.org/Need-Help-Solving-OpenGL-GLSL-4-4-Issues-tp4032557p4032620.html
gouessej wrote
However, why do you expect to see a triangle whereas you use GL_POINTS with glDrawArrays (and you ask it to draw a single primitive)?
I've been using different examples as part of my posts to make different points or point out different details. I am
not expecting a call using GL_POINTS to draw triangles.. I've simply posted code from different demos to illustrate different things and I thought I had been clear enough on these details. I suppose this could be easier to miss by speed-reading(?)
To be more precise, the Java code I posted that specifically tries to draw a pixel was to show the problem of being unable to alter fragment colors or vertex positions with hard-coded shaders and I used a simple triangle drawing application from the OpenGL Super Bible 6 codebase to illustrate the point I was making --that it works fine when I'm
not using JOGL. I could've chosen some other sample to illustrate the same thing (e.g. the one that draws a single pixel), but the choice does not make a difference on what I'm trying to point out...
The code I posted about the triangle which, if you look in one of my earlier posts,
does use GL_TRIANGLES in the call to glDrawArrays and specifies 3 vertices should be used..
gouessej wrote
Why do you put no vertex data into the VAO? I don't see how this code could draw a triangle.
I did not place data in a VAO because it is not a requirement for the samples to do what I need them to do in their current form. (If you think this understanding is wrong, please do point it out, but please look at the examples below first.)
To illustrate, consider the following code (in C++) that draws the primitives by hard-coding the values in the shader because, again, these are supposed to be simple demos.
1.
https://github.com/openglsuperbible/sb6code/blob/master/src/singlepoint/singlepoint.cpp 2.
https://github.com/openglsuperbible/sb6code/blob/master/src/singletri/singletri.cppYes, a VAO is created/destroyed, but data is
never put into it. The shaders also do not take inputs from the C++ code (or the Java code in my case) because the data for the primitives is hard-coded in the shader for these demos.
Again, this is intentional. When I compare the working C++ code to the JOGL-based code that I wrote, I fail to see a difference when we compare equivalent examples, and I certainly do not see why the C++ sample works fine while the JOGL-based analogue does not.
I hope this clarifies what seems to be a misunderstanding here.
Please let me know if you still have unanswered questions or if the questions I've already addressed are not as clear as I had hoped.
Thanks.