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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:32:22+00:00 2026-06-12T13:32:22+00:00

I am trying to map a texture to a quad in pyglet using the

  • 0

I am trying to map a texture to a quad in pyglet using the opengl functions but the quad is just showing up as white.

My code looks like this:

import pyglet
from pyglet.gl import *

glEnable(GL_TEXTURE_2D)
image = pyglet.image.load("redbrick.png")
texture = image.get_texture()

and my draw function:

def on_draw():
    window.clear()

    glBindTexture (GL_TEXTURE_2D, 13)
    glBegin (GL_QUADS);
    glTexCoord2i (0, 0)
    glVertex2i (0, 0)
    glTexCoord2i (1, 0)
    glVertex2i (100, 0)
    glTexCoord2i (1, 1)
    glVertex2i (100, 100)
    glTexCoord2i (0, 1)
    glVertex2i (0, 100)
    glEnd ()

Is there something I am doing wrong or missing out for it to be drawn as a white quad?

  • 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-12T13:32:23+00:00Added an answer on June 12, 2026 at 1:32 pm

    I see a few things that may be wrong. It would be nice to have the full code in like a pastebin but I can’t comment to ask so…

    your texture needs to be made into an opengl texture. You need to first convert your image into a raw data format. When you load the image do image.get_data(), compressed into a single line below. This isn’t the most efficient way but a simple example.

    After Binding the texture set drawing parameters.

    Then hand the data to the video card in glTexImage2D.

    data=pyglet.image.load("redbrick.png").get_data()
    texture_id = glGenTextures(1)
    glBindTexture(GL_TEXTURE_2D, texture_id)
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (image_width), (image_height), 0, GL_RGBA, GL_UNSIGNED_BYTE, data)
    

    After that you should be able to use this texture if you bind with texture_id. 13 could be nothing for all I can see. Provide all the code and I could probably revise.

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

Sidebar

Related Questions

I've been trying to map an object to a database using SQLAlchemy but have
I am trying to map a texture to a circle using GL_POLYGON using this
I'm trying to map a globe texture onto a sphere. I'm using a plate
Im trying to create a polygon with texture in opengl using this Nehe Loadraw
I am trying to map a different texture on each side of a cube
Trying to map the following schema using the Entity Framework. A Customer can have
I'm trying to map a parent-child relationship using NHibernate (2.1.2), MySql.Data (6.2.2) and MySQL
I am trying to map a texture onto a square where the texture stretches
I am trying to write an optimized code that renders a 3D scene using
I am trying to understand the concept of texture mapping. I tried to map

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.