PDA

View Full Version : Working with Programmable Pipeline on Previous Fixed Pipeline Code



sinaxp19
03-02-2015, 09:58 PM
Hi everyone,
I'm working on an old data visualization code written on fixed pipeline (on OpenGL 1.1, using glBegin/glEnd blocks and Vertex2D, etc.). I need to update the graphical visualization methods to work with Shaders (and thus programmable pipeline). The problem is, as soon as I call glUseProgram() after creating the Shaders, everything becomes new! all background information are deleted (while on the same context) and an empty screen is presented with only Shader-drawn data. Is there anyway I can print my graph (drawn by vertex Shader) on the current screen (drawn by fixed pipeline and including axis, label and other info?)?

Alfonse Reinheart
03-02-2015, 11:12 PM
After you bound your program, did you ever unbind it, by calling glUseProgram with 0?

sinaxp19
03-02-2015, 11:15 PM
After you bound your program, did you ever unbind it, by calling glUseProgram with 0?

I cannot unbind it because later in my render function, I'll need to use that program. Do you mean that I should place my render code inside a glUseProgram(handle) / glUseProgram(0) block and previous screen data will not be modified? I haven't tried this, let me take a test run with your suggestion. thanks :)

*** EDIT ***
It works perfectly Alfonse! you just saved me from weeks of code mapping, thanks :)