Pointer to Framebuffer

[/QUOTE]I think OpenGL is awesome, but tying a developers hands in any way is not a good thing, and being the parent by saying, “We’re not going to let you have that. You might hurt yourself”, is also most likely not going to make Joe Developer who has been coding for 30 years very happy.[/QUOTE]

tying the developers hands? Have you not read the many extensive posts on this topic? What about tying the hands of the h/w vendors? <smacks his head against the wall> it isn’t just a matter of stopping developers from doing what they want to do. You forget… an operating system is meant to manage LOTS of different processes. It isn’t just an opegnl thing. freak, some unix systems beat the compiler around the head to follow conventiosn so everything can talk to each other and be civil. its not just a matter of a single user and a single process thinking its somehow more important than anything else. What do you want next? pointers to semaphores so you can override locks?! Pointers to the IVT so you can change interrupts at WILL with no regard to any other process? How about network mapped pointers to every machine connected to the internet (so long as you promise not to shoot yourself or any other user in the foot PUH-LEASE)??

Its not a matter of sulking because someone is not giving you a feature. Give up on it. Get over it. Stop crying about something you shouldn’t have. I can only assume you guys don’t program in object orientated langugaes (but i WANT to see this private variable even though i’m not a member of the class and i can’t make it a friend), or a functional language (but i WANT state and side effects, even though tihs will invalidate the implicit parallelism) or a multi user operating system (but i WANT to be able to get chmod a file, even though I don’t own it), or any myriad of other things.

operating systems are, these days, sufficiently complex as to enforce a large set of rules so every process may play happily together. Yes, the operating system will stop a given process from doing stuff. JVM’s in your web browser, for example, won’t let just ANY byte code do anything to the parent o/s. (but, hey!! look what happens when Outlook will let just ANY script execute, because it KNOWS that program writers won’t shoot themselves in the foot, 'cos the programming community is just a BIG HAPPY FAMILY!!)

Bleah. BLAH. I say again, BLAH. Go to an o/s course. Ask THEM what they think about protecting s/w from shooting themslevs in the foot. See just HOW MUCH of it is done by other parts of the o/s, INCLUDING the compiler (in some cases).

Hell, even Sun Microsystems are dead keen on writing their own device drivers because they don’t want to give supervisor priviledges to just ANY piece of code. Microsoft have to jump through hoops with virtual device drivers and all the rest of it to try and combat instability from third party code with o/s access privildges.

grr

John

Hey John…lighten up.

I don’t think you are going to encourage people to see your point of view by insulting them.

I have programmed on both sides of the fence and I do understand the need for private variables and have also written my code as of late to be as globally free as possible.

I think most of us here can appreciate the need to keep the OS happy and I for one don’t think my application is that important. I strive to make my programs as friendly to the OS as possible. I perform garbage collection, save and restore any settings the program may have modified while operating, and try to keep resources low when the application is minimized.

I’m sure you could easily make us all look like 1st graders with your extensive knowledge of the subject. Try to remember that we each have talents and we are not asking for pointers to every friggin resource on the computer. I for one would be more than happy at this point with a fast gldrawpixels *glreadppixels.

Do I think it’ll happen? Almost certainly not.

Let’s say this. What if GL provided a Special buffer that would be specific to the process that needed it. Almost something akin to a Private Variable. Only Program A could access it. Program B could also have it’s own Special Buffer. I think this is called Virtual Memory Mapping but I’m sure I’ll be corrected if I’m mistaken. Now let’s say I could get a pointer to that and that was used as the Framebuffer.

I’d be willing to take the performance hit for 3D in cases where I had mainly 2D.

I’d like to know how John would feel if all pointers were taken away. You seem ready to make a point that we want pointers to everything under the sun. How about no pointers? How about we just make everything accessed through some OOP interface? While it might look pretty, you would most probably see a performance hit.

Hello,

lighten up? Coming from the guy who previously derided to sarcasm and petty insults just a few posts ago? Incidentially, NEVER call me dear ever again.

There are two parts to this message:

  • explaining how you missed my point “pointers to everything”, and
  • why pointers are not all that good

Firstly: You miss the point when I retort “but next you will want pointers to the printer because it prints too slow.” It is attacking the form of your argument to show that your argument is flawed EVEN from its form. Its a common enough trick, incidentially. For example:

All octopi live in the sea
All octopi have tentacles,
Therefore:
Everything living in the sea has tentacles.

Now, without even knowing anything about marine life, this argument can be shown to be structually flawed (irrespective of whether it is correct or not, although it should be well known that the conclusion is wrong). If its shown to be structually flawed then this is a good enough reason to not support the arguments.

I mean, this could equally be applied to:

All widgets have Gadgets
All widgets use Thingymabobs,
Therefore:
All Gadgets use Thingymabobs.

You just need to use another agument with the same structure that is demonstratably wrong to undermine the argument. Feh. This is not new. Even Lewis Carroll uses an example in Alice in Wonderland:

“I mean what i say… I mean, I say what i mean. It’s the same thing, you know,” says Alice. To which the Mad Hatter retorted something along the lines of:
"No. Its like saying that “I like what I eat” is the same as “I eat what I like”, or “I breath when I sleep” is the same thing as “I sleep when I breathe”

It’s attacking the form of the argument to demonstrate that its unsupportable.

You said that you needed a pointer to the frame buffer because this will make it faster.

If THIS is your stance, I counter, then a pointer to ANYTHING will make it faster. BUt, clearly this is wrong. A pointer to the PRINTER won’t make it faster, because hte printing speed is independent on how it is addressed. I was demonstrating that your argument as you proposed it (pointer==speed) is unsupported.

okay, okay. I’m settling down. <relaxes… breathes cool, fresh air>

no, seriously. =) haha. I jest. I get excited sometimes about stuff.
What i say is true, tho’, but I guess i could have been more “gentler” about it. A thousand apologies.

