The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Triangle will not render
Justin Agrell
Guest

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.
Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Triangle will not render
Jonas Kulla
Guest

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:
Quote:
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.
Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Triangle will not render
Robotic-Brain
Guest

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

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org