Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8442879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:57:39+00:00 2026-06-10T08:57:39+00:00

I’m having troube displaying a texture to a plane of two triangles. My texture

  • 0

I’m having troube displaying a texture to a plane of two triangles.
My texture is a 32×32 RGBA bitmap.
I’m developing for android.

My plane is created like this:

    float[] vertices = new float[24];
    // first triangle
    vertices[0] = 0.0f;
    vertices[1] = 0.0f;
    vertices[2] = 0.0f;
    vertices[3] = 1.0f;

    vertices[4] = 0.0f;
    vertices[5] = fHeight;
    vertices[6] = 0.0f;
    vertices[7] = 1.0f;

    vertices[8] = fWidth;
    vertices[9] = fHeight;
    vertices[10] = 0.0f;
    vertices[11] = 1.0f;

    // second triangle
    vertices[12] = fWidth;
    vertices[13] = fHeight;
    vertices[14] = 0.0f;
    vertices[15] = 1.0f;

    vertices[16] = fWidth;
    vertices[17] = 0.0f;
    vertices[18] = 0.0f;
    vertices[19] = 1.0f;

    vertices[20] = 0.0f;
    vertices[21] = 0.0f;
    vertices[22] = 0.0f;
    vertices[23] = 1.0f;

What I managed is to create the plane and display half of the texture. The result looks like this:
Result http://www.imagecrate.de/u/1346090743_texture.png

So. the texture is only visible on the first triangle. I read, that it might be a problem when the triangles are rendered in the wrong order, but when I change the order of the second triangle, it doesn’t have any effect. Also I thought the texture should be transparent where the black color is visible. Any idea og what I might do wrong?

Here is my fragment shader code:

precision mediump float;
varying vec2 vTexCoord;
uniform sampler2D sTexture; 
void main()
{
    gl_FragColor = texture2D(sTexture, vTexCoord); 
}

And here are my texture coordinates:

    float[] mVertsData1 =
        { 
                0.0f, 0.0f, // TexCoord 0
                0.0f, 1.0f, // TexCoord 1
                1.0f, 1.0f, // TexCoord 2
                1.0f, 0.0f // TexCoord 3
        };

I’m not sure if my rendering code will help here, I can add it if you need it. But I don’t want to make this question bigger as needed.
Maybe someone knows what happens here!?

Thank you in advance!
Zerd1984

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:57:40+00:00Added an answer on June 10, 2026 at 8:57 am

    You’ve got 6 vertices and 4 texture coordinates. You need to have the same number of both (6 and 6).

    For each vertex, you want to define the texcoord for that vertex at the same index; vertex 4 must match up with texcoord 4, vertex 5 with texcoord 5, etc.

    For transparency, you need to enable blending : glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    You should generally always include your rendering code whenever you have a rendering problem as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm having trouble keeping the paragraph square between the quote marks. In firefox the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.