But, I digress. Briefly, then:

Seocnd point: Pointers are NOT that important and they aren’t that magical, and (in fact), they ARE seen to be eville.

Why do you need pointers? A common enough reason is the argument “because I don’t want the compiler to dereference my array indicies”. THere are others (and i’d like to hear them, eh), but ppl seem to think that:

GLubyte buffer[10000], *ptr;
int t;

for(t=0, ptr=buffer; t<10000; t++) 
  *(ptr++)=0;

is somehow faster than

GLubyte buffer[10000];
int t;

for(t=0; t&lt;10000; t++)
  buffer[t]=0;[\CODE]

Who thinks this?  Why?  I mean, some have said that to compute buffer[t] the compiler has to multiply t by the size of int and add it to buffer to get the address... which is more work than just incrementing the pointer.  Right?  But.. the compiler can see this, too.  Once upon a time that argument WAS valid, because compilers were dumb.  But compilers are sufficiently complex these days that they do a HELL of a lot of flow analysis to see that buffer[t] CAN be automagically transformed into pointer arithmetic.  Its like unrolling loops, too.  Once upon a time the prorgammer had to unroll loops, but.. these days.. compilers know about loop unrolling.  They even know about cache sizes, too, and so know just how MUCH unrolling is going to be beneficial to pack it into a cache line, and so on.  Compilers know this stuff. 

So, when is a pointer useful?  Certainly there is a whole class of languages which get by quite happily WITHOUT a pointer.

Pointers are also seen to be bad because they impede flow analysis by changing state behind the compiler's back because it makes it difficult if pointers refer to the same data.  Hmm.  I can't remember more of this.. I fell asleep during that lecture. hmm.  (It was a coupel of years ago, too, so... oh, and compiler construction was two years before that again, heh=)

Pointers aren't magical.

But I apologise for getting carried away =)  Your diea is good, tho'.

cheers
John

