OpenGL texture 2d array won't render with depth > 1

时间:2016-02-12 20:25:43

标签: c++ opengl textures

Below code uploads my texture memory that's described in the passed parameters. When 'vPixelData' only holds 1 item/texture it is rendered properly, but once there's 2 or more nothing shows up.

glTexSubImage3D() is returning 'GL_INVALID_OPERATION' when I call glGetError() after it only when vPixelData.size() is greater than 1.

Object

(My current passed parameters are uiNumColorChannels == 4)

(uiWidth and uiHeight are both 512)

1 个答案:

答案 0 :(得分:0)

Apparently everything works if I use:

<?xml version="1.0" encoding="utf-8"?>
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" indent="yes" version="4.01"
      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
      doctype-public="//W3C//DTD XHTML 1.0 Transitional//EN"/>
    <xsl:template match="/">
      <html xmlns="http://www.w3.org/1999/xhtml">
        <xsl:attribute name="lang">
          <xsl:value-of select="//Settings//LanguageCode"/>
        </xsl:attribute>
        <head>
          <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
          <link rel="stylesheet" type="text/css">
            <xsl:attribute name="href">
              <xsl:value-of select="//Settings/Template/@Style"/>
            </xsl:attribute>
          </link>
          <title>
            <!--<xsl:value-of select="//Labels/ReportTitleWorksheets"/>-->
            Assignment Slips
          </title>
          <style type="text/css">
            @import url('<xsl:value-of select="//Settings/Template/@Style"/>');
          </style>
        </head>
        <body>
          <xsl:for-each select="AssignmentSlips/Page">
            <div class="containerPage">
              <xsl:if test="@PageBreakBefore=1">
                <br style="page-break-before: always;"/>
              </xsl:if>
              <xsl:for-each select="StudentSlip">
                <div class="containerSlip">
                  <img alt="s89" width="323px" height="429px">
                    <xsl:attribute name="src">
                      <xsl:value-of select="//Settings/Template"/>
                    </xsl:attribute>
                  </img>
                  <div class="fieldName">
                    <xsl:attribute name="dir">
                      <xsl:value-of select="//Settings/Direction"/>
                    </xsl:attribute>
                    <xsl:value-of select="Student"/>
                  </div>
                  <div class="fieldAssisant">
                    <xsl:attribute name="dir">
                      <xsl:value-of select="//Settings/Direction"/>
                    </xsl:attribute>
                    <xsl:value-of select="Assistant"/>
                  </div>
                  <div class="fieldDate">
                    <xsl:attribute name="dir">
                      <xsl:value-of select="//Settings/Direction"/>
                    </xsl:attribute>
                    <xsl:value-of select="Date"/>
                  </div>
                  <div class="fieldCounsel">
                    <xsl:attribute name="dir">
                      <xsl:value-of select="//Settings/Direction"/>
                    </xsl:attribute>
                    <xsl:value-of select="StudyPoint"/>
                  </div>

                  <xsl:choose>
                    <xsl:when test="Assignment=1">
                      <div class="checkBibleReading">✓</div>
                    </xsl:when>
                    <xsl:when test="Assignment=2">
                      <div class="checkInitialCall">✓</div>
                    </xsl:when>
                    <xsl:when test="Assignment=3">
                      <div class="checkReturnVisit">✓</div>
                    </xsl:when>
                    <xsl:when test="Assignment=4">
                      <div class="checkBibleStudy">✓</div>
                    </xsl:when>
                    <xsl:when test="Assignment=5">
                      <div class="checkOther">✓</div>
                      <div class="fieldOther">
                        <xsl:attribute name="dir">
                          <xsl:value-of select="//Settings/Direction"/>
                        </xsl:attribute>
                        <xsl:value-of select="Other"/>
                      </div>
                    </xsl:when>
                  </xsl:choose>
                  <xsl:choose>
                    <xsl:when test="Location=1">
                      <div class="checkMainHall">✓</div>
                    </xsl:when>
                    <xsl:when test="Location=2">
                      <div class="checkAuxClass1">✓</div>
                    </xsl:when>
                    <xsl:when test="Location=3">
                      <div class="checkAuxClass2">✓</div>
                    </xsl:when>
                  </xsl:choose>
                </div>
              </xsl:for-each>
            </div>
          </xsl:for-each>
        </body>
      </html>
    </xsl:template>
</xsl:stylesheet>

instead of:

glTexImage3D(GL_TEXTURE_2D_ARRAY,
             0,
             eFormat,
             uiWidth, uiHeight,
             uiNumTextures,
             0,
             eFormat,
             GL_UNSIGNED_BYTE,
             NULL);