opengl-compat

GLSL fixed function fragment program replacement

匆匆过客 提交于 2019-11-27 02:12:20
When using the OpenGL fixed function pipeline for vertex setup, how a fragment program looks like that is compatible to the fixed function vertex setup? I guess that usually depends on the number of light sources and texture layers etc.. So for example how does a simple non-texture one-lightsource goraud shading fragment program look like that replaces GL's fixed function shader? While Gouraud shading calculates the light in the the vertex shader, Phong shading calculates the light in the fragment shader. The standard OpenGL light model is a Gouraud shading model, with a Blinn-Phong light

OpenGL translation before and after a rotation

余生颓废 提交于 2019-11-26 12:33:49
问题 The following is code (taken from http://www.glprogramming.com/red/chapter03.html) regarding how to draw a robot\'s arm and shoulder and rotating them by some user input: glPushMatrix(); glTranslatef (-1.0, 0.0, 0.0); glRotatef ((GLfloat) shoulder, 0.0, 0.0, 1.0); glTranslatef (1.0, 0.0, 0.0); glPushMatrix(); glScalef (2.0, 0.4, 1.0); glutWireCube (1.0); glPopMatrix(); glTranslatef (1.0, 0.0, 0.0); glRotatef ((GLfloat) elbow, 0.0, 0.0, 1.0); glTranslatef (1.0, 0.0, 0.0); glPushMatrix();

GLSL fixed function fragment program replacement

旧时模样 提交于 2019-11-26 09:14:17
问题 When using the OpenGL fixed function pipeline for vertex setup, how a fragment program looks like that is compatible to the fixed function vertex setup? I guess that usually depends on the number of light sources and texture layers etc.. So for example how does a simple non-texture one-lightsource goraud shading fragment program look like that replaces GL\'s fixed function shader? 回答1: While Gouraud shading calculates the light in the the vertex shader, Phong shading calculates the light in