Well…you are a fiesty chap, aren’t ya.

Where did you learn that speed gains don’t make programmers lazier? It most certainly does. Case in point…Windows. Am I the only one that notices the enhanced bloat and slowdown associated with each new release? And yes, if I can make a 3D modeling program that kicks out 10-12fps with texturing and blending, why is it that every demo, or GL application I have run into is running something on the order of 1-2fps.

I’m sure I’m not the only one that feels this way.

I have developed both so I wait to stand corrected. If you don’t think it takes work to optimize code then maybe you haven’t coded assembly. I am not going to even try to incite a flame war as that would be unproductive, but as of late, many programmers simply view programming as features and add speed later(if at all). It only takes a small amount of planning and a state of mind to write efficient code from the get go. I’m not suggesting you should go as far as unrolling loops(that is no longer a proper optimization method), but there are many ways to write the same piece of code.

Written as a retort to the comment that optimization was easy.

O.k., maybe you think we should all go out and buy G2’s. You’d make a great salesperson for NVidia. I think you may think everyone and his Uncle has a great system with great specs. Sorry to break it to ya, but most of the people with high-end systems are gamers. While the gaming community may be large, it is not the majority. Maybe you think everyone has high-speed internet connects as well?

I don’t see anything here as a direct insult rather making another optimization that I have run into all of the time. The tendency to think everyone has a system that is tweaked when in fact they do not. Also as a retort to-

How is not optimising for software OpenGL being lazy? The vast majority of users have hardware accelaration. IMO it would be a waste to invest a lot of time for a minority of users, when you could invest your time in making your software better. I would also suspect that those users who run software OpenGL don’t buy products that need OpenGL, since for the price of a game (or less), you can buy a 3D card that does support OpenGL in hardware.

and…

[sarcasm]You know ET3D, you’re right, just because I can’t afford a video card, I can’t complain. What was I thinking. Only those with good hardware setups have that right.

Yeah, those are some good comparisons John. A printer, and a harddisk. Yeah, be a dear and get me pointers for those too while your at it.

VESA was unfortunately not as widely adopted as it should have been, but yes, I had learned it and hoped it would be adopted. Thank god we have advanced to the point where hardware determines what we need. Now the people selling the cards get to determine our fate.

Shared resources are nothing new, and yet still…some applications DO mess up other programs. You’d think with all the restrictions in place, nobody would have gotten through, so the obvious solution is more restrictions.[/sarcasm]

I am over assembly and only used it as an example of a program that utilized software means to provide the speed, and yes Assembly is dead.

[MORE sarcasm]Gee, I’ll bet you all can’t wait till they make CISC chips that process C commands and they completely do away with Machine code/Assembly all together. Of course C would then become just as unused because it would be too hard and too unstable.[/MORE sarcasm]

This is probably my main rant…Yes I was sarcastic, but thankfully most people would see that from the nice SARCASM tags that I embedded. I will defend myself if attacked.

and in the end…

Well, I apologize for being rather inflammatory as well. I tend to feel very passionate about issues and do take things personally at times(something I need to work on). I just didn’t see what people were saying as being helpful but rather being negative.

But after reading your reply to OpenGLRox who didn’t make any inflammatory comments like myself before the calvary got sent in to shut me up, you said-

tying the developers hands? Have you not read the many extensive posts on this topic? What about tying the hands of the h/w vendors? <smacks his head against the wall> it isn’t just a matter of stopping developers from doing what they want to do. You forget… an operating system is meant to manage LOTS of different processes. It isn’t just an opegnl thing. freak, some unix systems beat the compiler around the head to follow conventiosn so everything can talk to each other and be civil. its not just a matter of a single user and a single process thinking its somehow more important than anything else. What do you want next? pointers to semaphores so you can override locks?! Pointers to the IVT so you can change interrupts at WILL with no regard to any other process? How about network mapped pointers to every machine connected to the internet (so long as you promise not to shoot yourself or any other user in the foot PUH-LEASE)??

