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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:09:32+00:00 2026-06-01T22:09:32+00:00

I’m trying to display an image on a point on the screen. I have

  • 0

I’m trying to display an image on a point on the screen.

I have the pitch and the yaw of the current point. All I need is to convert these values to a 2 coord points.

Here is what I’ve done so far:

double tmp_yaw = yaw - myPlayer_yaw;
double tmp_pitch = pitch - myPlayer_pitch;

if (tmp_yaw < -180D) tmp_yaw += 360D;
if (tmp_yaw > 180D) tmp_yaw -= 360D;

// X Y screen coords
int x = (tmp_yaw / 180) * (screen_width / 2);
int y = (tmp_pitch / 90) * (screen_height / 2);

At first glance, this code looks easy but I don’t know why I doesn’t display the point where it is expected.

Variables yaw and pitch are here the rotation to the point in 3D.

Variables myPlayer_yaw and myPlayer_pitch stand for where the player is looking at any moment.

Did I do something wrong?

enter image description here

I want to get those kind of results:

  • I’m looking a player => Returns (height/2, width/2)
  • The player is behind me => Returns (height, width/2)
  • The player is on my left => Returns (height/2, 0)
  • The player is on my right => Returns (height/2, width)
  • The player is just above me => Returns (0, width/2)
  • 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-01T22:09:34+00:00Added an answer on June 1, 2026 at 10:09 pm

    Finally I solved it using vertex3D

    Here is the code:

    public void drawLine(Vector3 origin, Vector3 destination, int color)
    {
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glLineWidth(3.0F);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDepthMask(false);
        GL11.glBegin(GL11.GL_LINES);
    
        float red = (float)((color & 0xFF0000) >> 16);
        float green = (float)((color & 0x00FF00) >> 8);
        float blue = (float)(color & 0x0000FF);
        GL11.glColor3f(red, green, blue);
    
        double diffX = destination.x() - origin.x() + 0.05D;
        double diffY = destination.y() - origin.y() - 1.35D;
        double diffZ = destination.z() - origin.z() - 0.05D;
    
        GL11.glVertex3d(0.0D, 0.0D, 0.0D);
        GL11.glVertex3d( -diffX, -diffY, -diffZ);
    
        GL11.glEnd();
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
    }
    

    You can use it like that:

    Vector3 vOrg = new Vector3(x, y, z);
    Vector3 vDest = new Vector3(cameraX, cameraY, cameraZ);
    drawLine(vOrg, vDest, 0xFF0000); // Will display a red line (RGB format)
    

    I hope this will help someone.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
In my XML file chapters tag has more chapter tag.i need to display chapters
I have a text area in my form which accepts all possible characters from
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to loop through a bunch of documents I have to put
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,

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.