Re: newbie questions on OpenGL and C#. I am using NeHe example code




"drawing in aspnet" <csharpuser@xxxxxxxxxxx> wrote in message
news:1137604811.645016.281610@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Thanks for the responses.
>
> One thing I did that made an immediate difference was moving from C# to
> C++. It seems there is a lot more advice/support for using C++ with
> OpenGL.
>
> I used your glGetString(GL_VENDOR) idea and got back "Intel". Also,
> the value being returned back by ChoosePixelFormat is '4' which, as far
> as I can tell, means hardware acceleration is used. That said, I'm
> almost sure it's not based on some simple tests: 1) it's very slow
> rotating a triangle or square especially when you expand the window,
> and 2) you can have the window covered by another window (TaskManager)
> and the calculations of how many red pixels (for example) are present
> in the window works just fine. This implies that read pixels is not
> reading from the screen but rather from memory?
>
> Also, I did not understand your warning about ReadPixels. My idea was,
> for example, to put a red square down on the drawing surface. Then I'd
> draw some triangles (green) in random spots on the surface. Many would
> cover the red square. The question then is "How many red pixels are
> left". It seems to work fine in my mock-up, but I have not addressed
> issues of speed yet. I was hoping it would all be done on graphics
> card hardware, but perhaps not.
>
> Thanks again.
>
> Dave.
>
> fungus wrote:
>> drawing in aspnet wrote:
>> > instance, I notice that shapes rotate slower when you expand the
>> > window. This suggests that I have done something wrong as (I would not
>> > think) it's an overly complicated view to render.
>>
>> Drawing a polygon isn't free, and the more pixels
>> it covers the longer it takes.
>>
>> > //GL.glFlush();
>> > WGL.wglSwapBuffers(DC);
>> > }
>> >
>> > Notice that I don't have to call glFlush to make things work (it was in
>> > the example code!). How come I got away with that?
>>
>> SwapBuffers() always does a flush for you. Whoever
>> wrote the tutorial did it wrong.
>>
>> > Also, is the drawing really being done on the graphics card? How can I
>> > tell? It occurred to me that maybe it's being done in memory and that's
>> > why things behave slowly.
>>
>> Maybe.
>>
>> Look at the results of glGetString(GL_VENDOR). If it says
>> "Microsoft" and not the name of the people who make your
>> graphics card then you're rendering in software.
>>
>> However, this might be a good thing if you're going to
>> call glReadPixels(). glReadPixels() doesn't work where
>> you have overlapping windows.
>>
>> > Eventually, I would like to write two complicated (non-rotating!)
>> > overlapping polygons to the buffer (NOT the screen) and calculated what
>> > percentage the first polygon covers the second. Someone suggested that
>> > I could use glReadPixels(...) to accomplish this. I would read the
>> > pixels one by one and keep track of which ones were red (polygon#1) and
>> > green (polygon#2).
>>
>> That's likely to be very slow...but maybe that's
>> ok for you.
>>
>>
>>
>> --
>> <\___/>
>> / O O \
>> \_____/ FTB. For email, remove my socks.
>>
>> In science it often happens that scientists say, 'You know
>> that's a really good argument; my position is mistaken,'
>> and then they actually change their minds and you never
>> hear that old view from them again. They really do it.
>> It doesn't happen as often as it should, because scientists
>> are human and change is sometimes painful. But it happens
>> every day. I cannot recall the last time something like
>> that happened in politics or religion.
>>
>> - Carl Sagan, 1987 CSICOP keynote address
>

Get a copy of am OpenGL graphics benchmark, such as Spheremark, and try it
out.
Intel -- not much of a 3D accelerator...

Don't just look at the pixelformat number -- "describe" the pixel format
(DescribePixelFormat()) & parse the return structure
(or use a pixel format dumper like glinfo).

-jbw

jbw


.



Relevant Pages

  • Re: newbie questions on OpenGL and C#. I am using NeHe example code
    ... and 2) you can have the window covered by another window ... This implies that read pixels is not ... to put a red square down on the drawing surface. ... >> percentage the first polygon covers the second. ...
    (comp.graphics.api.opengl)
  • Re: SetMapMode
    ... VB stores the current ScaleMode of each appropriate object somewhere of course but I'm fairly sure there is nothing in the actual DC or window structure that will tell you what it is. ... As far as VB is concerned it uses a mapping mode of MM_TEXT (device pixels) for all of its windows regardless of the VB ScaleMode you are using and it performs the conversion from the VB ScaleMode units to device pixels at run time before drawing into the DC. ...
    (microsoft.public.vb.general.discussion)
  • Re: Drawing Pixels
    ... Your original question was regarding setting the pixels of the "client area ... window, nor the client area of a window. ... Most drawing is not done using the few methods available in the ... The particular problem you seem to be describing is that you want the Bitmap ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: SetMapMode
    ... also get the hDc) how can I tell what the current ScaleMode ... setting of a VB window is? ... of MM_TEXT (device pixels) for all of its windows (Forms, Picture Boxes, ... drawing in a different mapping mode, as long as you make sure that you ...
    (microsoft.public.vb.general.discussion)
  • Re: how to set Browser at Full Screen
    ... The window is under control of the operating system. ... the application (the browser you have written) does not even know. ... As to "coding the graphics card" you don't. ...
    (alt.html)