and this very nicely worded argument-

Its not a matter of sulking because someone is not giving you a feature. Give up on it. Get over it. Stop crying about something you shouldn’t have. I can only assume you guys don’t program in object orientated langugaes (but i WANT to see this private variable even though i’m not a member of the class and i can’t make it a friend), or a functional language (but i WANT state and side effects, even though tihs will invalidate the implicit parallelism) or a multi user operating system (but i WANT to be able to get chmod a file, even though I don’t own it), or any myriad of other things.

I just had to say something.

I won’t even go to your last post as it speaks for itself.

I think for the record-

“We have heard you and understood where you are coming from.”

and for the record-

I do not think pointers are a panacea but they do, at times, help.

I do not want pointers to every blasted thing on my computer.

I am not an expert programmer, a systems developer, hardware designer but I have had jobs as an Electronics engineer. I have ran my own software development business for 2 years now and have been programming for over 15 years.

I would like a fast Draw/Read Pixels or a pointer.

Don’t know about “nice ActiveX stuff”. And I usually browse without images, as I’m interested mainly in content. And Netscape’s main problem is not that it follows the standard strictly, but that it doesn’t follow it well (for Netscape 4.x, at least, which still seems to be the most common version).

Anyway, since this is not a web development forum, I’ll go back to OpenGL. I agree that having to disable and enable things just to draw what you want can be a little annoying, and it would have been nice to have simpler functions that can do similar things without all this moving to ortho, etc. - such as sprite functions. Although you can put all state changes into a display list, which should at least make the program cleaner.

Still, for one there’s the flexibility thing, as I mentioned. You probably want that anyway. If you go with 640x480, it will look too low-res for users of new cards. If you go with 1280x1024, it might not even work for users of older cards and monitors.

As for cutting the image into small textures, if you’re aiming just at newer cards, you won’t have a problem with the 256x256 texture size limitation, which will simplify things. If you’re aiming at 256x256 cards, then you won’t get a pointer to frame buffer extension to them even if it is added to OpenGL, since they will be old cards.

So while I agree that cutting your image into several textures can be pretty annoying, I also think that it’s the best solution, that will provide the best results for the largest number of users.

I think that this is a major problem with the pointer to framebuffer idea - it tries to solve problems which are more pronounced with older 3D hardware, and this is exactly what it can’t solve. Even if such an extension is approved, you’ll end up having to still do everything you’re doing now for older chips, that don’t get driver updates, and will only be able to use the extension on newer chips, where it’s less needed.

Originally posted by OpenGLRox:
The point is, limiting a developer in any way is a bad thing.

If that’s the way you feel, I suggest you go back to DOS.

There are many very good reasons for limiting developers’ control.

  • Matt

Like I’ve said before, I don’t have a problem with gaining direct access to the framebuffer, excepting details about the OS and other issues that brings. Really, the question I have to ask is, “Why does this belong in OpenGL?”

OpenGL is, basically, a specification. OpenGL’s extensions are specifications. What you are asking is for some command like this, “void *glFrameBufferPointerEXT()”. Well, the extension specification must tell you exactly what the format of this pointer is. It must provide details that are highly implementation dependent. In fact, that pointer might be invalidated because of a change in OpenGL’s state, so you can’t even be assured that it is avaliable.

The only way for something this low-level to be part of OpenGL is if the function returns a pointer to a buffer whose format is specifically defined (RGBA8, for instance). Then, when you are finished with the buffer, it would have to copy your changes into the main framebuffer. Of course, this happens to be almost exactly what glReadPixels/glWritePixels does.

A specification cannot really give out unspecified data; hence the term, “specification”. Think about it. The extension specification for void *glFrameBufferPointerEXT() would basically read, “Returns a pointer to unspecified data of indeterminant length.” This pointer’s length and format could be different depending on the pixel format in question. It might even change with a driver update, thus breaking old code that relied on a particular format (breaking old code is something that extension specifications try very hard not to do). And, once you force this pointer to point to data of a specific format, it becomes glReadPixels and glWritePixels, with all the inefficiency inherient in them.

