Jump to content

Search the Community

Showing results for tags 'Depth buffer and panel draw'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General X-Plane Discussion
    • General Discussion
    • File Library Submissions
    • Help!?!
    • Communal Links
    • Screenshots
    • Videos
    • X-Plane News [Official News]
    • X-Pilot Features
  • Developers
    • Plugin Development
    • UDP Development
    • Aircraft Development
    • Scenery Development
  • Freeware Projects
    • XMidiCtrl
  • Commercial Vendors
    • 4Forces
    • Attitude Simulations
    • Hot Start
    • ITX-Designs (Formerly Icarus)
    • IXEG
    • JGX-Designs
    • JRollon
    • Leading Edge Simulations
    • Maxx-XP
    • PilotEdge
    • RealScenery
    • RealSimGear
    • Real Environment Simulations
    • TOGA Simulations
    • TorqueSim/AFM
    • Uncle Jack Simulations
    • X-Plugins
  • Miscellaneous
    • Hardware
    • Software
  • X-Plane 101
    • I'm New To X-Plane!
    • Best of the Best!
  • Workshop
    • 3D Shop
  • Add-On Reviews
    • Reviews

Categories

  • News
  • Aircraft
  • Scenery
  • Plugins
  • X-Pilot Website
  • Sales & Deals
  • General Information

Categories

  • Aircraft
    • Experimental
    • Fighters
    • General Aviation
    • Gliders
    • Heavy Metal
    • Helicopters
    • Mega-Planes
    • Seaplanes
    • VTOL
    • X-Planes
  • Scenery
    • DSF Scenery Packages
    • Objects
    • Misc Scenery Resources
  • Liveries
    • Business Aviation
    • Experimental
    • Fighters
    • General Aviation
    • Helicopters
    • Heavy Metal
    • Vintage
  • Plugins and Utilities

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. I am trying to draw in front of the instrument panel (3D) using the depth buffer as a mask to completely avoid writing in/over the cockpit windows. Below is the code I have tried (most recently anyway). My code is invoked within a XPLMRegisterDrawCallback function. I have tried draw phases: xplm_Phase_FirstCockpit, xplm_Phase_Panel, xplm_Phase_Gauges and xplm_Phase_LastCockpit. I have tried different values in the depth buffer (xpDepthBuffer) ranging from 0.999 to 0.001. The larger value is what is needed as the cockpit windows have a value of 1.0 and the panel/gauges are less than 0.999. XPLMBindTexture2d(gTexture, xplm_Tex_GeneralInterface); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); XPLMSetGraphicsState(0/*Fog*/, 1/*TexUnits*/, 0/*Lighting*/, 0/*AlphaTesting*/, 0/*AlphaBlending*/, 1/*DepthTesting*/, 1/*DepthWriting*/); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, cfgImageWidth, cfgImageHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, xpDepthBuffer); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, cfgImageWidth, cfgImageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, imageBuf); glPushMatrix(); { float d=0.9991f; glBegin(GL_QUADS); { glTexCoord2f(1, 0.0f); glVertex3f((GLfloat)PanelRight, (GLfloat)PanelBottom, d); // Bottom Right Of The Texture and Quad glTexCoord2f(0, 0.0f); glVertex3f((GLfloat)PanelLeft, (GLfloat)PanelBottom, d); // Bottom Left Of The Texture and Quad glTexCoord2f(0, 1.0f); glVertex3f((GLfloat)PanelLeft, (GLfloat)PanelTop, d); // Top Left Of The Texture and Quad glTexCoord2f(1, 1.0f); glVertex3f((GLfloat)PanelRight, (GLfloat)PanelTop, d); // Top Right Of The Texture and Quad } glEnd(); } glPopMatrix(); glFlush(); I can do this: glReadPixels(0, 0, cfgImageWidth, cfgImageHeight , GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT,xpDepthBuffer); to obtain the current depth buffer values. Then by comparing the returned values to 1.0 and setting the Alpha channel in my image buffer (imageBuf) accordingly, I am able to use ALPHA blending to mask out the cockpit windows.Unfortunately the glReadPixels() function is too slow to be of much use for masking in this manner. Has anyone had success using the depth buffer for drawing over the panel/gauges? Thanks
×
×
  • Create New...