Jump to content
  • Advertisement
Sign in to follow this  
ranger_x3

OpenGL OpenGL 3.x Rendering

This topic is 2585 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This is really an open ended question. What do you guys use for OpenGL 3.x rendering?

I've previously done everything with 2.1, but I'm trying to switch over to 3.2 so I can use geometry shaders. I was comfortable doing everything with SFML 1.6 so I tried moving over to SFML 2.0, got the context, but haven't gotten anything to display. I've seen code on how to do it from scratch, but I was hoping to avoid that so I don't end up reinventing the wheel.

Share this post


Link to post
Share on other sites
Advertisement
SFML should work fine I would think, as long as you've got it setup I don't see any reason to change. Maybe you just haven't gotten anything to display because you're doing some 3.2 techniques incorrectly, or missed a step? I would think the initialization should be pretty much the same between opengl 2.1 and 3.2.

Share this post


Link to post
Share on other sites
I use native Win32 and GLEW to get a 3.2 context on Windows and an NSOpenGLContext created with the NSOpenGLProfileVersion3_2Core attribute on OS X Lion.

I didn't need to change too much of my 2.1 code, but I did need to update all my shaders. Most worked out of the box once I changed the keywords around though.

Share this post


Link to post
Share on other sites

This is really an open ended question. What do you guys use for OpenGL 3.x rendering?

I use the latest version of GLFW (from their SVN repository), but SFML should work just fine as well.

I tried moving over to SFML 2.0, got the context, but haven't gotten anything to display.[/quote]
The number one difference that catches people out when moving to a 3.x context? Vertex Array Objects. If nothing is rendering, and your shader compilation isn't giving any errors, then there is a very good chance you have forgotten to create a VAO.

Share this post


Link to post
Share on other sites
For GL 3.2 (or 3.3) and using VAO, there is this Wiki example
http://www.opengl.org/wiki/Tutorial1:_Rendering_shapes_with_glDrawRangeElements,_VAO,_VBO,_shaders_%28C%2B%2B_/_freeGLUT%29

Share this post


Link to post
Share on other sites
I did update my shaders and write an entire matrix stack class. At first I thought my vertices weren't binding to the shaders, but I ran a glQuery and it said that they were all being generated. I thought that I only needed to use a VBO but I'll try switching the code to use a VAO. Thanks for the help.

As for what I'm going to do with geometry shaders, I need it for my senior project for college. Right now I store terrain in a large array and do some basic frustrum culling to know what to display. The terrain is based off of a heightmap created at run time from a 5 different perlin noise functions. I have water implemented as a plane with a procedural texture to simulate movement with the ability to do vertex displacement. The geometry shader would allow me to tesselate the water and generate normals for the water. I can also move to a 3D noise function to generate the terrain with a marching cubes implementation similar to what was outlined in the gpu gems 3 book. Geometry shaders aren't the main focus of the project, it's called "Procedurally Generating Everything." Right now I'm only using Perlin noise for all my work, but I may extend it to cellular and fractal generation for some things depending on how much time I have next semester and whether or not I feel like writing another chapter or two for the paper.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!