int iDisplayablePixelFormat;
PIXELFORMATDESCRIPTOR pfd;
BOOL bRet;
+ int textureFormat = WGL_NO_TEXTURE_ARB;
+ int textureTarget = WGL_NO_TEXTURE_ARB;
+ BOOL textureMipmap = FALSE;
info = stw_pixelformat_get_info(iPixelFormat - 1);
if (!info) {
piAttrib++;
useLargest = *piAttrib;
break;
+ case WGL_TEXTURE_FORMAT_ARB:
+ /* WGL_ARB_render_texture */
+ piAttrib++;
+ textureFormat = *piAttrib;
+ if (textureFormat != WGL_TEXTURE_RGB_ARB &&
+ textureFormat != WGL_TEXTURE_RGBA_ARB &&
+ textureFormat != WGL_NO_TEXTURE_ARB) {
+ SetLastError(ERROR_INVALID_DATA);
+ return 0;
+ }
+ break;
+ case WGL_TEXTURE_TARGET_ARB:
+ /* WGL_ARB_render_texture */
+ piAttrib++;
+ textureTarget = *piAttrib;
+ if (textureTarget != WGL_TEXTURE_CUBE_MAP_ARB &&
+ textureTarget != WGL_TEXTURE_1D_ARB &&
+ textureTarget != WGL_TEXTURE_2D_ARB &&
+ textureTarget != WGL_NO_TEXTURE_ARB) {
+ SetLastError(ERROR_INVALID_DATA);
+ return 0;
+ }
+ break;
+ case WGL_MIPMAP_TEXTURE_ARB:
+ /* WGL_ARB_render_texture */
+ piAttrib++;
+ textureMipmap = !!*piAttrib;
+ break;
default:
SetLastError(ERROR_INVALID_DATA);
+ debug_printf("wgl: Unsupported attribute 0x%x in %s\n",
+ *piAttrib, __func__);
return 0;
}
}
}
fb->bPbuffer = TRUE;
+
+ /* WGL_ARB_render_texture fields */
+ fb->textureTarget = textureTarget;
+ fb->textureFormat = textureFormat;
+ fb->textureMipmap = textureMipmap;
+
iDisplayablePixelFormat = fb->iDisplayablePixelFormat;
stw_framebuffer_unlock(fb);
return NULL;
}
- fb = (struct stw_framebuffer *)hPbuffer;
+ fb = stw_framebuffer_from_HPBUFFERARB(hPbuffer);
hDC = GetDC(fb->hWnd);
return 0;
}
- fb = (struct stw_framebuffer *)hPbuffer;
+ fb = stw_framebuffer_from_HPBUFFERARB(hPbuffer);
return ReleaseDC(fb->hWnd, hDC);
}
return FALSE;
}
- fb = (struct stw_framebuffer *)hPbuffer;
+ fb = stw_framebuffer_from_HPBUFFERARB(hPbuffer);
/* This will destroy all our data */
return DestroyWindow(fb->hWnd);
return FALSE;
}
- fb = (struct stw_framebuffer *)hPbuffer;
+ fb = stw_framebuffer_from_HPBUFFERARB(hPbuffer);
switch (iAttribute) {
case WGL_PBUFFER_WIDTH_ARB:
/* We assume that no content is ever lost due to display mode change */
*piValue = FALSE;
return TRUE;
+ /* WGL_ARB_render_texture */
+ case WGL_TEXTURE_TARGET_ARB:
+ *piValue = fb->textureTarget;
+ return TRUE;
+ case WGL_TEXTURE_FORMAT_ARB:
+ *piValue = fb->textureFormat;
+ return TRUE;
+ case WGL_MIPMAP_TEXTURE_ARB:
+ *piValue = fb->textureMipmap;
+ return TRUE;
+ case WGL_MIPMAP_LEVEL_ARB:
+ *piValue = fb->textureLevel;
+ return TRUE;
+ case WGL_CUBE_MAP_FACE_ARB:
+ *piValue = fb->textureFace + WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB;
+ return TRUE;
default:
SetLastError(ERROR_INVALID_DATA);
return FALSE;
case WGL_NUMBER_UNDERLAYS_ARB:
*pvalue = 0;
return TRUE;
+
+ case WGL_BIND_TO_TEXTURE_RGB_ARB:
+ /* WGL_ARB_render_texture */
+ *pvalue = pfi->bindToTextureRGB;
+ return TRUE;
+
+ case WGL_BIND_TO_TEXTURE_RGBA_ARB:
+ /* WGL_ARB_render_texture */
+ *pvalue = pfi->bindToTextureRGBA;
+ return TRUE;
}
if (iLayerPlane != 0)
/* WGL_ARB_multisample */
{ WGL_SAMPLE_BUFFERS_ARB, 2, FALSE },
- { WGL_SAMPLES_ARB, 2, FALSE }
+ { WGL_SAMPLES_ARB, 2, FALSE },
+
+ /* WGL_ARB_render_texture */
+ { WGL_BIND_TO_TEXTURE_RGB_ARB, 0, FALSE },
+ { WGL_BIND_TO_TEXTURE_RGBA_ARB, 0, FALSE },
};
struct stw_pixelformat_score
#include <windows.h>
+#include <GL/gl.h>
+#include <GL/wglext.h>
+
#include "util/u_debug.h"
unsigned width;
unsigned height;
+ /** WGL_ARB_render_texture - set at Pbuffer creation time */
+ unsigned textureFormat; /**< WGL_NO_TEXTURE or WGL_TEXTURE_RGB[A]_ARB */
+ unsigned textureTarget; /**< WGL_NO_TEXTURE or WGL_TEXTURE_1D/2D/
+ CUBE_MAP_ARB */
+ boolean textureMipmap; /**< TRUE/FALSE */
+ /** WGL_ARB_render_texture - set with wglSetPbufferAttribARB() */
+ unsigned textureLevel;
+ unsigned textureFace; /**< [0..6] */
+
/**
* Client area rectangle, relative to the window upper-left corner.
*
void
stw_framebuffer_cleanup(void);
+
+static inline struct stw_st_framebuffer *
+stw_st_framebuffer(struct st_framebuffer_iface *stfb)
+{
+ return (struct stw_st_framebuffer *) stfb;
+}
+
+
+static inline struct stw_framebuffer *
+stw_framebuffer_from_HPBUFFERARB(HPBUFFERARB hPbuffer)
+{
+ return (struct stw_framebuffer *) hPbuffer;
+}
+
+
#endif /* STW_FRAMEBUFFER_H */