Need Sample Code - $50 USD Reward

Okay, so I’m learning JOGL and it’s going pretty well for the most part, but I’ve spent WAY too much time stuck on this one issue and rather than continuing to get more frustrated not being able to figure it out I thought I would offer a reward for what I’m asking for presuming that it is concise and well documented code that serves my purpose.

What I’m asking for:

  • Simple re-usable Object that represents a Texture
  • Uses PBOs if available
  • Uses VBOs if available or falls back to vertex arrays
  • Works similarly to TextureRenderer except only two explicit image types need to be supported (one with alpha and one without)
  • Should provide an “update” method to replace or originally set the texture.
  • “update” method should allow new dimensions to be assigned and the texture should change accordingly
  • “draw” method should be provided for rendering of texture to screen
  • Should work properly with fixed-function or GLSL pipeline
  • Should use SubImage
  • Does not need to maintain any extra stuff or reset anything like TextureRenderer does when drawing, positioning, coloring, etc. should be managed outside of this.
  • Needs to take in a BufferedImage as an “update” argument with an x, y, width, and height so as to only take a portion of the BufferedImage rather than a whole BufferedImage
  • Must not keep a reference to the BufferedImage except in the “update” method when replacing the texture as the BufferedImage will be reused.
  • Must have complete mipmapping support to appear as clean and concise as TextureRenderer does
  • Must be documented and understandable
  • Must be self-contained. No references to any JOGL-specific (TextureRenderer, TextureData, etc.) Objects or 3rd party APIs.

This list is derived by what I understand (as a noob with OpenGL) as best-practices and if someone provides a valid implementation of my needs yet has good reason for breaking some of these requests I will readily consider it if explained.

I know $50 isn’t really much to offer, but this is not a purchase of code, you are free to use the code yourself or release it to the community. Also, I will make a post as soon as someone submits valid code fulfilling all the requirements and will only pick one person so you do run the risk of writing some code and not being chosen. :o

Please feel free to drop me a message if you have any questions. Feel free to post your code directly here or PM it to me and once a submission fulfills the requirements I will work out payment.

Asking an OpenGL expert to work full time for like a month for 50$ ?

sounds like a interesting task. so why not?

but:

how can a texture make use of vertex buffer objects or vertex arrays?

I bet he confused VBOs with FBOs, and then knew VAs had something to do with VBOs.

Either that, or he knows TextRenderer uses either VBOs or VAs, and he thinks he needs one of those in a Texture class.

Further, we all know that this is a work-related project for you, and $50 for such a beast, which you get paid for, and can exploit commercially, is… laughable. I mean… expecting mipmapping to work out of the box in combination with SubImage AND resizing the texture (which means NPOT)? That is quite a bit of work, even if you’re going the do it the bruteforce (slow) way.

Really? I’ve gotten everything working with a couple hundred lines of code and I’m an amateur. Of course I’m not using PBO (which I didn’t think would be that complicated if I just understood how to switch) and the mipmapping just doesn’t look right and I haven’t been able to figure out if it has to do with the NPOT or something else.

Just like TextureRenderer actually has a draw method to actually render the texture to the screen on a quad in immediate mode I want to have the same functionality, but using VBOs or vertex arrays for the quad.

Not commercially, but in an open-source project. I do obviously gain by this or I wouldn’t be offering money to get it done, but the goal for me is primarily that of learning. I’m not trying to force anyone to do anything. If it’s not worth $50 to do it then don’t, but I just assumed many of you have probably already written all of this functionality before and would be a simple matter of copying and pasting and cleaning up to provide it.

Here are links to the code I’ve already written that doesn’t quite work and still needs a lot of cleanup before it’s very useful:

http://jseamless.googlecode.com/svn/framework/branches/2.0/src/java/org/jseamless/gl/Shape.java
http://jseamless.googlecode.com/svn/framework/branches/2.0/src/java/org/jseamless/gl/GLTexture.java
http://jseamless.googlecode.com/svn/framework/branches/2.0/src/java/org/jseamless/gl/ShaderUtility.java
http://jseamless.googlecode.com/svn/framework/branches/2.0/src/java/org/jseamless/gl/TextureUtility.java
http://jseamless.googlecode.com/svn/framework/branches/2.0/src/java/org/jseamless/gl/VertexUtility.java

You are welcome to base code on this if it helps, I just assumed since I’m still a noob you guys would write much more efficient and effective code than I would, so I was leaving it open to you. Like I said, the main problems I have with that code is the it doesn’t use PBOs and the mipmapping just doesn’t look quite right and it very well may be NPOT issues, but I don’t know and have been stuck on it for so long it brought me to ask for help.

Just to provide you with some trivial information:

You really do not want either VBO or VA related code in your Texture class.
It limits you to 1 quad per render call anyway, which is probably even fastest in immediate mode.

Just keep your geometry (quads, triangles) out of your Texture class, seriously.

I agree with Riven. sunsett, you won’t see any improvement by using VBO to draw a single quad. The use of vertex arrays and VBO becomes interesting when you have at least tens of triangles.

Ah, good to know. I guess the only critical item for me is to resolve my appearance issues with mipmapping…if I enable auto-mipmapping the content from a distance looks faded whereas with TextureRenderer it looks perfectly crisp. Since it doesn’t seem anyone is interested in taking me up on my offer is there a good tutorial on properly handling NPOT + mipmapping?

It has to do with gamma correction.

That makes sense, but I don’t understand how to actually apply that…

Sample code is provided in that link…

So, just to spoonfeed: the parameters a,b,c,d are 4 values of 1 channel of the 4 pixels, like: R, G or B. So you simply get your typical 2x2 block of pixels, grab the R,G,B values, normalize to 0…1, pass each set of each channel into that function, and you end up with 1 value per channel, multiply by 255 you got your resulting pixel. Don’t expect it so be fast, at 3 or 4 sqrt() per pixel, but well, it will get rid of your ‘shade’ in sharp contrast textures.

I think Riven should get the 50.