Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: How to draw a texture using glDrawTexiOES?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member Newbie
    Join Date
    May 2016
    Posts
    12

    How to draw a texture using glDrawTexiOES?

    I try the following code, but without any success :

    I create my texture like this :

    glActiveTexture(GL_TEXTURE0);
    glGenTextures(1, @Tex);
    glBindTexture(GL_TEXTURE_2D, Tex);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    TJGLUtils.JavaClass.texImage2D(GL_TEXTURE_2D, // target: Integer;
    0, // level: Integer;
    aBitmap, // bitmap: JBitmap;
    0); // border: Integer =>
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 100, 100, 0, GL_RGBA, GL_UNSIGNED_BYTE, nil);
    glBindTexture(GL_TEXTURE_2D, 0);

    then later in my main render loop i try to draw the texture with glDrawTexiOES like this :


    eglMakeCurrent(eglGetCurrentDisplay, SharedSurface, SharedSurface,
    SharedContext);

    glViewport(Round(FContentRect.Left * FScale), Round(FContentRect.Top * FScale), Round(FContentRect.Width * FScale),
    Round(FContentRect.Height * FScale));

    glDepthMask(1);
    glClearDepthf(1);
    glClearStencil(0);
    glClearColor(0, 0, 0, 0);
    glClear(GL_DEPTH_BUFFER_BIT or GL_STENCIL_BUFFER_BIT or GL_COLOR_BUFFER_BIT);

    glBindTexture(GL_TEXTURE_2D, Tex);

    aParams[0] := 0;
    aParams[1] := 0;
    aParams[2] := 100;
    aParams[3] := 100;
    glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, @aParams[0]);

    glDrawTexiOES(0, 0, 0, 100, 100);

    eglSwapBuffers(SharedDisplay, SharedSurface);

    but it's not work what did i miss ?

    NOTE: i have an glerror (1280) here :

    glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, @aParams[0]);
    Last edited by loki5100; 09-12-2017 at 08:43 AM.

  2. #2
    Junior Member Newbie
    Join Date
    May 2016
    Posts
    12
    it's seam that glDrawTexiOES is not available under opengl 2.0 ? or i m wrong ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •