TheThinMatrix / OpenGL-Tutorial-2

Code from the OpenGL tutorial on Youtube: https://youtu.be/WMiggUPst-Q
17 stars 6 forks source link

Missing Rectangle #1

Open ttl-03 opened 5 years ago

ttl-03 commented 5 years ago

In the video, it says there should be a rectangle in the middle of the window but all I see is a red background. Is that how it should be? If not what might be the issue?

cristianrgreco commented 5 years ago

I had the same issue. I soldiered on through the tutorials and I can see the rectangle successfully by the end of tutorial 4 🙂 (once you've created the vertex/fragment shaders).

maslag commented 5 years ago

Could you please confirm what platform you're running on? I've ran into the same under Ubuntu 19.04, with OpenGL version 4.5 (Compatibility Profile) Mesa 19.0.2. My graphics card is a RX 460, although that shouldn't make any difference since OpenGL is hardware independent.

TM uses Windows on his tutorial series, and I suspect most of the people that follow them do so as well - I suspect that the difference in functionality comes from the fact that we (on Linux) target the X Window System whereas they (on Windows) target the Windows Desktop Window Manager.

My guess: X "doesn't like" us not supplying the vertex & fragment shaders, and so when we load up our model and try to render, it doesn't actually render anything (or perhaps it defaults to the background color supplied by our prepare() function), whereas Windows either "doesn't mind" (unlikely - see below) or it just defaults those to white.

Nonetheless, it should be emphasized that all OpenGL applications should have a vertex and fragment shaders at least. Quoted directly from the OpenGL Programming Guide:

"The most common are vertex shaders, which process vertex data, and fragment shaders, which operate on the fragments generated by the rasterizer. Both vertex and fragment shaders are required in every OpenGL program. (Page 4)"

slimypeehands commented 4 years ago

Mine doesn't work either and I am on mac so that would make sense

Could you please confirm what platform you're running on? I've ran into the same under Ubuntu 19.04, with OpenGL version 4.5 (Compatibility Profile) Mesa 19.0.2. My graphics card is a RX 460, although that shouldn't make any difference since OpenGL is hardware independent.

TM uses Windows on his tutorial series, and I suspect most of the people that follow them do so as well - I suspect that the difference in functionality comes from the fact that we (on Linux) target the X Window System whereas they (on Windows) target the Windows Desktop Window Manager.

My guess: X "doesn't like" us not supplying the vertex & fragment shaders, and so when we load up our model and try to render, it doesn't actually render anything (or perhaps it defaults to the background color supplied by our prepare() function), whereas Windows either "doesn't mind" (unlikely - see below) or it just defaults those to white.

Nonetheless, it should be emphasized that all OpenGL applications should have a vertex and fragment shaders at least. Quoted directly from the OpenGL Programming Guide:

"The most common are vertex shaders, which process vertex data, and fragment shaders, which operate on the fragments generated by the rasterizer. Both vertex and fragment shaders are required in every OpenGL program. (Page 4)"