Example usage for org.lwjgl.opengl NVDrawTexture glDrawTextureNV

List of usage examples for org.lwjgl.opengl NVDrawTexture glDrawTextureNV

Introduction

In this page you can find the example usage for org.lwjgl.opengl NVDrawTexture glDrawTextureNV.

Prototype

public static native void glDrawTextureNV(@NativeType("GLuint") int texture, @NativeType("GLuint") int sampler,
            @NativeType("GLfloat") float x0, @NativeType("GLfloat") float y0, @NativeType("GLfloat") float x1,
            @NativeType("GLfloat") float y1, @NativeType("GLfloat") float z, @NativeType("GLfloat") float s0,
            @NativeType("GLfloat") float t0, @NativeType("GLfloat") float s1, @NativeType("GLfloat") float t1);

Source Link

Usage

From source file:org.lwjgl.demo.opengl.raytracing.DemoSsboTrianglesStacklessKdTree.java

License:Open Source License

/**
 * Present the final image on the screen/viewport.
 *//*from w w w . jav  a2  s  .  c  o m*/
void present() {
    if (caps.GL_NV_draw_texture) {
        /*
         * Use some fancy NV extension to draw a screen-aligned textured quad without needing a VAO/VBO or a shader.
         */
        NVDrawTexture.glDrawTextureNV(raytraceTexture, sampler, 0.0f, 0.0f, width, height, 0.0f, 0.0f, 0.0f,
                1.0f, 1.0f);
    } else {
        /*
         * Draw a full-screen quad using the VAO and shader.
         */
        glUseProgram(quadProgram);
        glBindVertexArray(vao);
        glBindTexture(GL_TEXTURE_2D, raytraceTexture);
        glBindSampler(0, this.sampler);
        glDrawArrays(GL_TRIANGLES, 0, 6);
        glBindSampler(0, 0);
        glBindTexture(GL_TEXTURE_2D, 0);
        glBindVertexArray(0);
        glUseProgram(0);
    }
}

From source file:org.lwjgl.demo.opengl.raytracing.HybridDemoSsboTriangles.java

License:Open Source License

/**
 * Present the final image on the screen/viewport.
 *//* ww w. j  a v  a  2s .  com*/
private void present() {
    glDisable(GL_DEPTH_TEST);
    if (caps.GL_NV_draw_texture) {
        /*
         * Use some fancy NV extension to draw a screen-aligned textured
         * quad without needing a VAO/VBO or a shader.
         */
        NVDrawTexture.glDrawTextureNV(raytraceTexture, sampler, 0.0f, 0.0f, width, height, 0.0f, 0.0f, 0.0f,
                1.0f, 1.0f);
    } else {
        /*
         * Draw a full-screen quad using the VAO and shader.
         */
        glUseProgram(quadProgram);
        glBindVertexArray(vao);
        glBindTexture(GL_TEXTURE_2D, raytraceTexture);
        glBindSampler(0, this.sampler);
        glDrawArrays(GL_TRIANGLES, 0, 6);
        glBindSampler(0, 0);
        glBindTexture(GL_TEXTURE_2D, 0);
        glBindVertexArray(0);
        glUseProgram(0);
    }
}

From source file:org.lwjgl.demo.opengl.raytracing.TransformFeedbackDemo.java

License:Open Source License

/**
 * Present the final image on the screen/viewport.
 *///  ww w .j av a2 s.  co m
void present() {
    if (caps.GL_NV_draw_texture) {
        /*
         * Use some fancy NV extension to draw a screen-aligned textured quad without needing a VAO/VBO or a shader.
         */
        NVDrawTexture.glDrawTextureNV(raytraceTexture, sampler, 0.0f, 0.0f, width, height, 0.0f, 0.0f, 0.0f,
                1.0f, 1.0f);
    } else {
        /*
         * Draw the rendered image on the screen using textured full-screen quad.
         */
        glUseProgram(quadProgram);
        glBindVertexArray(fullScreenVao);
        glBindTexture(GL_TEXTURE_2D, raytraceTexture);
        glBindSampler(0, this.sampler);
        glDrawArrays(GL_TRIANGLES, 0, 6);
        glBindSampler(0, 0);
        glBindTexture(GL_TEXTURE_2D, 0);
        glBindVertexArray(0);
        glUseProgram(0);
    }
}