Person having trouble with the same openGL book.

http://stackoverflow.com/questions/25348958/kevin-brothaler-opengl-es-2-tutorial-code-is-wrong

Looks like some helpful hints here.

Lesson 3 source can be found here.
But is not the official source. (If there is any)
https://bitbucket.org/danil_minibaev/vedroid-ogl-es2-tutorials/commits/13a9a078e15e136ed3b9e5e4442641e9c0f84daf

Note to self: Should have bought my openGL book directly from
“The Pragmatic Bookshelf” instead of Amazon.com.
They are offering DRM free eBook versions.
https://pragprog.com/book/kbogla/opengl-es-2-for-android

Ah! Official source code here.
See if I can get the official source code running.
https://pragprog.com/titles/kbogla/source_code

Advertisements

Need 50 reputation on stack overflow

http://stackoverflow.com/questions/27071418/android-4-1-x-opengl-es-2-0-failed-to-link-shaders

This person seems to be having the same problem I am.
And it is specific to Android 4.1 and 4.2 it seems.

But… I can’t leave a comment stating I have the same problem, or get
ahold of them in general.

I find I have this problem on stack overflow a lot.
But it is probably by design that I can’t reach out and communicate
with people on there.

Compiling program in correct context?

I read something about in OpenGL things don’t exist unless the proper context
is set… Maybe my program linking is failing because the proper context is set?

Maybe all the commands are correct. And the source shaders are correct.
But some type of state/context needs to be set properly before my
code is called?

Or possibly a driver bug?
http://stackoverflow.com/questions/1938466/unable-to-link-compiled-shaders-glsl

But that doesn’t make any sense. I’ve gotten code to work.
Just never code that I’ve done step-by step without copying.

So I feel like the error is me.

Maybe I need to somehow append C-Style null terminated lines to my
shader source strings?

This thread:
http://gamedev.stackexchange.com/questions/33989/shaders-not-linking-correctly

Makes mention of a program called gDEBbugger.
I guess it is not uncommon to have zero errors in compilation of shaders,
but then have error on linking for unknown reasons.

Looks like AMD took over developement of gDEBbugger and
that gDEBbugger is being replaced by CodeXL
http://developer.amd.com/tools-and-sdks/archive/amd-gdebugger/

CodeXL Landing Page:
http://developer.amd.com/tools-and-sdks/opencl-zone/codexl/

shaders compile but do not link openGL

Narrowed down my problem.
Shaders successfully compile…
Program handle is successfully made.
But linking of program fails…

Solution not covered here. But good read.
OpenGL: Why is your code producing a black window?
http://retokoradi.com/2014/04/21/opengl-why-is-your-code-producing-a-black-window/

Stack Overflow maybe?
Unable to link compiled shaders:
http://stackoverflow.com/questions/1938466/unable-to-link-compiled-shaders-glsl
^^
This is telling me my code for reading in the shader might be printing some
bad characters or something?

Common OpenGL Pitfalls

https://www.opengl.org/wiki/Common_Mistakes
Interesting notes:
1: glDrawPixels() command.

2: Slow pixel transfer performance
Pixel Transfer: https://www.opengl.org/wiki/Pixel_Transfer
2.1: glReadPixels
2.2: glTexSubImage

https://www.opengl.org/archives/resources/features/KilgardTechniques/oglpitfall/
4. Overflowing the Projection Matrix Stack
glPushMatrix
glPopMatrix
glGetIntergerv to see max depth of stack supported.
Default/Min requirement: 32 for ModelView Matrix, 2 for everything else.

7. Watch Your Pixel Store Alignment
pixels = (GLubyte*) malloc(3 * 11 * 8); /* Wrong! */
OpenGL's default 4-byte row alignment.

10. The Viewport Does Not Clip or Scissor

12. OpenGL's Lower Left Origin
Will affect reading in textures. Because it will try to
read from the bottom most scan line first.

15. Much OpenGL State Affects All Primitives
This issue is not unique to the per-fragment and rasterization state. The pixel path state is shared by the draw pixels (glDrawPixels), read pixels (glReadPixels), copy pixels (glCopyPixels), and texture download (glTexImage2D) paths. If you are not careful, it is easy to get into situations where a texture download is screwed up because the pixel path was left configured for a pixel read back.

A bit of hacking:

http://pastebin.com/6eNAYqJe
From my kevin021 that covers up to INCLUDING chapter 3 of my openGL book.
Thoughts:
1. Maybe there should be a position pointer reset in that function?
2. Maybe uColorLocation = glGetUniformLocation(program, U_COLOR);

Current plan:
1. Find source for lesson 3.
2. Assemble source.
3. Run source.
4. Get source working.
5. Re-do chapter 3 by hand.
6. Diff the two projects in a differ to see where I made the
critical mistake that is stopping the rendering from showing up.

Chapter 3 Failure.

Wow… OpenGL… Errors… Are silent and hard to find I guess.
You’d think I’d be rendering triangles flawlessly by now.

It’s been over a week and I still haven’t mastered the OpenGL
equivalent of “Hello World”???

Kevin on hard to find open GL Errors:

“Passing incorrect arguments to glVertexAttribPointer() can lead to strange
results and can even cause the program to crash. These kinds of crashes
can be hard to trace, so I can’t overstate how important it is to make sure we get
these arguments right.”
Page 50: OpenGL ES 2.0 for Android.