shaders with jogl

I have a few questions about shaders, some of which apply to JOGL and others are basic opengl operation:

  1. When getting the shader info log, we’re supposed to pass in a byte buffer. Since in java, chars are 2 bytes (I think it’s only 1 in c/c++), so will the byte buffer have to be 2 * number of chars in the info log? and will the byte buffer’s method getChar(index) still work correctly?

2)When using glDrawPixels and there’s a shader program linked, will the fragment shader get used?

3)Do you have to use glCreateShader(type) to get an id, or can you call glShaderSource(…) with a predefined id and have it make a shader for that id?

Thanks

Alright, I answered my the third question, you can’t, which is what I figured. The other 2 I have yet to sit down and experiment with, so if anybody out there with more experience than me already knows those answers, it’d be much appreciated.

I can’t be bothered to look into the specification on this at the moment, but I’d assume that since there’s no concept of vertices and as a result attributes and varying variables, I’d find it unlikely that the fragment program would be used. Though if it were to work it would have to be an incredibly boring shader.

But like I said I’m not going by anything in the spec, just an off the cuff thought experiment.

I looked at the spec for 2.1 and it says:

If a fragment shader is active, the executable version of the fragment shader is used to process incoming fragment values 
that are the result of point, line segment, polygon, pixel rectangle or bitmap rasterization rather than the fixed-function fragment 
processing described in sections 3.8 through 3.10.

so it looks like for glDrawPixels() the shader will still get executed. My guess would be that the vertex shader wouldn’t be used, since there aren’t any vertices present. The reason I was wondering was because I wanted a simple way to evaluate data stored in a buffer using the fragment processor and then read back the results at each pixel. Using glDrawPixels, is much easier then computing the inverse of the entire matrix transform and projection onto the screen in order to generate a quad to cover the correct number of pixels.