---
title: "OpenGL SuperBible in Java: The GLShaderManager class - Part2"
description: "Learn how to separate GLShader and GLShaderFactory responsibilities in Java for efficient OpenGL programming.  This tutorial builds upon a previous post adapting C code to Java, offering a cleaner, more organized approach to creating default shaders.  Get the source code now!\n"
slug: "OpenGL-Superbible-in-Java-The-GLShaderManager-Part-2"
created: 2011-10-25T00:00:00Z
updated: 2011-10-25T00:00:00Z
tags:
  - "java"
  - "opengl"
  - "opengl-superbible"
  - "lwjgl"
ai_assisted: false
---

In the [last post][1], we saw how to adapt the `GLShaderManager` from the C code to Java. But the C code from the book actually has 2 responsabilities, the first is actually being a GLShader, and the second is being a factory to create several default Shaders.

In the Java implementation, I decided to separate those responsabilities and created a class `GLShaderFactory` that has method to create the default shaders. Theres no need to go in detail. The shaders are the same from the book.

The code for the `GLShaderFactory.java` is available [here][2]

[1]: /2011/10/24/OpenGL-Superbible-in-Java-The-GLShaderManager/
[2]: http://code.google.com/p/opengl-superbible-java/source/browse/OpenGLSuperBible/src/openglsuperbible/glutils/GLShaderFactory.java