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 6848939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:55:47+00:00 2026-05-27T00:55:47+00:00

I have the following vertex shader: uniform mat4 uMVP; attribute vec4 aPosition; attribute vec4

  • 0

I have the following vertex shader:

uniform mat4 uMVP;
attribute vec4 aPosition;
attribute vec4 aNormal;
attribute vec2 aTexCoord;
varying vec2 vTexCoord;
varying vec4 vPrimaryColor;
void main() {
  gl_Position = uMVP * aPosition;
  vPrimaryColor = vec4(1.0, 1.0, 1.0, 1.0);
  vTexCoord = aTexCoord;
}

And the following fragment shader:

uniform sampler2D sTex;
varying vec2 vTexCoord;
varying vec4 vPrimaryColor;
void main() {
  gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
}

Note that while I have a vTexCoord and vPrimaryColor, neither of which are used in the fragment shader. (The reason why they are there is because they eventually will be).

Now, I also set uMVP to be the identity matrix for now, and draw using the following code:

// Load the matrix
glUniformMatrix4fv(gvMVPHandle, 1, false, &mvPMatrix.matrix[0][0]);

// Draw the square to be textured
glVertexAttribPointer(gvPositionHandle, 2, GL_FLOAT, GL_FALSE, 0, gFullScreenQuad);
glEnableVertexAttribArray(gvPositionHandle);
glVertexAttribPointer(gvTexCoordHandle, 2, GL_FLOAT, GL_FALSE, 0, gFullScreenQuad);
glDrawArrays(GL_QUADS, 0, 4);

where the square is:

const GLfloat PlotWidget::gFullScreenQuad[] = { -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f};

So, when I run this program, I get a black screen. Which does not seem like you would expect. However, when I change the line in the shade:

vTexCoord = aTexCoord;

To

vTexCoord = vec2(1.0, 1.0);

It works perfectly. So I would assume the problem with the code is with that line of code, but I can’t think of anything in opengl that would cause this. Also, I’m using Qt for this project, which means this class is using the QGLWidget. I’ve never had this issue with OpenGL ES 2.0.

Any suggestions?

I’m sorry for the vague title, but I don’t even know what class of problem this would be.

  • 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-05-27T00:55:47+00:00Added an answer on May 27, 2026 at 12:55 am

    Are you checking glGetShaderInfoLog and glGetProgramInfoLog during your shader compilation? If not then I would recommend that as the first port of call.

    Next thing to check would be your the binding for the texture coordinates. Are the attributes are being set up correctly? Is the data valid?

    Finally, start stepping through your code with liberal spraying of glGetError calls. It wil almost certainly fail on glDrawArrays which won’t help you much, but that’s usually when the desparation sets in for me!

    OR

    You could try gDEBugger. I use it mainly to look for bottlenecks and to make sure I’m releasing OpenGL resources properly so can’t vouch for the debugger, but it’s worth a shot.

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

Sidebar

Related Questions

I have the following vertex shader : uniform mediump mat4 projMx; attribute vec2 a_position;
I have the following vertex shader: attribute vec4 Position; attribute vec4 SourceColor; varying vec4
I'm developing an Android application. I have the following vertex shader. attribute vec4 vertexPosition;
I have the following GLSL vertex shader: attribute vec3 a_vTangent; attribute vec3 a_vBinormal; attribute
I have the following vertex declration: struct MESHVERTInstanced { float x, y, z; //
I have the following class: public class Vertex() { private double xCoord; private double
I have a vertex and fragment shader and I want to show a solid
In the vertex shader program of a WebGL application, I am doing the following:
I have the following classes: class Vertex { public: float X; float Y; float
I have the following shader taken from the android SDK sampele: final String vertexShader

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.