• OpenGL - One of eight simple box drawings disappears ...

    From R.Wieser@21:1/5 to All on Mon Mar 24 12:28:19 2025
    XPost: alt.windows7.general, comp.os.ms-windows.programmer.win32

    Hello all,

    I'm drawing some stuff using OpenGL32, and have run into something I can't explain.

    I'm drawing a line and two rectangles with "markers" (a small box) on each corner. For some reason *one* of those markers disappears.

    The code:
    - - - - - - - - - - -

    glPushAttrib GL_CURRENT_BIT or GL_ENABLE_BIT
    glColor3ubv

    glBegin,GL_LINES
    ...
    glEnd

    glDisable GL_CULL_FACE

    DrawMarker
    DrawMarker
    DrawMarker
    DrawMarker

    glBegin,GL_QUADS
    ...
    glEnd

    DrawMarker <-- this one disappears
    DrawMarker
    DrawMarker
    DrawMarker

    glBegin,GL_QUADS
    ...
    glEnd

    glPopAttrib

    - - - - - - - - - - -
    -- DrawMarker

    glPushAttrib GL_CURRENT_BIT
    glColor3ubv
    glBegin GL_QUADS
    ...
    glEnd
    glPopAttrib
    - - - - - - - - - - -

    The interesting thing is that if I either, in the DrawMarker part, not push
    the attributes or not set the color all markers are visible again.

    If I make the above change for just the disappearing marker it appears, but than the next marker disappears.

    In the DrawMarker code I've followed both the glPushAttib and glColor3ubv
    with glGetError, but those returned Zero for all markers.

    I have no idea what is happening. Does anyone know ?

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul@21:1/5 to R.Wieser on Mon Mar 24 13:09:23 2025
    XPost: alt.windows7.general, comp.os.ms-windows.programmer.win32

    On Mon, 3/24/2025 7:28 AM, R.Wieser wrote:
    Hello all,

    I'm drawing some stuff using OpenGL32, and have run into something I can't explain.

    I'm drawing a line and two rectangles with "markers" (a small box) on each corner. For some reason *one* of those markers disappears.

    The code:
    - - - - - - - - - - -

    glPushAttrib GL_CURRENT_BIT or GL_ENABLE_BIT
    glColor3ubv

    glBegin,GL_LINES
    ...
    glEnd

    glDisable GL_CULL_FACE

    DrawMarker
    DrawMarker
    DrawMarker
    DrawMarker

    glBegin,GL_QUADS
    ...
    glEnd

    DrawMarker <-- this one disappears
    DrawMarker
    DrawMarker
    DrawMarker

    glBegin,GL_QUADS
    ...
    glEnd

    glPopAttrib

    - - - - - - - - - - -
    -- DrawMarker

    glPushAttrib GL_CURRENT_BIT
    glColor3ubv
    glBegin GL_QUADS
    ...
    glEnd
    glPopAttrib
    - - - - - - - - - - -

    The interesting thing is that if I either, in the DrawMarker part, not push the attributes or not set the color all markers are visible again.

    If I make the above change for just the disappearing marker it appears, but than the next marker disappears.

    In the DrawMarker code I've followed both the glPushAttib and glColor3ubv with glGetError, but those returned Zero for all markers.

    I have no idea what is happening. Does anyone know ?

    Regards,
    Rudy Wieser

    Have you considered feeding the source into an AI, and
    asking whether your style of using Pushes and Pops is correct ?

    It is either that, or find some sample code on the web, with
    similar intended function, and see what style they use.

    Maybe after your GLBegin GLend, you need to restore the
    grapical context, so the current cursor location is restored.
    It could be, the DrawMarker is being drawn off-screen somewhere.

    Paul

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Mon Mar 24 20:06:07 2025
    XPost: alt.windows7.general, comp.os.ms-windows.programmer.win32

    Paul,

    Have you considered feeding the source into an AI, and
    asking whether your style of using Pushes and Pops is correct ?

    Nope. I'm not really willing to "listen" to something that can as easily halucinate as not.

    Also, I've been using the same style of pushing/popping in the same and
    several other programs. No problems there.

    It is either that, or find some sample code on the web, with
    similar intended function, and see what style they use.

    Using different code will quite likely make all the markers show up, but doesn't give me any reason to why the code I posted makes one - just one - diasappear.

    If its just the result I'm after I would just remove all the markers - I
    only added them for "debugging" (visual clues of the calculated corners).

    Maybe after your GLBegin GLend, you need to restore the
    grapical context, so the current cursor location is restored.

    I've shown in the code that its a marker somewhere in the middle, and no "cursor location" changes (translations, rotations, scaling) have been
    applied. IOW, if that one marker was moved off-screen than the next ones
    would have been moved too. And they aren't. Nor are the quads drawn after them (with its corners where the markers are)

    Also, before executing that bit of code I've got several other primitives drawn, all in their own glBegin / glEnd wrappers. No restoration of any
    kind there either. I've also called the same code a second time (with different coordinates) and it also misses the same marker. Moving the code
    to first or last executed doesn't change anything either.

    IOW, it seems to be something in the code I posted, but I'm unable to spot
    it (chances are that when I do find the reason it will be a "Well /ofcourse/ its doing that" 20-20 vision moment. Than again, perhaps not ...)

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul@21:1/5 to R.Wieser on Mon Mar 24 16:13:28 2025
    XPost: alt.windows7.general, comp.os.ms-windows.programmer.win32

    On Mon, 3/24/2025 3:06 PM, R.Wieser wrote:
    Paul,

    Have you considered feeding the source into an AI, and
    asking whether your style of using Pushes and Pops is correct ?

    Nope. I'm not really willing to "listen" to something that can as easily halucinate as not.

    Also, I've been using the same style of pushing/popping in the same and several other programs. No problems there.

    It is either that, or find some sample code on the web, with
    similar intended function, and see what style they use.

    Using different code will quite likely make all the markers show up, but doesn't give me any reason to why the code I posted makes one - just one - diasappear.

    If its just the result I'm after I would just remove all the markers - I
    only added them for "debugging" (visual clues of the calculated corners).

    Maybe after your GLBegin GLend, you need to restore the
    grapical context, so the current cursor location is restored.

    I've shown in the code that its a marker somewhere in the middle, and no "cursor location" changes (translations, rotations, scaling) have been applied. IOW, if that one marker was moved off-screen than the next ones would have been moved too. And they aren't. Nor are the quads drawn after them (with its corners where the markers are)

    Also, before executing that bit of code I've got several other primitives drawn, all in their own glBegin / glEnd wrappers. No restoration of any
    kind there either. I've also called the same code a second time (with different coordinates) and it also misses the same marker. Moving the code
    to first or last executed doesn't change anything either.

    IOW, it seems to be something in the code I posted, but I'm unable to spot
    it (chances are that when I do find the reason it will be a "Well /ofcourse/ its doing that" 20-20 vision moment. Than again, perhaps not ...)

    Regards,
    Rudy Wieser

    Tsk.

    For the time being, AI is the replacement for broken search engines.
    And a poor one at that.

    *******

    Learn to use the tools, such as they are.

    Remember, that in this case, you are asking a "programming style" question.
    The AI has seen all manner of programs. It does not write very good
    programs, but it sometimes recognizes a style. And it might be able
    to tell you if "your style does not match anything I've seen".

    I use AI, only to take a break from "doing everything the hard way".
    Sometimes, while the AI mush comes back, I think of a solution myself.
    But it represents a change of pace from banging your head against
    the wall.

    For example, imagine the following session.

    "Hello. I have a program I wrote. It is in the language X.

    Begin
    printf("Hello World\n");
    End

    Can you see my design intent ?

    If you re-wrote my program or corrected my
    errors in programming, what would that program
    look like ?

    Am I using the graphical context Push() and Pop() properly ?
    "

    That's an example of using the pattern recognition of the AI,
    as it isn't really all that clever, but it sucks up language like
    a sponge.

    Your programming style is linear, and the AI should have no trouble
    whatsoever, with the analysis.

    It does not do emulation runs. It does not check your work that way.
    It can only do syntax analysis, which is the thing you need a hint
    on right now.

    Paul

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Tue Mar 25 08:37:46 2025
    XPost: alt.windows7.general, comp.os.ms-windows.programmer.win32

    Paul,

    For the time being, AI is the replacement for broken search
    engines. And a poor one at that.

    Indeed. But a broken search engine will be consistent in its answers, while
    I an "AI" can return different *and hallucinated* answers every time.

    If I would ask a human and get ever-changing and (sometimes dangerously)
    wrong answers I would drop that human as a reliable source of information.
    As such I do not understand why people keep pushing "AI is the greatest
    thing evar!",


    By the way, I realized that I forgot to mention something: In my code
    between the glBegin and glEnd combo where I wrote a couple of dots I ment
    those to indicate a few glVertex3f calls /and nothing else/.

    Also, do notice that I indicated that removing the glColor3ubv call (or the glPushAttrib/glPopAttrib combo) in the DrawMarker routine makes de
    disappeared marker appear again. That call hasn't got anything to do with
    the location of the "graphics cursor", right ?

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Tue Mar 25 10:09:28 2025
    XPost: alt.windows7.general, comp.os.ms-windows.programmer.win32

    Remarkable:

    When I, in the DrawMarker routine, change the glColor3ubv call to a
    glColor4ubv one (using an apropriate Alpha ofcourse) the disappeared marker appears again.

    Why now do I get the feeling that I've run into a bug ?

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)