Jump to content
  • Advertisement
Sign in to follow this  
borrax

GLSL Shader for primitive graphics

This topic is 2126 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

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.

Share this post


Link to post
Share on other sites
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)

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!