Most of your question suffer from the same problem: They either include too much and irrelevant code, and/or they are missing important parts. I know that this is hard with OpenGL, since even a minimal program already contains several hundred lines of code.
I should probably add, that being very at the beginning of learning a new technology is probably not the best time to ask questions on Stack Overflow. SO has a very high bar for quality and a lot of research is being expected before asking, but it is hard to know the correct terms to search for when you are a beginner. Keep in mind that the main goal of Stack Overflow is to build a repository of high-quality questions and answers. Helping the asker is also important, but second to helping a lot of people. 1-1 mentoring is usually not going to work well here.
glGetUniformLocation() throws 'ctypes.ArgumentError: argument 1: TypeError: wrong type' [closed]
The question is based on a typo that wasn't obvious because the definition of get_program_id
wasn't included. On the other hand a lot of other code irrelevant to the problem was posted (shader code never causes a python runtime error). I'm not sure if posting the question in a different way would have prevented the downvote, since it would still have been caused by a typo. But you would have prevent the back and forth in comments.
Why do objects in my window sometimes disappear and reappear?
There are two major problems here. First, the question asks about disappearing objects, but nothing in the question ever tries to draw an object. Only the screen get's cleared. Second, the question again contains not the right amount of code. There are a few snippets, but it's rather unclear how they are connected. You talk about your main loop, but the code of the main loop isn't included. Even after reading your answer, it is imho impossible to diagnose the problem, because the fix is in some code that isn't shown.
My texture is being displayed as completely black in pyOpenGL
Again, parts of the relevant code is missing. Here, the shader is highly relevant, because there are different methods to access a texture, some of the require certain pre-conditions (like texture(...)
requiring a valid mipmap pyramid), while others don't (like texelFetch
).
The question also asks about a very common problem when working with textures and has tons of duplicates on SO and also offsite. I went ahead and added three duplicates.
Your self-answer probably received a downvote, because it is only half true. Yes, adding that code solves the problem. But the code doesn't have to be placed before glTexImage2D
. It just has to be set before using the texture in a shader. In general, an answer should also try to include an explanation on why you have to do something besides showing what to do (see comment on the answer).
Disclaimer: Since some of the question were posted in my area of expertise, I've interacted with some of them before the question here was posted