GLSL Shader for primitive graphics

Started by
0 comments, last by ScherzkeCks 10 years, 7 months ago

I want to make primitive graphics. Instead of textured polygons I want solid color polygons, and use lines for details. I have written an entirely software based 3D renderer in java that uses that approach based on a 3D graphics book from 1995. I have an array to represent all pixels on the screen and do all the processing on CPU side, then passes the array to openGL to render as a texture on a quad, creating a full screen 320 by 240 pixel resolution. You can see the results here:

It works, it even has a z buffer that handles transparency by depth sorting pixels, but it's slow. I think I can speed things up by doing it in the hardware with shaders and C++ ( not looking to debate java vs c++, but I am trying to get better at c++ so that what I feel like using ). My java project taught me a lot about the fixed function graphics pipeline as it existed in the early 1990s, but I can't wrap my head around shaders.

To make things worse, I'm trying to make a shader for bad graphics, and modern graphics programming all seems to emphasize textures, so I can't find a tutorial.

I will write my "models" directly in the code, with arrays to hold vertex, polygon, and color information. I will have to pass the color for each polygon to the shader, and I don't have a clue how to do that.

I also need to draw lines, and need a z buffer that does depth sorting so transparency looks good, but I can try to figure those out after I have the basic knowledge about drawing polygons.

If you have any experience or know about any tutorials I'd appreciate it. Or even a book, I still like crappy graphics and I still like books. My computer is probably using roman numerals for 1s and 0s.

Advertisement

Hi borrax,

maybe these tutorials are something for you: http://www.opengl-tutorial.org/beginners-tutorials/tutorial-2-the-first-triangle/

They take the modern approach with OpenGL4 (or 3.x if you use the modern stuff in 3 ;) ) and I found them quite helpful.

Other than that, if you are serious I can only recommend the RedBook which tells you pretty much everything about OpenGL. (ISBN:0321773039)

This topic is closed to new replies.

Advertisement