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

  • Home
  • SEARCH
  • 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 8996547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:46:08+00:00 2026-06-15T23:46:08+00:00

Just doing my computer graphics assignment – put texture (600×400 bitmap with different numbers)

  • 0

Just doing my computer graphics assignment – put texture (600×400 bitmap with different numbers) on a cube to form a proper dice. I managed to do it using “classical” texture mapping: creating verices and adding corresponding texture coordinates to it:

int arrayindex = 0;
float xpos = 0.0f;
float xposEnd = 0.32f;
float ypos = 0.0f;
float yposEnd = 0.49f;
int count = 0;
void quad( int a, int b, int c, int d ) {
    colors[arrayindex] = vertex_colors[a];
    points[arrayindex] = vertices[a];
    tex_coord[arrayindex] = new Point2(xpos, ypos);
    arrayindex++;
    colors[arrayindex] = vertex_colors[b];
    points[arrayindex] = vertices[b];
    tex_coord[arrayindex] = new Point2(xpos, yposEnd);
    arrayindex++;
    colors[arrayindex] = vertex_colors[c];
    points[arrayindex] = vertices[c];
    tex_coord[arrayindex] = new Point2(xposEnd, yposEnd);
    arrayindex++;
    colors[arrayindex] = vertex_colors[a];
    points[arrayindex] = vertices[a];
    tex_coord[arrayindex] = new Point2(xpos, ypos);
    arrayindex++;
    colors[arrayindex] = vertex_colors[c];
    points[arrayindex] = vertices[c];
    tex_coord[arrayindex] = new Point2(xposEnd, yposEnd);
    arrayindex++;
    colors[arrayindex] = vertex_colors[d];
    points[arrayindex] = vertices[d]; 
    tex_coord[arrayindex] = new Point2(xposEnd, ypos);
    arrayindex++;
    xpos = xpos + 0.34f;
    xposEnd = xpos + 0.32f;
    count++;
    if (count == 3) {
        xpos = 0.0f;
        xposEnd = 0.33f;
        ypos = 0.51f;
        yposEnd = 1.0f;
    }
}

void colorcube() {
    quad( 1, 0, 3, 2 );
    quad( 2, 3, 7, 6 );
    quad( 3, 0, 4, 7 );
    quad( 6, 5, 1, 2 );
    quad( 5, 4, 0, 1 );
    quad( 4, 5, 6, 7 );

    pointsBuf = VectorMath.toBuffer(points);
    colorsBuf = VectorMath.toBuffer(colors);
    texcoord = VectorMath.toBuffer(tex_coord);
}

Passing all this stuff to shaders and just putting it up together.

But reviewing the slides i noticed this method is supposed to be “pre opengl3”.
Is there any other method to do this stuff?

In lecture examples i noticed putting it up together in the vertex shader but it was just for a simple 2d plane, not a 3d cube

tex_coords = vec2(vPosition.x+0.5,vPosition.z+0.5);

and later passed to fragment shader to create the texture.

  • 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-15T23:46:09+00:00Added an answer on June 15, 2026 at 11:46 pm

    But reviewing the slides i noticed this method is supposed to be “pre opengl3”.

    I think your slides refer to the old immediate mode. In immediate mode each vertex and its attributes are sent to OpenGL by calling functions that immediately draw them.

    In your code however you’re initializing a buffer with vertex data. This buffer may then passed as a whole to OpenGL and drawn as a batch by only a single OpenGL call. I wrote “may” because there’s not a single OpenGL call in your question.

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

Sidebar

Related Questions

I am doing a homework assignment for my Computer Science course. The task is
I'm doing some computer hardware architectural explorations and I was eager to test different
I was just doing some random testing on locking in multi-threading this morning and
I'm just doing a simple graph using Open Flash Chart http://teethgrinder.co.uk/open-flash-chart/ which shows the
I'm basically just doing some tests to figure out a good way to write
At first i was just doing if statements to check the type of the
I'm sure I'm just doing something stupid here, but I can't quite figure out
I have a progressBar using the ProgressBar class. Just doing this: progressBar = new
Doesn't seem to work for me, maybe I just doing it wrong
I just started doing OOP, so I apologize in advance if there is a

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.