Triangle will not render

I’m getting started with SDL2 and modern OpenGL.
I am having trouble getting the triangle to render in my template:

source code here: http://u4e.us/c/main.c

This may be due to my laptop only supporting OpenGL 3.1.

glxinfo |grep "Core Profile"
OpenGL core profile version string: 3.1 (Core Profile) Mesa 9.1.8

It also may be because I have been staring at it for too long and am
missing something simple.

Any help would be appreciated.

A couple things:

Don’t use glFrustum, that’s GL1 stuff for modifying the current matrix.
Implicit matrices have been deprecated in OpenGL (the entire
Push/Pop/IdentityMatrix shebang). If you need matrices, pass them directly
as uniforms into your shaders. (But for a simple triangle, whose vertices
you have already defined in screen space anyway, you don’t).
In the render loop, you’re disabling the vertex attrib array but never
enabling it again thereafter. Might want to look into that.
Finally, you didn’t post your shader sources, so it’s impossible to know if
something is wrong there. I can’t even tell what color it’s outputting.

Jonas

2014-09-17 3:29 GMT+02:00 Justin Agrell :> I’m getting started with SDL2 and modern OpenGL.

I am having trouble getting the triangle to render in my template:

source code here: http://u4e.us/c/main.c

This may be due to my laptop only supporting OpenGL 3.1.

glxinfo |grep "Core Profile"
OpenGL core profile version string: 3.1 (Core Profile) Mesa 9.1.8

It also may be because I have been staring at it for too long and am
missing something simple.

Any help would be appreciated.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

You’re not uploading any shaders.
The fixed function pipeline was deprecated in GL3+

Ok!!–
View this message in context: http://sdl.5483.n7.nabble.com/Triangle-will-not-render-tp42579p42648.html
Sent from the SDL mailing list archive at Nabble.com.