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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:42:34+00:00 2026-06-09T04:42:34+00:00

I try to use data raw texture using GL_TEXTURE_RECTANGLE_ARB: void Display::tex(){ GLubyte Texture[16] =

  • 0

I try to use data raw texture using GL_TEXTURE_RECTANGLE_ARB:

void Display::tex(){

GLubyte Texture[16] =
{    
0,0,0,0, 0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF, 0,0,0,0
};
GLuint Nom;
glLoadIdentity();//load identity matrix
glTranslatef(0.0f,0.0f,-4.0f);//move forward 4 units

glEnable(GL_DEPTH_TEST);    //Active le depth test
glDisable( GL_CULL_FACE );

glEnable (GL_TEXTURE_RECTANGLE_ARB);

glPixelStorei(GL_UNPACK_ROW_LENGTH, 2);

glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

glGenTextures(1, &Nom);

glBindTexture(GL_TEXTURE_RECTANGLE_ARB, Nom);

glTexParameteri(GL_TEXTURE_RECTANGLE_ARB,

                GL_TEXTURE_MIN_FILTER, GL_LINEAR);

glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8, 2, 2,

                0, GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, Texture);
angle  = 0.01 * glutGet ( GLUT_ELAPSED_TIME );
glRotatef(angle,0,1,1);

glBegin(GL_QUADS);  //Et c'est parti pour le cube !

glTexCoord2i(0,0);glVertex3i(-1,-1,-1);
glTexCoord2i(1,0);glVertex3i(+1,-1,-1);
glTexCoord2i(1,1);glVertex3i(+1,+1,-1);
glTexCoord2i(0,1);glVertex3i(-1,+1,-1);

//1 face

glTexCoord2i(0,0);glVertex3i(-1,-1,+1);
glTexCoord2i(1,0);glVertex3i(+1,-1,+1);
glTexCoord2i(1,1);glVertex3i(+1,+1,+1);
glTexCoord2i(0,1);glVertex3i(-1,+1,+1);

//2 faces

glTexCoord2i(0,0);glVertex3i(+1,-1,-1);
glTexCoord2i(1,0);glVertex3i(+1,-1,+1);
glTexCoord2i(1,1);glVertex3i(+1,+1,+1);
glTexCoord2i(0,1);glVertex3i(+1,+1,-1);

//3 faces

glTexCoord2i(0,0);glVertex3i(-1,-1,-1);
glTexCoord2i(1,0);glVertex3i(-1,-1,+1);
glTexCoord2i(1,1);glVertex3i(-1,+1,+1);
glTexCoord2i(0,1);glVertex3i(-1,+1,-1);

//4 faces

glTexCoord2i(1,0);glVertex3i(-1,+1,-1);
glTexCoord2i(1,1);glVertex3i(+1,+1,-1);
glTexCoord2i(0,1);glVertex3i(+1,+1,+1);
glTexCoord2i(0,0);glVertex3i(-1,+1,+1);

//5 faces

glTexCoord2i(1,0);glVertex3i(-1,-1,+1);
glTexCoord2i(1,1);glVertex3i(+1,-1,+1);
glTexCoord2i(0,1);glVertex3i(+1,-1,-1);
glTexCoord2i(0,0);glVertex3i(-1,-1,-1);

//6 faces
glEnd();

glFlush();
}

The result is not very good :

http://shareimage.ro/images/xdkyd12oty44c0qpuo1b.png

The cube should have all faces with an texture 4 square (2 black and 2 white ) .

I dont know where is the error…

  • 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-09T04:42:37+00:00Added an answer on June 9, 2026 at 4:42 am

    It’s working now, see next:

    GLubyte Texture[16] =
    {
    0,0xFF,0,0xFF, 0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF, 0,0,0,0
    };
    GLuint Nom;
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );   //Efface le framebuffer et le depthbuffer
    glMatrixMode(GL_MODELVIEW);     //Un petit gluLookAt()...
    glLoadIdentity();//load identity matrix
    glTranslatef(0.0f,0.0f,-4.0f);//move forward 4 units
    angle  = 0.1 * glutGet ( GLUT_ELAPSED_TIME );
    glRotatef(angle,0,2,2);
    glEnable(GL_TEXTURE_2D);
    glEnable (GL_TEXTURE_RECTANGLE_ARB);
    glPixelStorei(GL_UNPACK_ROW_LENGTH, 2);
    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
    glGenTextures(1,&Nom);  //Génère un n° de texture
    glBindTexture(GL_TEXTURE_2D,Nom);   //Sélectionne ce n°
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 4, 4, 0, GL_RGB,GL_UNSIGNED_BYTE, Texture);
    glTexParameterf(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // GL_CLAMP_TO_EDGE
    glTexParameterf(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // GL_CLAMP_TO_EDGE
    glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8, 2, 2, 0, GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, Texture);
    glBegin(GL_QUADS);
    glTexCoord2i(0,0);glVertex3i(-1,-1,-1);
    glTexCoord2i(2,0);glVertex3i(+1,-1,-1);
    glTexCoord2i(2,2);glVertex3i(+1,+1,-1);
    glTexCoord2i(0,2);glVertex3i(-1,+1,-1);
    //1 face
    glTexCoord2i(0,0);glVertex3i(-1,-1,+1);
    glTexCoord2i(2,0);glVertex3i(+1,-1,+1);
    glTexCoord2i(2,2);glVertex3i(+1,+1,+1);
    glTexCoord2i(0,2);glVertex3i(-1,+1,+1);
    //2 faces
    glTexCoord2i(0,0);glVertex3i(+1,-1,-1);
    glTexCoord2i(2,0);glVertex3i(+1,-1,+1);
    glTexCoord2i(2,2);glVertex3i(+1,+1,+1);
    glTexCoord2i(0,2);glVertex3i(+1,+1,-1);
    //3 faces
    glTexCoord2i(0,0);glVertex3i(-1,-1,-1);
    glTexCoord2i(2,0);glVertex3i(-1,-1,+1);
    glTexCoord2i(2,2);glVertex3i(-1,+1,+1);
    glTexCoord2i(0,2);glVertex3i(-1,+1,-1);
    glEnd();
    glDisable(GL_TEXTURE_2D);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am try to use an external website to get data but what I
I have a problem when try to use hashtable with large data. I have
I use kohana and when you try to fetch data from database it returns
When I try the following #!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @bl
I try use string as a regular expression pattern but I've following errors PHP
I try use a integer array in java with the code below: public static
I try to use a variable in my kshell script but can't get a
I try to use the great particle emitter which Michael Daley build for his
I try to use SQL SERVER VIEW within RIA Services. So I created some
i try to use TBXML and getting this error TBXML class method +tbXMLWithURL not

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.