It is theoretically possible that the extension could give you some structure detailing the format of the data. However, many hardware vendors are highly secretive about such low-level details of their hardware, as it could give their compeditors important information they could use to enhance their products.

It is even possible to imagine an implementation that does not possess a complete framebuffer that you could get a pointer to. The OpenGL specification (and, by extension, its extensions) simply cannot allow granting data that is simply undefined.

Originally posted by OpenGLRox:
The reason I might want to draw a graphic at actual size it I may not want the art to get lossy from scaling down. I may not want the art to get pixelated from scaling up. I may not want lights on it, or fog. I just want it on the screen exactly as it is.

Easily done with textures too. Point sampling and drawing it at actual pixel size.

Originally posted by OpenGLRox:
[b]The point is, limiting a developer in any way is a bad thing. Take a look at Internet Explorer vs Netscape. Have you ever tried to design a nice looking web page with lots of goodies? In IE, it’s easy because they give developers a lot of stuff they can play with. In Netscape however, they limit the developer to the w3 statndard and refuse to budge. So, when I have done web pages for people, I have had to say, “Well, if you want a really nice web page, IE people are going to see it. We MAY be able to do a FEW nice things in Netscape, but we have a bunch of hoops to jump through, and more code to write to make it happen”. 1 person asked me to put a margue on their web page. No prob in IE: <marque>some text</marque>

In Netscape though, get out the java script manual. There are hoops to jump through. As a result, I try to steer people away from Netscape now, which isn’t hard considering you can have some nice activex stuff in IE.

I think OpenGL is awesome, but tying a developers hands in any way is not a good thing, and being the parent by saying, “We’re not going to let you have that. You might hurt yourself”, is also most likely not going to make Joe Developer who has been coding for 30 years very happy.[/b]

While IE may provide you with more features and possibilities it also has the most security holes, mostly because of features that may not be needed has just been added because someone wants it and without thinking about the consequences. Overall commonly done at M$, they let the developers do too much, leaving security holes everywhere. Especially in the DOS days, as Matt said, where everything was open a faulty or malicious application could easily bring the whole computer down. This happend many times for me in those days when a bug in my app caused the screen to go blank and the computer restarted with hardware errors that didn’t go away until I turned the power off. Now in the case with pointers to framebuffer, what garantuees that the application doesn’t screw up things for the graphic card? What if a bug makes the app write outside the framebuffer?

Hello,

ah… i remember the good old days of microsoft extending specifications because developers REALLY like it. Remember Microsoft Visual Java? =)

cheers
John

YES!
oooohhhh…yes !!!

GIVE US A POINTER TO THE FRAME-BUFFER !!!

the “monkey has landed” if this occurrs…

And it seems to me… we don’t need frame buffer pointer to access framebuffer! If we write
glClearColor(1.0,0.,0.)
glClear(GL_COLOR_BUFFER_BIT); we get red background (it does changes a framebuffer memory),but we don’t get framebuffer ptr for it!! So, everything we need is not a pointer, but a set of functions to operate a frame buffer, and it’s not important to us, what’s going on inside OpenGL, when we trying to access it. For example glClearTexture(texptr)-to make a texturized background (it’s a common task, and I have to draw a texturized rectangle to solve it usualy, but it’s slow)

The above is a bit silly. If you check out http://www.useit.com/alertbox/, you will see that a `really nice’ web-page is not quite what you think it is.

I think Netscape sticking to the standard is good for designers and users all over the place. Microsoft want you to use all their advanced features, so you all need MS browsers to see the pages. Its a lock-in.

Same deal with DX and OpenGL. I would rather be portable than strapped to Microsoft for the rest of my working life.